# HG changeset patch # User Dave Love # Date 972321778 0 # Node ID 92d4e658423807c9cac70dd074e849c498853ae9 # Parent eeb8d2b22eaa2779e43eeede1cc99b72bd719661 (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. diff -r eeb8d2b22eaa -r 92d4e6584238 lisp/imenu.el --- a/lisp/imenu.el Mon Oct 23 15:50:51 2000 +0000 +++ b/lisp/imenu.el Mon Oct 23 17:22:58 2000 +0000 @@ -631,26 +631,26 @@ (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."