]> code.delx.au - gnu-emacs/blobdiff - lisp/imenu.el
* doc/lispref/modes.texi (Imenu): Make it clear that sub-alist is the cdr.
[gnu-emacs] / lisp / imenu.el
index f41fcda2713df71f99c2149b98217578cd37e9a6..5e03a3a90814409eedc2479e9be6a005835a47ae 100644 (file)
@@ -293,8 +293,10 @@ The function in this variable is called when selecting a normal index-item.")
 
 
 (defun imenu--subalist-p (item)
-  (and (consp (cdr item)) (listp (cadr item))
-       (not (eq (car (cadr item)) 'lambda))))
+  (and (consp item)
+       (consp (cdr item))
+       (listp (cadr item))
+       (not (functionp (cadr item)))))
 
 (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse)
   "Macro to display a progress message.
@@ -645,9 +647,11 @@ Non-nil arguments are in recursive calls."
       ;;   (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...)
       ;; while a bottom-level element looks like
       ;;   (INDEX-NAME . INDEX-POSITION)
+      ;; or
+      ;;   (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...)
       ;; We are only interested in the bottom-level elements, so we need to
-      ;; recurse if TAIL is a list.
-      (cond ((listp tail)
+      ;; recurse if TAIL is a nested ALIST.
+      (cond ((imenu--subalist-p elt)
             (if (setq res (imenu--in-alist str tail))
                 (setq alist nil)))
            ((if imenu-name-lookup-function
@@ -1033,8 +1037,8 @@ for more information."
                (nth 2 index-item) imenu-default-goto-function))
           (position (if is-special-item
                         (cadr index-item) (cdr index-item)))
-          (rest (if is-special-item (cddr index-item))))
-      (apply function (car index-item) position rest))
+          (args (if is-special-item (cdr (cddr index-item)))))
+      (apply function (car index-item) position args))
     (run-hooks 'imenu-after-jump-hook)))
 
 (provide 'imenu)