1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 19:31:02 -08:00

(easy-menu-add-item): Use keymap-prompt. Simplify.

This commit is contained in:
Stefan Monnier 2004-11-10 16:20:20 +00:00
parent d0db69919b
commit fe6ca60c21

View file

@ -523,15 +523,10 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'."
(easy-menu-define-key map (easy-menu-intern (car item)) (easy-menu-define-key map (easy-menu-intern (car item))
(cdr item) before) (cdr item) before)
(if (or (keymapp item) (if (or (keymapp item)
(and (symbolp item) (keymapp (symbol-value item)))) (and (symbolp item) (keymapp (symbol-value item))
(setq item (symbol-value item))))
;; Item is a keymap, find the prompt string and use as item name. ;; Item is a keymap, find the prompt string and use as item name.
(let ((tail (easy-menu-get-map item nil)) name) (setq item (cons (keymap-prompt item) item)))
(if (not (keymapp item)) (setq item tail))
(while (and (null name) (consp (setq tail (cdr tail)))
(not (keymapp tail)))
(if (stringp (car tail)) (setq name (car tail)) ; Got a name.
(setq tail (cdr tail))))
(setq item (cons name item))))
(easy-menu-do-add-item map item before))) (easy-menu-do-add-item map item before)))
(defun easy-menu-item-present-p (map path name) (defun easy-menu-item-present-p (map path name)