aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/imenu.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1996-08-26 00:08:21 +0000
committerRichard M. Stallman <[email protected]>1996-08-26 00:08:21 +0000
commit8396299d26c6901fa2cfba2b09ae819a9bb6e6af (patch)
tree9d132fd26d59b605eed2bea4b825fb2535973e1c /lisp/imenu.el
parente932d73def46fc2ef854a514070cf7132db545c9 (diff)
(imenu--in-alist): Accept only bottom-level matches.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index bc9e866936..b62b650e5e 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -493,11 +493,17 @@ This function is called after the function pointed out by
tail (cdr elt)
alist (cdr alist)
head (car elt))
- (if (string= str head)
- (setq alist nil res elt)
- (if (and (listp tail)
- (setq res (imenu--in-alist str tail)))
- (setq alist nil))))
+ ;; A nested ALIST element looks like
+ ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...)
+ ;; while a bottom-level element looks like
+ ;; (INDEX-NAME . INDEX-POSITION)
+ ;; We are only interested in the bottom-level elements, so we need to
+ ;; recurse if TAIL is a list.
+ (cond ((listp tail)
+ (if (setq res (imenu--in-alist str tail))
+ (setq alist nil)))
+ ((string= str head)
+ (setq alist nil res elt))))
res))
(defun imenu-default-create-index-function ()