From: Drew Adams Date: Thu, 12 Apr 2012 20:00:24 +0000 (+0200) Subject: * imenu.el (imenu--generic-function): Ignore invisible definitions. X-Git-Tag: emacs-24.2.90~471^2~364^2~19 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d333dc4c9619d594654427180776a59c766ff853;p=emacs.git * imenu.el (imenu--generic-function): Ignore invisible definitions. Fixes: debbugs:10123 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0e50a9e7ada..adddc5cd1f0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-12 Drew Adams + + * imenu.el (imenu--generic-function): Ignore invisible definitions + (bug#10123). + 2012-04-12 Vivek Dasmohapatra * hexl.el (hexl-bits): New variable. 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))))