diff options
| author | Dave Love | 2000-10-23 17:24:54 +0000 |
|---|---|---|
| committer | Dave Love | 2000-10-23 17:24:54 +0000 |
| commit | 0dcf8835e38d34606d12882bcd0866bb9af7339c (patch) | |
| tree | b733b8fb9c24233d7ef23057e3fc02444b452c86 | |
| parent | 379b70e730533ae069dc491d9221f747eb40c5a1 (diff) | |
| download | emacs-0dcf8835e38d34606d12882bcd0866bb9af7339c.tar.gz emacs-0dcf8835e38d34606d12882bcd0866bb9af7339c.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/imenu.el | 28 |
2 files changed, 19 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 78897ee5daa..c85834eaf22 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -4,6 +4,11 @@ | |||
| 4 | 4 | ||
| 5 | 2000-10-23 Dave Love <fx@gnu.org> | 5 | 2000-10-23 Dave Love <fx@gnu.org> |
| 6 | 6 | ||
| 7 | * imenu.el (imenu--create-keymap-2): Build menu with menu-item | ||
| 8 | using :key-sequence, making it much more usable. Use nconc, not | ||
| 9 | append. | ||
| 10 | (imenu--create-keymap-1): Avoid append. | ||
| 11 | |||
| 7 | * textmodes/refill.el: Remove bits redundant with define-minor-mode. | 12 | * textmodes/refill.el: Remove bits redundant with define-minor-mode. |
| 8 | 13 | ||
| 9 | 2000-10-23 Miles Bader <miles@lsi.nec.co.jp> | 14 | 2000-10-23 Miles Bader <miles@lsi.nec.co.jp> |
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." | |||
| 631 | (defun imenu--create-keymap-2 (alist counter &optional commands) | 631 | (defun imenu--create-keymap-2 (alist counter &optional commands) |
| 632 | (let ((map nil)) | 632 | (let ((map nil)) |
| 633 | (mapcar | 633 | (mapcar |
| 634 | (function | 634 | (lambda (item) |
| 635 | (lambda (item) | 635 | (cond |
| 636 | (cond | 636 | ((imenu--subalist-p item) |
| 637 | ((imenu--subalist-p item) | 637 | (nconc (list (setq counter (1+ counter)) |
| 638 | (append (list (setq counter (1+ counter)) | 638 | (car item) 'keymap (car item)) |
| 639 | (car item) 'keymap (car item)) | 639 | (imenu--create-keymap-2 (cdr item) (+ counter 10) commands))) |
| 640 | (imenu--create-keymap-2 (cdr item) (+ counter 10) commands))) | 640 | (t |
| 641 | (t | 641 | (let ((end (if commands `(lambda () |
| 642 | (let ((end (if commands `(lambda () (interactive) | 642 | (interactive) |
| 643 | (imenu--menubar-select ',item)) | 643 | (imenu--menubar-select ',item)) |
| 644 | (cons '(nil) item)))) | 644 | (cons '(nil) item)))) |
| 645 | (cons (car item) | 645 | (cons (car item) |
| 646 | (cons (car item) end))))))) | 646 | (list 'menu-item (car item) end :key-sequence nil)))))) |
| 647 | alist))) | 647 | alist))) |
| 648 | 648 | ||
| 649 | ;; If COMMANDS is non-nil, make a real keymap | 649 | ;; If COMMANDS is non-nil, make a real keymap |
| 650 | ;; with a real command used as the definition. | 650 | ;; with a real command used as the definition. |
| 651 | ;; If it is nil, make something suitable for x-popup-menu. | 651 | ;; If it is nil, make something suitable for x-popup-menu. |
| 652 | (defun imenu--create-keymap-1 (title alist &optional commands) | 652 | (defun imenu--create-keymap-1 (title alist &optional commands) |
| 653 | (append (list 'keymap title) (imenu--create-keymap-2 alist 0 commands))) | 653 | (cons 'keymap (cons title (imenu--create-keymap-2 alist 0 commands)))) |
| 654 | 654 | ||
| 655 | (defun imenu--in-alist (str alist) | 655 | (defun imenu--in-alist (str alist) |
| 656 | "Check whether the string STR is contained in multi-level ALIST." | 656 | "Check whether the string STR is contained in multi-level ALIST." |