# HG changeset patch # User Richard M. Stallman # Date 841018101 0 # Node ID 955269257adf630508b015a715b64b3e91cfdc6c # Parent 2882af484d9cd82332c93762c8801c3c0caa3521 (imenu--in-alist): Accept only bottom-level matches. diff -r 2882af484d9c -r 955269257adf lisp/imenu.el --- a/lisp/imenu.el Sun Aug 25 23:31:20 1996 +0000 +++ b/lisp/imenu.el Mon Aug 26 00:08:21 1996 +0000 @@ -493,11 +493,17 @@ 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 ()