diff options
| author | Stefan Monnier | 2005-06-01 16:22:00 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-06-01 16:22:00 +0000 |
| commit | 6cb9fac363905e93faae5304e1700bc3bfb65534 (patch) | |
| tree | 58cb43378f7422c0a150bc755ed16d382c0bd0d4 | |
| parent | 358e4d6d1db0b101d2862f97475f6e5999f8bfa0 (diff) | |
| download | emacs-6cb9fac363905e93faae5304e1700bc3bfb65534.tar.gz emacs-6cb9fac363905e93faae5304e1700bc3bfb65534.zip | |
(easy-menu-return-item): Find menu items with a nil command binding.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easymenu.el | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4ea507543e6..264c627ef54 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2005-06-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/easymenu.el (easy-menu-return-item): Quick fix to find | ||
| 4 | menu items with a nil command binding. | ||
| 5 | |||
| 1 | 2005-06-01 Juanma Barranquero <lekktu@gmail.com> | 6 | 2005-06-01 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * emacs-lisp/cl-macs.el (defsetf): | 8 | * emacs-lisp/cl-macs.el (defsetf): |
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index b3160c9b752..3602e7412f1 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; easymenu.el --- support the easymenu interface for defining a menu | 1 | ;;; easymenu.el --- support the easymenu interface for defining a menu |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994,96,98,1999,2000,2004 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994,96,98,1999,2000,2004,2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Keywords: emulations | 5 | ;; Keywords: emulations |
| 6 | ;; Author: Richard Stallman <rms@gnu.org> | 6 | ;; Author: Richard Stallman <rms@gnu.org> |
| @@ -534,7 +534,7 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'." | |||
| 534 | (easy-menu-do-add-item map item before))) | 534 | (easy-menu-do-add-item map item before))) |
| 535 | 535 | ||
| 536 | (defun easy-menu-item-present-p (map path name) | 536 | (defun easy-menu-item-present-p (map path name) |
| 537 | "In submenu of MAP with path PATH, return true iff item NAME is present. | 537 | "In submenu of MAP with path PATH, return non-nil iff item NAME is present. |
| 538 | MAP and PATH are defined as in `easy-menu-add-item'. | 538 | MAP and PATH are defined as in `easy-menu-add-item'. |
| 539 | NAME should be a string, the name of the element to be looked for." | 539 | NAME should be a string, the name of the element to be looked for." |
| 540 | (easy-menu-return-item (easy-menu-get-map map path) name)) | 540 | (easy-menu-return-item (easy-menu-get-map map path) name)) |
| @@ -552,7 +552,14 @@ NAME should be a string, the name of the element to be removed." | |||
| 552 | "In menu MENU try to look for menu item with name NAME. | 552 | "In menu MENU try to look for menu item with name NAME. |
| 553 | If a menu item is found, return (NAME . item), otherwise return nil. | 553 | If a menu item is found, return (NAME . item), otherwise return nil. |
| 554 | If item is an old format item, a new format item is returned." | 554 | If item is an old format item, a new format item is returned." |
| 555 | (let ((item (lookup-key menu (vector (easy-menu-intern name)))) | 555 | ;; The call to `lookup-key' also calls the C function `get_keyelt' which |
| 556 | ;; looks inside a menu-item to only return the actual command. This is | ||
| 557 | ;; not what we want here. We should either add an arg to lookup-key to be | ||
| 558 | ;; able to turn off this "feature", or else we could use map-keymap here. | ||
| 559 | ;; In the mean time, I just use `assq' which is an OK approximation since | ||
| 560 | ;; menus are rarely built from vectors or char-tables. | ||
| 561 | (let ((item (or (cdr (assq name menu)) | ||
| 562 | (lookup-key menu (vector (easy-menu-intern name))))) | ||
| 556 | ret enable cache label) | 563 | ret enable cache label) |
| 557 | (cond | 564 | (cond |
| 558 | ((stringp (car-safe item)) | 565 | ((stringp (car-safe item)) |