summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
authorDrew Adams <drew.adams@oracle.com>2012-04-12 22:00:24 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2012-04-12 22:00:24 +0200
commitd333dc4c9619d594654427180776a59c766ff853 (patch)
treeb7367d289934f6a7178edf1b567bd7b31f5be219 /lisp/imenu.el
parent0a6dd5e26f0c6257bd5d6d00ba8387080893d945 (diff)
downloademacs-d333dc4c9619d594654427180776a59c766ff853.tar.gz
* imenu.el (imenu--generic-function): Ignore invisible definitions.
Fixes: debbugs:10123
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 5472f4246d1..08e6338b39e 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -800,7 +800,17 @@ depending on PATTERNS."
(goto-char (point-max))
(while (and (if (functionp regexp)
(funcall regexp)
- (re-search-backward regexp nil t))
+ (and
+ (re-search-backward regexp nil t)
+ ;; Do not count invisible definitions.
+ (let ((invis (invisible-p (point))))
+ (or (not invis)
+ (progn
+ (while (and invis
+ (not (bobp)))
+ (setq invis (not (re-search-backward
+ regexp nil 'move))))
+ (not invis))))))
;; Exit the loop if we get an empty match,
;; because it means a bad regexp was specified.
(not (= (match-beginning 0) (match-end 0))))