aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/easymenu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/easymenu.el')
-rw-r--r--lisp/emacs-lisp/easymenu.el35
1 files changed, 6 insertions, 29 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 7b18756fd7e..b0f3b9b9d3e 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -42,25 +42,7 @@ menus, turn this variable off, otherwise it is probably better to keep it on."
42 :version "20.3") 42 :version "20.3")
43 43
44(defsubst easy-menu-intern (s) 44(defsubst easy-menu-intern (s)
45 (if (stringp s) 45 (if (stringp s) (intern s) s))
46 (let ((copy (copy-sequence s))
47 (pos 0)
48 found)
49 ;; For each letter that starts a word, flip its case.
50 ;; This way, the usual convention for menu strings (capitalized)
51 ;; corresponds to the usual convention for menu item event types
52 ;; (all lower case). It's a 1-1 mapping so causes no conflicts.
53 (while (setq found (string-match "\\<\\sw" copy pos))
54 (setq pos (match-end 0))
55 (unless (= (upcase (aref copy found))
56 (downcase (aref copy found)))
57 (aset copy found
58 (if (= (upcase (aref copy found))
59 (aref copy found))
60 (downcase (aref copy found))
61 (upcase (aref copy found))))))
62 (intern copy))
63 s))
64 46
65;;;###autoload 47;;;###autoload
66(put 'easy-menu-define 'lisp-indent-function 'defun) 48(put 'easy-menu-define 'lisp-indent-function 'defun)
@@ -396,6 +378,7 @@ otherwise put the new binding last in MENU.
396BEFORE can be either a string (menu item name) or a symbol 378BEFORE can be either a string (menu item name) or a symbol
397\(the fake function key for the menu item). 379\(the fake function key for the menu item).
398KEY does not have to be a symbol, and comparison is done with equal." 380KEY does not have to be a symbol, and comparison is done with equal."
381 (if (symbolp menu) (setq menu (indirect-function menu)))
399 (let ((inserted (null item)) ; Fake already inserted. 382 (let ((inserted (null item)) ; Fake already inserted.
400 tail done) 383 tail done)
401 (while (not done) 384 (while (not done)
@@ -437,8 +420,7 @@ ITEM should be a keymap binding of the form (KEY . MENU-ITEM)."
437 (error nil)) ;`item' might not be a proper list. 420 (error nil)) ;`item' might not be a proper list.
438 ;; Also check the string version of the symbol name, 421 ;; Also check the string version of the symbol name,
439 ;; for backwards compatibility. 422 ;; for backwards compatibility.
440 (eq (car-safe item) (intern name)) 423 (eq (car-safe item) (intern name)))))))
441 (eq (car-safe item) (easy-menu-intern name)))))))
442 424
443(defun easy-menu-always-true-p (x) 425(defun easy-menu-always-true-p (x)
444 "Return true if form X never evaluates to nil." 426 "Return true if form X never evaluates to nil."
@@ -541,15 +523,10 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'."
541 (easy-menu-define-key map (easy-menu-intern (car item)) 523 (easy-menu-define-key map (easy-menu-intern (car item))
542 (cdr item) before) 524 (cdr item) before)
543 (if (or (keymapp item) 525 (if (or (keymapp item)
544 (and (symbolp item) (keymapp (symbol-value item)))) 526 (and (symbolp item) (keymapp (symbol-value item))
527 (setq item (symbol-value item))))
545 ;; Item is a keymap, find the prompt string and use as item name. 528 ;; Item is a keymap, find the prompt string and use as item name.
546 (let ((tail (easy-menu-get-map item nil)) name) 529 (setq item (cons (keymap-prompt item) item)))
547 (if (not (keymapp item)) (setq item tail))
548 (while (and (null name) (consp (setq tail (cdr tail)))
549 (not (keymapp tail)))
550 (if (stringp (car tail)) (setq name (car tail)) ; Got a name.
551 (setq tail (cdr tail))))
552 (setq item (cons name item))))
553 (easy-menu-do-add-item map item before))) 530 (easy-menu-do-add-item map item before)))
554 531
555(defun easy-menu-item-present-p (map path name) 532(defun easy-menu-item-present-p (map path name)