aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman2004-12-03 00:21:37 +0000
committerRichard M. Stallman2004-12-03 00:21:37 +0000
commit237470e87b72dccf5a8eecc95882fbe5cf996d3b (patch)
tree0daf55c839f0065511f74f16da403b7d8f40b86c /lisp
parent8d2a4f61c8ff970b7c0ad1978f719cc2c88ea536 (diff)
downloademacs-237470e87b72dccf5a8eecc95882fbe5cf996d3b.tar.gz
emacs-237470e87b72dccf5a8eecc95882fbe5cf996d3b.zip
(imenu--generic-function): Delete code to exclude matches in comments.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/imenu.el62
1 files changed, 27 insertions, 35 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 32dda9fd3c6..af617498b07 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -798,8 +798,6 @@ depending on PATTERNS."
798 (unwind-protect ; for syntax table 798 (unwind-protect ; for syntax table
799 (save-match-data 799 (save-match-data
800 (set-syntax-table table) 800 (set-syntax-table table)
801 (if (or comment-start comment-start-skip)
802 (comment-normalize-vars))
803 801
804 ;; map over the elements of imenu-generic-expression 802 ;; map over the elements of imenu-generic-expression
805 ;; (typically functions, variables ...) 803 ;; (typically functions, variables ...)
@@ -809,8 +807,7 @@ depending on PATTERNS."
809 (index (nth 2 pat)) 807 (index (nth 2 pat))
810 (function (nth 3 pat)) 808 (function (nth 3 pat))
811 (rest (nthcdr 4 pat)) 809 (rest (nthcdr 4 pat))
812 start 810 start)
813 cs)
814 ;; Go backwards for convenience of adding items in order. 811 ;; Go backwards for convenience of adding items in order.
815 (goto-char (point-max)) 812 (goto-char (point-max))
816 (while (and (re-search-backward regexp nil t) 813 (while (and (re-search-backward regexp nil t)
@@ -820,37 +817,32 @@ depending on PATTERNS."
820 (setq start (point)) 817 (setq start (point))
821 (goto-char (match-end index)) 818 (goto-char (match-end index))
822 (setq beg (match-beginning index)) 819 (setq beg (match-beginning index))
823 (setq cs (and (or comment-start comment-start-skip) 820 (goto-char beg)
824 (save-match-data 821 (imenu-progress-message prev-pos nil t)
825 (comment-beginning)))) 822 ;; Add this sort of submenu only when we've found an
826 (if cs 823 ;; item for it, avoiding empty, duff menus.
827 (goto-char (min cs beg)) ; skip this one, it's in a comment 824 (unless (assoc menu-title index-alist)
828 (goto-char beg) 825 (push (list menu-title) index-alist))
829 (imenu-progress-message prev-pos nil t) 826 (if imenu-use-markers
830 ;; Add this sort of submenu only when we've found an 827 (setq beg (copy-marker beg)))
831 ;; item for it, avoiding empty, duff menus. 828 (let ((item
832 (unless (assoc menu-title index-alist) 829 (if function
833 (push (list menu-title) index-alist)) 830 (nconc (list (match-string-no-properties index)
834 (if imenu-use-markers 831 beg function)
835 (setq beg (copy-marker beg))) 832 rest)
836 (let ((item 833 (cons (match-string-no-properties index)
837 (if function 834 beg)))
838 (nconc (list (match-string-no-properties index) 835 ;; This is the desired submenu,
839 beg function) 836 ;; starting with its title (or nil).
840 rest) 837 (menu (assoc menu-title index-alist)))
841 (cons (match-string-no-properties index) 838 ;; Insert the item unless it is already present.
842 beg))) 839 (unless (member item (cdr menu))
843 ;; This is the desired submenu, 840 (setcdr menu
844 ;; starting with its title (or nil). 841 (cons item (cdr menu)))))
845 (menu (assoc menu-title index-alist))) 842 ;; Move to the start of the entire match,
846 ;; Insert the item unless it is already present. 843 ;; to ensure we keep moving backwards
847 (unless (member item (cdr menu)) 844 ;; as long as the match is nonempty.
848 (setcdr menu 845 (goto-char start))))
849 (cons item (cdr menu)))))
850 ;; Move to the start of the entire match,
851 ;; to ensure we keep moving backwards
852 ;; as long as the match is nonempty.
853 (goto-char start)))))
854 (set-syntax-table old-table))) 846 (set-syntax-table old-table)))
855 (imenu-progress-message prev-pos 100 t) 847 (imenu-progress-message prev-pos 100 t)
856 ;; Sort each submenu by position. 848 ;; Sort each submenu by position.