* imenu.el (imenu--generic-function): Ignore invisible definitions.

Fixes: debbugs:10123
This commit is contained in:
Drew Adams 2012-04-12 22:00:24 +02:00 committed by Lars Magne Ingebrigtsen
parent 0a6dd5e26f
commit d333dc4c96
2 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2012-04-12 Drew Adams <drew.adams@oracle.com>
* imenu.el (imenu--generic-function): Ignore invisible definitions
(bug#10123).
2012-04-12 Vivek Dasmohapatra <vivek@etla.org>
* hexl.el (hexl-bits): New variable.

View file

@ -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))))