]> git.eshelyaron.com Git - emacs.git/commitdiff
* imenu.el (imenu): Re-write for clarity.
authorLeo Liu <sdl.web@gmail.com>
Mon, 6 Oct 2014 03:59:38 +0000 (11:59 +0800)
committerLeo Liu <sdl.web@gmail.com>
Mon, 6 Oct 2014 03:59:38 +0000 (11:59 +0800)
lisp/ChangeLog
lisp/imenu.el

index a04e6d2b91d65dcc9fc52ae8965aad90967793c6..c118209933d8aa6e311678056634d0089b9eefa6 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-06  Leo Liu  <sdl.web@gmail.com>
+
+       * imenu.el (imenu): Re-write for clarity.
+
 2014-10-06  Glenn Morris  <rgm@gnu.org>
 
        Remove calendar code obsolete since at least version 23.1.
index 3159b6cc563f0556d9efd9709f7e9f8d95d6ed24..5bad4c09c4454303dc7238cb99ad8e89355af14b 100644 (file)
@@ -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)