summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2014-10-06 11:59:38 +0800
committerLeo Liu <sdl.web@gmail.com>2014-10-06 11:59:38 +0800
commit195c5c4c925cfced8d720659dc638b434282f29b (patch)
tree7224345fcfbaf5c7a057ebeef9a02988bc332570 /lisp/imenu.el
parent3f65970414538063e38ada2a47cb4ef4f35b630e (diff)
downloademacs-195c5c4c925cfced8d720659dc638b434282f29b.tar.gz
* imenu.el (imenu): Re-write for clarity.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el17
1 files changed, 7 insertions, 10 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 3159b6cc563..5bad4c09c44 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -1034,16 +1034,13 @@ for more information."
(if (stringp index-item)
(setq index-item (assoc index-item (imenu--make-index-alist))))
(when index-item
- (push-mark nil t)
- (let* ((is-special-item (listp (cdr index-item)))
- (function
- (if is-special-item
- (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)))
+ (pcase index-item
+ (`(,name ,pos ,fn . ,args)
+ (push-mark nil t)
+ (apply fn name pos args)
+ (run-hooks 'imenu-after-jump-hook))
+ (`(,name . ,pos) (imenu (list name pos imenu-default-goto-function)))
+ (_ (error "Unknown imenu item: %S" index-item)))))
(provide 'imenu)