=== modified file 'doc/lispref/modes.texi' *** doc/lispref/modes.texi 2013-08-17 11:14:10 +0000 --- doc/lispref/modes.texi 2013-11-25 00:39:51 +0000 *************** *** 2483,2489 **** A nested sub-alist element looks like this: @example ! (@var{menu-title} @var{sub-alist}) @end example It creates the submenu @var{menu-title} specified by @var{sub-alist}. --- 2483,2489 ---- A nested sub-alist element looks like this: @example ! (@var{menu-title} . @var{sub-alist}) @end example It creates the submenu @var{menu-title} specified by @var{sub-alist}. === modified file 'lisp/ChangeLog' *** lisp/ChangeLog 2013-11-24 22:53:35 +0000 --- lisp/ChangeLog 2013-11-25 00:45:59 +0000 *************** *** 1,3 **** --- 1,10 ---- + 2013-11-22 Andreas Politz + * imenu.el (imenu--subalist-p): Don't error on non-conses and + allow non-lambda lists as functions. + (imenu--in-alist): Don't recurse into non-subalists. + (imenu): Don't pass function itself as an argument. + * doc/lispref/modes.texi: Make it clear that sub-alist is the cdr. + 2013-11-24 Simon Schubert <2@0x2c.org> (tiny change) * json.el (json-alist-p): Only return non-nil if the alist has === modified file 'lisp/imenu.el' *** lisp/imenu.el 2013-11-24 21:23:47 +0000 --- lisp/imenu.el 2013-11-25 01:26:34 +0000 *************** *** 293,300 **** (defun imenu--subalist-p (item) ! (and (consp (cdr item)) (listp (cadr item)) ! (not (eq (car (cadr item)) 'lambda)))) (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) "Macro to display a progress message. --- 293,302 ---- (defun imenu--subalist-p (item) ! (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,653 **** ;; (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))) ((if imenu-name-lookup-function --- 647,657 ---- ;; (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 nested ALIST. ! (cond ((imenu--subalist-p elt) (if (setq res (imenu--in-alist str tail)) (setq alist nil))) ((if imenu-name-lookup-function *************** *** 1033,1040 **** (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)) (run-hooks 'imenu-after-jump-hook))) (provide 'imenu) --- 1037,1044 ---- (nth 2 index-item) imenu-default-goto-function)) (position (if is-special-item (cadr index-item) (cdr index-item))) ! (args (if is-special-item (cdr (cddr index-item))))) ! (apply function (car index-item) position args)) (run-hooks 'imenu-after-jump-hook))) (provide 'imenu)