* doc/lispref/modes.texi (Imenu): Make it clear that sub-alist is the cdr.
* lisp/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. Fixes: debbugs:14029
This commit is contained in:
parent
bd15d9d1ad
commit
c8f0efc2e8
4 changed files with 22 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-11-29 Andreas Politz <politza@fh-trier.de>
|
||||
|
||||
* modes.texi (Imenu): Make it clear that sub-alist is the cdr
|
||||
(Bug#14029).
|
||||
|
||||
2013-11-27 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* loading.texi (Library Search):
|
||||
|
|
|
@ -2483,7 +2483,7 @@ Selecting a special element performs:
|
|||
A nested sub-alist element looks like this:
|
||||
|
||||
@example
|
||||
(@var{menu-title} @var{sub-alist})
|
||||
(@var{menu-title} . @var{sub-alist})
|
||||
@end example
|
||||
|
||||
It creates the submenu @var{menu-title} specified by @var{sub-alist}.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2013-11-29 Andreas Politz <politza@fh-trier.de>
|
||||
* 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 (Bug#14029).
|
||||
|
||||
2013-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* progmodes/python.el (python-mode-map): Remove binding for ":".
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue