/[emacs]/emacs/lisp/imenu.el
ViewVC logotype

Diff of /emacs/lisp/imenu.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.108 by kfstorm, Wed Feb 9 15:50:42 2005 UTC revision 1.109 by rms, Sat Apr 23 16:43:30 2005 UTC
# Line 777  They may also be nested index alists lik Line 777  They may also be nested index alists lik
777  depending on PATTERNS."  depending on PATTERNS."
778    
779    (let ((index-alist (list 'dummy))    (let ((index-alist (list 'dummy))
780          prev-pos beg          prev-pos
781          (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search)          (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search)
782                                    (not (local-variable-p 'font-lock-defaults)))                                    (not (local-variable-p 'font-lock-defaults)))
783                                imenu-case-fold-search                                imenu-case-fold-search
# Line 807  depending on PATTERNS." Line 807  depending on PATTERNS."
807                    (index (nth 2 pat))                    (index (nth 2 pat))
808                    (function (nth 3 pat))                    (function (nth 3 pat))
809                    (rest (nthcdr 4 pat))                    (rest (nthcdr 4 pat))
810                    start)                    start beg)
811                ;; Go backwards for convenience of adding items in order.                ;; Go backwards for convenience of adding items in order.
812                (goto-char (point-max))                (goto-char (point-max))
813                (while (and (re-search-backward regexp nil t)                (while (and (re-search-backward regexp nil t)
# Line 815  depending on PATTERNS." Line 815  depending on PATTERNS."
815                            ;; because it means a bad regexp was specified.                            ;; because it means a bad regexp was specified.
816                            (not (= (match-beginning 0) (match-end 0))))                            (not (= (match-beginning 0) (match-end 0))))
817                  (setq start (point))                  (setq start (point))
818                  (goto-char (match-end index))                  ;; Record the start of the line in which the match starts.
                 (setq beg (match-beginning index))  
                 ;; Go to the start of the match.  
819                  ;; That's the official position of this definition.                  ;; That's the official position of this definition.
820                  (goto-char start)                  (goto-char (match-beginning index))
821                    (beginning-of-line)
822                    (setq beg (point))
823                  (imenu-progress-message prev-pos nil t)                  (imenu-progress-message prev-pos nil t)
824                  ;; Add this sort of submenu only when we've found an                  ;; Add this sort of submenu only when we've found an
825                  ;; item for it, avoiding empty, duff menus.                  ;; item for it, avoiding empty, duff menus.
826                  (unless (assoc menu-title index-alist)                  (unless (assoc menu-title index-alist)
827                    (push (list menu-title) index-alist))                    (push (list menu-title) index-alist))
828                  (if imenu-use-markers                  (if imenu-use-markers
829                      (setq start (copy-marker start)))                      (setq beg (copy-marker beg)))
830                  (let ((item                  (let ((item
831                         (if function                         (if function
832                             (nconc (list (match-string-no-properties index)                             (nconc (list (match-string-no-properties index)
833                                          start function)                                          beg function)
834                                    rest)                                    rest)
835                           (cons (match-string-no-properties index)                           (cons (match-string-no-properties index)
836                                 start)))                                 beg)))
837                        ;; This is the desired submenu,                        ;; This is the desired submenu,
838                        ;; starting with its title (or nil).                        ;; starting with its title (or nil).
839                        (menu (assoc menu-title index-alist)))                        (menu (assoc menu-title index-alist)))
840                    ;; Insert the item unless it is already present.                    ;; Insert the item unless it is already present.
841                    (unless (member item (cdr menu))                    (unless (member item (cdr menu))
842                      (setcdr menu                      (setcdr menu
843                              (cons item (cdr menu))))))))                              (cons item (cdr menu)))))
844                    ;; Go to the start of the match, to make sure we
845                    ;; keep making progress backwards.
846                    (goto-char start))))
847            (set-syntax-table old-table)))            (set-syntax-table old-table)))
848      (imenu-progress-message prev-pos 100 t)      (imenu-progress-message prev-pos 100 t)
849      ;; Sort each submenu by position.      ;; Sort each submenu by position.

Legend:
Removed from v.1.108  
changed lines
  Added in v.1.109

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26