comparison lisp/emacs-lisp/easymenu.el @ 7614:877b3aeaa9b5

(easy-menu-create-keymaps): Renamed from easy-menu-keymap. Callers changed.
author Richard M. Stallman <rms@gnu.org>
date Sun, 22 May 1994 06:50:01 +0000
parents 3063675a5424
children c7eb887a1e78
comparison
equal deleted inserted replaced
7613:0dc4969a8038 7614:877b3aeaa9b5
56 The first element should be the submenu name. That's used as the 56 The first element should be the submenu name. That's used as the
57 menu item in the top-level menu. The cdr of the submenu list 57 menu item in the top-level menu. The cdr of the submenu list
58 is a list of menu items, as above." 58 is a list of menu items, as above."
59 (` (let* ((maps (, maps)) 59 (` (let* ((maps (, maps))
60 (menu (, menu)) 60 (menu (, menu))
61 (keymap (easy-menu-keymap (car menu) (cdr menu)))) 61 (keymap (easy-menu-create-keymaps (car menu) (cdr menu))))
62 (and (keymapp maps) (setq maps (list maps))) 62 (and (keymapp maps) (setq maps (list maps)))
63 (while maps 63 (while maps
64 (define-key (car maps) (vector 'menu-bar (intern (car menu))) 64 (define-key (car maps) (vector 'menu-bar (intern (car menu)))
65 (cons (car menu) keymap)) 65 (cons (car menu) keymap))
66 (setq maps (cdr maps)))))) 66 (setq maps (cdr maps))))))
67 67
68 (defvar easy-menu-item-count 0) 68 (defvar easy-menu-item-count 0)
69 69
70 ;; Return a menu keymap corresponding to a Lucid-style menu list 70 ;; Return a menu keymap corresponding to a Lucid-style menu list
71 ;; MENU-ITEMS, and with name MENU-NAME. 71 ;; MENU-ITEMS, and with name MENU-NAME.
72 (defun easy-menu-keymap (menu-name menu-items) 72 (defun easy-menu-create-keymaps (menu-name menu-items)
73 (let ((menu (make-sparse-keymap menu-name))) 73 (let ((menu (make-sparse-keymap menu-name)))
74 ;; Process items in reverse order, 74 ;; Process items in reverse order,
75 ;; since the define-key loop reverses them again. 75 ;; since the define-key loop reverses them again.
76 (setq menu-items (reverse menu-items)) 76 (setq menu-items (reverse menu-items))
77 (while menu-items 77 (while menu-items
80 command enabler name) 80 command enabler name)
81 (cond ((stringp item) 81 (cond ((stringp item)
82 (setq command nil) 82 (setq command nil)
83 (setq name (if (string-match "^-+$" item) "" item))) 83 (setq name (if (string-match "^-+$" item) "" item)))
84 ((consp item) 84 ((consp item)
85 (setq command (easy-menu-keymap (car item) (cdr item))) 85 (setq command (easy-menu-create-keymaps (car item) (cdr item)))
86 (setq name (car item))) 86 (setq name (car item)))
87 ((vectorp item) 87 ((vectorp item)
88 (setq command (make-symbol (format "menu-function-%d" 88 (setq command (make-symbol (format "menu-function-%d"
89 easy-menu-item-count))) 89 easy-menu-item-count)))
90 (setq easy-menu-item-count (1+ easy-menu-item-count)) 90 (setq easy-menu-item-count (1+ easy-menu-item-count))