diff options
| author | Stefan Monnier | 2003-03-16 00:39:23 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-03-16 00:39:23 +0000 |
| commit | 26647ce2187e1e80f7ba312057e148798959d43b (patch) | |
| tree | 44c7b351d555d0ed93b658f53e5f22f74896640e | |
| parent | d378869e0452cfd525b9a6dd4568002236492ca2 (diff) | |
| download | emacs-26647ce2187e1e80f7ba312057e148798959d43b.tar.gz emacs-26647ce2187e1e80f7ba312057e148798959d43b.zip | |
(easy-menu-name-match): Catch any error that member-ignore-case might signal.
(easy-menu-add-item): Default to the global map, as documented.
(easy-menu-convert-item-1): Use match-string.
| -rw-r--r-- | lisp/emacs-lisp/easymenu.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index 43ff02e1b22..47880408d75 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el | |||
| @@ -343,8 +343,7 @@ MENU, just change it, otherwise put it last in MENU." | |||
| 343 | (postfix | 343 | (postfix |
| 344 | (if (< (match-end 1) (match-end 0)) | 344 | (if (< (match-end 1) (match-end 0)) |
| 345 | (substring keys (match-end 1)))) | 345 | (substring keys (match-end 1)))) |
| 346 | (cmd (intern (substring keys (match-beginning 2) | 346 | (cmd (intern (match-string 2 keys)))) |
| 347 | (match-end 2))))) | ||
| 348 | (setq keys (and (or prefix postfix) | 347 | (setq keys (and (or prefix postfix) |
| 349 | (cons prefix postfix))) | 348 | (cons prefix postfix))) |
| 350 | (setq keys | 349 | (setq keys |
| @@ -421,10 +420,12 @@ NAME can be either a string, or a symbol." | |||
| 421 | (eq (car-safe item) name) | 420 | (eq (car-safe item) name) |
| 422 | (if (stringp name) | 421 | (if (stringp name) |
| 423 | ;; Match against the text that is displayed to the user. | 422 | ;; Match against the text that is displayed to the user. |
| 424 | (or (member-ignore-case name item) | 423 | (or (condition-case nil (member-ignore-case name item) |
| 424 | (error nil)) ;`item' might not be a proper list. | ||
| 425 | ;; Also check the string version of the symbol name, | 425 | ;; Also check the string version of the symbol name, |
| 426 | ;; for backwards compatibility. | 426 | ;; for backwards compatibility. |
| 427 | (eq (car-safe item) (intern name))))))) | 427 | (eq (car-safe item) (intern name)) |
| 428 | (eq (car-safe item) (easy-menu-intern name))))))) | ||
| 428 | 429 | ||
| 429 | (defun easy-menu-always-true (x) | 430 | (defun easy-menu-always-true (x) |
| 430 | "Return true if form X never evaluates to nil." | 431 | "Return true if form X never evaluates to nil." |
| @@ -515,6 +516,9 @@ submenu is then traversed recursively with the remaining elements of PATH. | |||
| 515 | ITEM is either defined as in `easy-menu-define' or a non-nil value returned | 516 | ITEM is either defined as in `easy-menu-define' or a non-nil value returned |
| 516 | by `easy-menu-item-present-p' or `easy-menu-remove-item' or a menu defined | 517 | by `easy-menu-item-present-p' or `easy-menu-remove-item' or a menu defined |
| 517 | earlier by `easy-menu-define' or `easy-menu-create-menu'." | 518 | earlier by `easy-menu-define' or `easy-menu-create-menu'." |
| 519 | (unless map | ||
| 520 | (setq map (current-global-map)) | ||
| 521 | (push 'menu-bar path)) | ||
| 518 | (setq map (easy-menu-get-map map path | 522 | (setq map (easy-menu-get-map map path |
| 519 | (and (null map) (null path) | 523 | (and (null map) (null path) |
| 520 | (stringp (car-safe item)) | 524 | (stringp (car-safe item)) |