]> code.delx.au - gnu-emacs/commitdiff
(easy-menu-name-match): Catch any error that member-ignore-case might signal.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 16 Mar 2003 00:39:23 +0000 (00:39 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 16 Mar 2003 00:39:23 +0000 (00:39 +0000)
(easy-menu-add-item): Default to the global map, as documented.
(easy-menu-convert-item-1): Use match-string.

lisp/emacs-lisp/easymenu.el

index 43ff02e1b22fac8cfe4328069c26af560836adc9..47880408d75255377e8c53f8575965a22b9fcbff 100644 (file)
@@ -343,8 +343,7 @@ MENU, just change it, otherwise put it last in MENU."
                           (postfix
                            (if (< (match-end 1) (match-end 0))
                                (substring keys (match-end 1))))
-                          (cmd (intern (substring keys (match-beginning 2)
-                                                  (match-end 2)))))
+                          (cmd (intern (match-string 2 keys))))
                       (setq keys (and (or prefix postfix)
                                       (cons prefix postfix)))
                       (setq keys
@@ -421,10 +420,12 @@ NAME can be either a string, or a symbol."
          (eq (car-safe item) name)
        (if (stringp name)
            ;; Match against the text that is displayed to the user.
-           (or (member-ignore-case name item)
+           (or (condition-case nil (member-ignore-case name item)
+                 (error nil))          ;`item' might not be a proper list.
                ;; Also check the string version of the symbol name,
                ;; for backwards compatibility.
-               (eq (car-safe item) (intern name)))))))
+               (eq (car-safe item) (intern name))
+               (eq (car-safe item) (easy-menu-intern name)))))))
 
 (defun easy-menu-always-true (x)
   "Return true if form X never evaluates to nil."
@@ -515,6 +516,9 @@ submenu is then traversed recursively with the remaining elements of PATH.
 ITEM is either defined as in `easy-menu-define' or a non-nil value returned
 by `easy-menu-item-present-p' or `easy-menu-remove-item' or a menu defined
 earlier by `easy-menu-define' or `easy-menu-create-menu'."
+  (unless map
+    (setq map (current-global-map))
+    (push 'menu-bar path))
   (setq map (easy-menu-get-map map path
                               (and (null map) (null path)
                                    (stringp (car-safe item))