1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

(imenu--generic-function): Skip matches in comments.

This commit is contained in:
Daniel Pfeiffer 2004-10-26 21:38:09 +00:00
parent 1442465dfd
commit 8522009efb

View File

@ -62,6 +62,8 @@
;;; Code:
(require 'newcomment)
(eval-when-compile (require 'cl))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -796,12 +798,17 @@ depending on PATTERNS."
(regexp (nth 1 pat))
(index (nth 2 pat))
(function (nth 3 pat))
(rest (nthcdr 4 pat)))
(rest (nthcdr 4 pat))
cs)
;; Go backwards for convenience of adding items in order.
(goto-char (point-max))
(while (re-search-backward regexp nil t)
(imenu-progress-message prev-pos nil t)
(goto-char (match-end index))
(setq beg (match-beginning index))
(if (setq cs (save-match-data (comment-beginning)))
(goto-char cs) ; skip this one, it's in a comment
(goto-char beg)
(imenu-progress-message prev-pos nil t)
;; Add this sort of submenu only when we've found an
;; item for it, avoiding empty, duff menus.
(unless (assoc menu-title index-alist)
@ -821,7 +828,7 @@ depending on PATTERNS."
;; Insert the item unless it is already present.
(unless (member item (cdr menu))
(setcdr menu
(cons item (cdr menu))))))))
(cons item (cdr menu)))))))))
(set-syntax-table old-table)))
(imenu-progress-message prev-pos 100 t)
;; Sort each submenu by position.