aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-07-13 19:06:25 +0000
committerDave Love2000-07-13 19:06:25 +0000
commit4d6d04b50405da93ac1840e0834362533cb057b4 (patch)
treee232dc656acc6e85ad78688de7b3d3f30ab7ce6b
parentcf6936a48fa89f182bd7889deaded838ae82571d (diff)
downloademacs-4d6d04b50405da93ac1840e0834362533cb057b4.tar.gz
emacs-4d6d04b50405da93ac1840e0834362533cb057b4.zip
Doc fixes.
(easy-menu-remove): Defalias to ignore.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/emacs-lisp/easymenu.el72
2 files changed, 39 insertions, 36 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0a3979dee6a..79d755abb8a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12000-07-13 Dave Love <fx@gnu.org> 12000-07-13 Dave Love <fx@gnu.org>
2 2
3 * emacs-lisp/easymenu.el: Doc fixes.
4 (easy-menu-remove): Defalias to ignore.
5
3 * textmodes/reftex-cite.el (reftex-bibtex-selection-callback): 6 * textmodes/reftex-cite.el (reftex-bibtex-selection-callback):
4 Call throw correctly. 7 Call throw correctly.
5 8
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 664bc4825ad..221a7a9c39d 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -122,7 +122,7 @@ toggle: A checkbox.
122 Prepend the name with `(*) ' or `( ) ' depending on if selected or not. 122 Prepend the name with `(*) ' or `( ) ' depending on if selected or not.
123radio: A radio button. 123radio: A radio button.
124 Prepend the name with `[X] ' or `[ ] ' depending on if selected or not. 124 Prepend the name with `[X] ' or `[ ] ' depending on if selected or not.
125button: Surround the name with `[' and `]'. Use this for an item in the 125button: Surround the name with `[' and `]'. Use this for an item in the
126 menu bar itself. 126 menu bar itself.
127anything else means an ordinary menu item. 127anything else means an ordinary menu item.
128 128
@@ -210,7 +210,8 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
210 ((eq keyword :help) (setq help arg)) 210 ((eq keyword :help) (setq help arg))
211 ((or (eq keyword :included) (eq keyword :visible)) 211 ((or (eq keyword :included) (eq keyword :visible))
212 (setq visible (or arg ''nil))))) 212 (setq visible (or arg ''nil)))))
213 (if (equal visible ''nil) nil ; Invisible menu entry, return nil. 213 (if (equal visible ''nil)
214 nil ; Invisible menu entry, return nil.
214 (if (and visible (not (easy-menu-always-true visible))) 215 (if (and visible (not (easy-menu-always-true visible)))
215 (setq prop (cons :visible (cons visible prop)))) 216 (setq prop (cons :visible (cons visible prop))))
216 (if (and enable (not (easy-menu-always-true enable))) 217 (if (and enable (not (easy-menu-always-true enable)))
@@ -242,25 +243,25 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
242(defvar easy-menu-converted-items-table (make-hash-table :test 'equal)) 243(defvar easy-menu-converted-items-table (make-hash-table :test 'equal))
243 244
244(defun easy-menu-convert-item (item) 245(defun easy-menu-convert-item (item)
245 ;; Memoize easy-menu-convert-item-1. 246 "Memoize the value returned by `easy-menu-convert-item-1' called on ITEM.
246 ;; This makes key-shortcut-caching work a *lot* better when this 247This makes key-shortcut-caching work a *lot* better when this
247 ;; conversion is done from within a filter. 248conversion is done from within a filter.
248 ;; This also helps when the NAME of the entry is recreated each time: 249This also helps when the NAME of the entry is recreated each time:
249 ;; since the menu is built and traversed separately, the lookup 250since the menu is built and traversed separately, the lookup
250 ;; would always fail because the key is `equal' but not `eq'. 251would always fail because the key is `equal' but not `eq'."
251 (or (gethash item easy-menu-converted-items-table) 252 (or (gethash item easy-menu-converted-items-table)
252 (puthash item (easy-menu-convert-item-1 item) 253 (puthash item (easy-menu-convert-item-1 item)
253 easy-menu-converted-items-table))) 254 easy-menu-converted-items-table)))
254 255
255(defun easy-menu-convert-item-1 (item) 256(defun easy-menu-convert-item-1 (item)
256 ;; Parse an item description and add the item to a keymap. This is 257 "Parse an item description and add the item to a keymap.
257 ;; the function that is used for item definition by the other easy-menu 258This is the function that is used for item definition by the other easy-menu
258 ;; functions. 259functions.
259 ;; MENU is a sparse keymap i.e. a list starting with the symbol `keymap'. 260MENU is a sparse keymap i.e. a list starting with the symbol `keymap'.
260 ;; ITEM defines an item as in `easy-menu-define'. 261ITEM defines an item as in `easy-menu-define'.
261 ;; Optional argument BEFORE is nil or a key in MENU. If BEFORE is not nil 262Optional argument BEFORE is nil or a key in MENU. If BEFORE is not nil
262 ;; put item before BEFORE in MENU, otherwise if item is already present in 263put item before BEFORE in MENU, otherwise if item is already present in
263 ;; MENU, just change it, otherwise put it last in MENU. 264MENU, just change it, otherwise put it last in MENU."
264 (let (name command label prop remove help) 265 (let (name command label prop remove help)
265 (cond 266 (cond
266 ((stringp item) ; An item or separator. 267 ((stringp item) ; An item or separator.
@@ -357,20 +358,19 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
357 (cons command prop)))))))) 358 (cons command prop))))))))
358 359
359(defun easy-menu-define-key-intern (menu key item &optional before) 360(defun easy-menu-define-key-intern (menu key item &optional before)
360 ;; This is the same as easy-menu-define-key, but it interns KEY and 361 "Like easy-menu-define-key, but interns KEY and BEFORE if they are strings."
361 ;; BEFORE if they are strings.
362 (easy-menu-define-key menu (if (stringp key) (intern key) key) item 362 (easy-menu-define-key menu (if (stringp key) (intern key) key) item
363 (if (stringp before) (intern before) before))) 363 (if (stringp before) (intern before) before)))
364 364
365(defun easy-menu-define-key (menu key item &optional before) 365(defun easy-menu-define-key (menu key item &optional before)
366 ;; Add binding in MENU for KEY => ITEM. Similar to `define-key-after'. 366 "Add binding in MENU for KEY => ITEM. Similar to `define-key-after'.
367 ;; If KEY is not nil then delete any duplications. If ITEM is nil, then 367If KEY is not nil then delete any duplications. If ITEM is nil, then
368 ;; don't insert, only delete. 368don't insert, only delete.
369 ;; Optional argument BEFORE is nil or a key in MENU. If BEFORE is not nil 369Optional argument BEFORE is nil or a key in MENU. If BEFORE is not nil
370 ;; put binding before BEFORE in MENU, otherwise if binding is already 370put binding before BEFORE in MENU, otherwise if binding is already
371 ;; present in MENU, just change it, otherwise put it last in MENU. 371present in MENU, just change it, otherwise put it last in MENU.
372 ;; KEY and BEFORE don't have to be symbols, comparison is done with equal 372KEY and BEFORE don't have to be symbols, comparison is done with equal
373 ;; not with eq. 373not with eq."
374 (let ((inserted (null item)) ; Fake already inserted. 374 (let ((inserted (null item)) ; Fake already inserted.
375 tail done) 375 tail done)
376 (while (not done) 376 (while (not done)
@@ -399,7 +399,7 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
399 (t (setq menu (cdr menu))))))) 399 (t (setq menu (cdr menu)))))))
400 400
401(defun easy-menu-always-true (x) 401(defun easy-menu-always-true (x)
402 ;; Return true if X never evaluates to nil. 402 "Return true if X never evaluates to nil."
403 (if (consp x) (and (eq (car x) 'quote) (cadr x)) 403 (if (consp x) (and (eq (car x) 'quote) (cadr x))
404 (or (eq x t) (not (symbolp x))))) 404 (or (eq x t) (not (symbolp x)))))
405 405
@@ -438,7 +438,7 @@ to implement dynamic menus."
438;; here easy-menu-remove is a noop and easy-menu-add only precalculates 438;; here easy-menu-remove is a noop and easy-menu-add only precalculates
439;; equivalent keybindings (if easy-menu-precalculate-equivalent-keybindings 439;; equivalent keybindings (if easy-menu-precalculate-equivalent-keybindings
440;; is on). 440;; is on).
441(defun easy-menu-remove (menu)) 441(defalias 'easy-menu-remove 'ignore)
442 442
443(defun easy-menu-add (menu &optional map) 443(defun easy-menu-add (menu &optional map)
444 "Maybe precalculate equivalent key bindings. 444 "Maybe precalculate equivalent key bindings.
@@ -505,9 +505,9 @@ NAME should be a string, the name of the element to be removed."
505 ret)) 505 ret))
506 506
507(defun easy-menu-return-item (menu name) 507(defun easy-menu-return-item (menu name)
508 ;; In menu MENU try to look for menu item with name NAME. 508 "In menu MENU try to look for menu item with name NAME.
509 ;; If a menu item is found, return (NAME . item), otherwise return nil. 509If a menu item is found, return (NAME . item), otherwise return nil.
510 ;; If item is an old format item, a new format item is returned. 510If item is an old format item, a new format item is returned."
511 (let ((item (lookup-key menu (vector (intern name)))) 511 (let ((item (lookup-key menu (vector (intern name))))
512 ret enable cache label) 512 ret enable cache label)
513 (cond 513 (cond
@@ -535,12 +535,12 @@ NAME should be a string, the name of the element to be removed."
535 submap) 535 submap)
536 536
537(defun easy-menu-get-map (map path &optional to-modify) 537(defun easy-menu-get-map (map path &optional to-modify)
538 ;; Return a sparse keymap in which to add or remove an item. 538 "Return a sparse keymap in which to add or remove an item.
539 ;; MAP and PATH are as defined in `easy-menu-add-item'. 539MAP and PATH are as defined in `easy-menu-add-item'.
540 540
541 ;; TO-MODIFY, if non-nil, is the name of the item the caller 541TO-MODIFY, if non-nil, is the name of the item the caller
542 ;; wants to modify in the map that we return. 542wants to modify in the map that we return.
543 ;; In some cases we use that to select between the local and global maps. 543In some cases we use that to select between the local and global maps."
544 (if (null map) 544 (if (null map)
545 (let ((local (and (current-local-map) 545 (let ((local (and (current-local-map)
546 (lookup-key (current-local-map) 546 (lookup-key (current-local-map)