summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>2000-10-23 17:22:58 +0000
committerDave Love <fx@gnu.org>2000-10-23 17:22:58 +0000
commit765080b79c5445bcaa846ab35c937d6d5b95adb1 (patch)
tree92e6c80d8bec5c034e45fa86b0637f243eddcf7b /lisp/imenu.el
parentdc3f46a3d1e992e64225e6e00e05c3caefbbb1f6 (diff)
downloademacs-765080b79c5445bcaa846ab35c937d6d5b95adb1.tar.gz
(imenu--create-keymap-2): Build menu with menu-item
using :key-sequence, making it much more usable. Use nconc, not append. (imenu--create-keymap-1): Avoid append.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index eb7dc042e68..1457f6f861c 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -631,26 +631,26 @@ as a way for the user to ask to recalculate the buffer's index alist."
(defun imenu--create-keymap-2 (alist counter &optional commands)
(let ((map nil))
(mapcar
- (function
- (lambda (item)
- (cond
- ((imenu--subalist-p item)
- (append (list (setq counter (1+ counter))
- (car item) 'keymap (car item))
- (imenu--create-keymap-2 (cdr item) (+ counter 10) commands)))
- (t
- (let ((end (if commands `(lambda () (interactive)
- (imenu--menubar-select ',item))
- (cons '(nil) item))))
- (cons (car item)
- (cons (car item) end)))))))
+ (lambda (item)
+ (cond
+ ((imenu--subalist-p item)
+ (nconc (list (setq counter (1+ counter))
+ (car item) 'keymap (car item))
+ (imenu--create-keymap-2 (cdr item) (+ counter 10) commands)))
+ (t
+ (let ((end (if commands `(lambda ()
+ (interactive)
+ (imenu--menubar-select ',item))
+ (cons '(nil) item))))
+ (cons (car item)
+ (list 'menu-item (car item) end :key-sequence nil))))))
alist)))
;; If COMMANDS is non-nil, make a real keymap
;; with a real command used as the definition.
;; If it is nil, make something suitable for x-popup-menu.
(defun imenu--create-keymap-1 (title alist &optional commands)
- (append (list 'keymap title) (imenu--create-keymap-2 alist 0 commands)))
+ (cons 'keymap (cons title (imenu--create-keymap-2 alist 0 commands))))
(defun imenu--in-alist (str alist)
"Check whether the string STR is contained in multi-level ALIST."