aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Politz2013-11-29 05:38:20 +0200
committerDmitry Gutov2013-11-29 05:38:20 +0200
commitc8f0efc2e89d9cfc7befa7f20f584f3f0b12f487 (patch)
tree8228024ce4c340f381c5db9bf3501877443071fd
parentbd15d9d1ad961157afa3a16bc1ceb11be64e46f1 (diff)
downloademacs-c8f0efc2e89d9cfc7befa7f20f584f3f0b12f487.tar.gz
emacs-c8f0efc2e89d9cfc7befa7f20f584f3f0b12f487.zip
* 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
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/modes.texi2
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/imenu.el16
4 files changed, 22 insertions, 7 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index ba7fe63a1b5..59e61bbdc74 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12013-11-29 Andreas Politz <politza@fh-trier.de>
2
3 * modes.texi (Imenu): Make it clear that sub-alist is the cdr
4 (Bug#14029).
5
12013-11-27 Glenn Morris <rgm@gnu.org> 62013-11-27 Glenn Morris <rgm@gnu.org>
2 7
3 * loading.texi (Library Search): 8 * loading.texi (Library Search):
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 180fef7241d..dc643bda9c8 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2483,7 +2483,7 @@ Selecting a special element performs:
2483A nested sub-alist element looks like this: 2483A nested sub-alist element looks like this:
2484 2484
2485@example 2485@example
2486(@var{menu-title} @var{sub-alist}) 2486(@var{menu-title} . @var{sub-alist})
2487@end example 2487@end example
2488 2488
2489It creates the submenu @var{menu-title} specified by @var{sub-alist}. 2489It creates the submenu @var{menu-title} specified by @var{sub-alist}.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6e1e8d17fee..ab72f160670 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-11-29 Andreas Politz <politza@fh-trier.de>
2 * imenu.el (imenu--subalist-p): Don't error on non-conses and
3 allow non-lambda lists as functions.
4 (imenu--in-alist): Don't recurse into non-subalists.
5 (imenu): Don't pass function itself as an argument (Bug#14029).
6
12013-11-29 Stefan Monnier <monnier@iro.umontreal.ca> 72013-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * progmodes/python.el (python-mode-map): Remove binding for ":". 9 * progmodes/python.el (python-mode-map): Remove binding for ":".
diff --git a/lisp/imenu.el b/lisp/imenu.el
index f41fcda2713..5e03a3a9081 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -293,8 +293,10 @@ The function in this variable is called when selecting a normal index-item.")
293 293
294 294
295(defun imenu--subalist-p (item) 295(defun imenu--subalist-p (item)
296 (and (consp (cdr item)) (listp (cadr item)) 296 (and (consp item)
297 (not (eq (car (cadr item)) 'lambda)))) 297 (consp (cdr item))
298 (listp (cadr item))
299 (not (functionp (cadr item)))))
298 300
299(defmacro imenu-progress-message (_prevpos &optional _relpos _reverse) 301(defmacro imenu-progress-message (_prevpos &optional _relpos _reverse)
300 "Macro to display a progress message. 302 "Macro to display a progress message.
@@ -645,9 +647,11 @@ Non-nil arguments are in recursive calls."
645 ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...) 647 ;; (INDEX-NAME (INDEX-NAME . INDEX-POSITION) ...)
646 ;; while a bottom-level element looks like 648 ;; while a bottom-level element looks like
647 ;; (INDEX-NAME . INDEX-POSITION) 649 ;; (INDEX-NAME . INDEX-POSITION)
650 ;; or
651 ;; (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...)
648 ;; We are only interested in the bottom-level elements, so we need to 652 ;; We are only interested in the bottom-level elements, so we need to
649 ;; recurse if TAIL is a list. 653 ;; recurse if TAIL is a nested ALIST.
650 (cond ((listp tail) 654 (cond ((imenu--subalist-p elt)
651 (if (setq res (imenu--in-alist str tail)) 655 (if (setq res (imenu--in-alist str tail))
652 (setq alist nil))) 656 (setq alist nil)))
653 ((if imenu-name-lookup-function 657 ((if imenu-name-lookup-function
@@ -1033,8 +1037,8 @@ for more information."
1033 (nth 2 index-item) imenu-default-goto-function)) 1037 (nth 2 index-item) imenu-default-goto-function))
1034 (position (if is-special-item 1038 (position (if is-special-item
1035 (cadr index-item) (cdr index-item))) 1039 (cadr index-item) (cdr index-item)))
1036 (rest (if is-special-item (cddr index-item)))) 1040 (args (if is-special-item (cdr (cddr index-item)))))
1037 (apply function (car index-item) position rest)) 1041 (apply function (car index-item) position args))
1038 (run-hooks 'imenu-after-jump-hook))) 1042 (run-hooks 'imenu-after-jump-hook)))
1039 1043
1040(provide 'imenu) 1044(provide 'imenu)