aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-08-26 00:08:21 +0000
committerRichard M. Stallman1996-08-26 00:08:21 +0000
commit8396299d26c6901fa2cfba2b09ae819a9bb6e6af (patch)
tree9d132fd26d59b605eed2bea4b825fb2535973e1c
parente932d73def46fc2ef854a514070cf7132db545c9 (diff)
downloademacs-8396299d26c6901fa2cfba2b09ae819a9bb6e6af.tar.gz
emacs-8396299d26c6901fa2cfba2b09ae819a9bb6e6af.zip
(imenu--in-alist): Accept only bottom-level matches.
-rw-r--r--lisp/imenu.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index bc9e8669369..b62b650e5e6 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -493,11 +493,17 @@ This function is called after the function pointed out by
493 tail (cdr elt) 493 tail (cdr elt)
494 alist (cdr alist) 494 alist (cdr alist)
495 head (car elt)) 495 head (car elt))
496 (if (string= str head) 496 ;; A nested ALIST element looks like
497 (setq alist nil res elt) 497 ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...)
498 (if (and (listp tail) 498 ;; while a bottom-level element looks like
499 (setq res (imenu--in-alist str tail))) 499 ;; (INDEX-NAME . INDEX-POSITION)
500 (setq alist nil)))) 500 ;; We are only interested in the bottom-level elements, so we need to
501 ;; recurse if TAIL is a list.
502 (cond ((listp tail)
503 (if (setq res (imenu--in-alist str tail))
504 (setq alist nil)))
505 ((string= str head)
506 (setq alist nil res elt))))
501 res)) 507 res))
502 508
503(defun imenu-default-create-index-function () 509(defun imenu-default-create-index-function ()