• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/emacs-lisp/

Lines Matching refs:item

58 The first element of MENU must be a string.  It is the menu bar item name.
78 A menu item is usually a vector of three elements: [NAME CALLBACK ENABLE]
80 NAME is a string--the menu item name.
82 CALLBACK is a command to run when the item is chosen,
83 or a list to evaluate when the item is chosen.
85 ENABLE is an expression; the item is enabled for selection
88 Alternatively, a menu item may have the form:
96 KEYS is a string; a complex keyboard equivalent to this menu item.
104 menu item.
106 a menu. Use `:key-sequence nil' when you know that this menu item has no
111 ENABLE is an expression; the item is enabled for selection
116 INCLUDE is an expression; this item is only visible if this
126 STYLE is a symbol describing the type of menu item. The following are
133 button: Surround the name with `[' and `]'. Use this for an item in the
135 anything else means an ordinary menu item.
144 HELP is a string, the help to display for the menu item.
146 A menu item can be a string. Then that string appears in the menu as
150 A menu item can be a list with the same format as MENU. This is a submenu."
178 (cons 'menu-item
201 (setq menu (cdr (easy-menu-convert-item menu)))))
241 (setq menu (append menu (mapcar 'easy-menu-convert-item menu-items))))
252 (defun easy-menu-do-add-item (menu item &optional before)
253 (setq item (easy-menu-convert-item item))
254 (easy-menu-define-key menu (easy-menu-intern (car item)) (cdr item) before))
258 (defun easy-menu-convert-item (item)
259 "Memoize the value returned by `easy-menu-convert-item-1' called on ITEM.
265 (or (gethash item easy-menu-converted-items-table)
266 (puthash item (easy-menu-convert-item-1 item)
269 (defun easy-menu-convert-item-1 (item)
270 "Parse an item description and convert it to a menu keymap element.
271 ITEM defines an item as in `easy-menu-define'."
274 ((stringp item) ; An item or separator.
275 (setq label item))
276 ((consp item) ; A sub-menu
277 (setq label (setq name (car item)))
278 (setq command (cdr item))
282 ;; Invisible menu item. Don't insert into keymap.
289 ((vectorp item) ; An item.
290 (let* ((ilen (length item))
291 (active (if (> ilen 2) (or (aref item 2) ''nil) t))
292 (no-name (not (symbolp (setq command (aref item 1)))))
294 (setq label (setq name (aref item 0)))
301 (setq keyword (aref item count))
302 (setq arg (aref item (1+ count)))
351 ;; Invisible menu item. Don't insert into keymap.
359 (t (error "Invalid menu item in easymenu")))
365 (cons 'menu-item
370 (defun easy-menu-define-key (menu key item &optional before)
376 put binding before the item in MENU named BEFORE; otherwise,
379 BEFORE can be either a string (menu item name) or a symbol
380 \(the fake function key for the menu item).
383 (let ((inserted (null item)) ; Fake already inserted.
394 (setcdr menu (cons (cons key item) (cdr menu)))
401 (setq tail (cddr menu)) ; not last item and not
405 (setcdr menu (cddr menu)) ; Remove item.
406 (setcdr (cadr menu) item) ; Change item.
411 (defun easy-menu-name-match (name item)
412 "Return t if NAME is the name of menu item ITEM.
415 (if (consp item)
417 (eq (car-safe item) name)
420 (or (condition-case nil (member-ignore-case name item)
421 (error nil)) ;`item' might not be a proper list.
424 (eq (car-safe item) (intern name)))))))
431 (defvar easy-menu-item-count 0)
438 (make-symbol (format "menu-function-%d" easy-menu-item-count))))
439 (setq easy-menu-item-count (1+ easy-menu-item-count))
447 "Change menu found at PATH as item NAME to contain ITEMS.
463 (easy-menu-add-item map path (easy-menu-create-menu name items) before))
497 If BEFORE is non-nil, add before the item named BEFORE.
499 This is a compatibility function; use `easy-menu-add-item'."
500 (easy-menu-add-item (or in-menu (current-global-map))
504 (defun easy-menu-add-item (map path item &optional before)
507 If an item with the same name is already present in this submenu,
510 However, if BEFORE is a string and there is an item in the submenu
511 with that name, then ITEM is added before that item.
523 by `easy-menu-item-present-p' or `easy-menu-remove-item' or a menu defined
527 (stringp (car-safe item))
528 (car item))))
529 (if (and (consp item) (consp (cdr item)) (eq (cadr item) 'menu-item))
530 ;; This is a value returned by `easy-menu-item-present-p' or
531 ;; `easy-menu-remove-item'.
532 (easy-menu-define-key map (easy-menu-intern (car item))
533 (cdr item) before)
534 (if (or (keymapp item)
535 (and (symbolp item) (keymapp (symbol-value item))
536 (setq item (symbol-value item))))
537 ;; Item is a keymap, find the prompt string and use as item name.
538 (setq item (cons (keymap-prompt item) item)))
539 (easy-menu-do-add-item map item before)))
541 (defun easy-menu-item-present-p (map path name)
542 "In submenu of MAP with path PATH, return non-nil iff item NAME is present.
543 MAP and PATH are defined as in `easy-menu-add-item'.
545 (easy-menu-return-item (easy-menu-get-map map path) name))
547 (defun easy-menu-remove-item (map path name)
548 "From submenu of MAP with path PATH remove item NAME.
549 MAP and PATH are defined as in `easy-menu-add-item'.
552 (let ((ret (easy-menu-return-item map name)))
556 (defun easy-menu-return-item (menu name)
557 "In menu MENU try to look for menu item with name NAME.
558 If a menu item is found, return (NAME . item), otherwise return nil.
559 If item is an old format item, a new format item is returned."
561 ;; looks inside a menu-item to only return the actual command. This is
566 (let ((item (or (cdr (assq name menu))
570 ((stringp (car-safe item))
572 (setq label (car item))
573 (when (stringp (car (setq item (cdr item)))) ; Got help string
574 (setq ret (list :help (car item)))
575 (setq item (cdr item)))
576 (when (and (consp item) (consp (car item))
577 (or (null (caar item)) (numberp (caar item))))
578 (setq cache (car item)) ; Got cache
579 (setq item (cdr item)))
580 (and (symbolp item) (setq enable (get item 'menu-enable)) ; Got enable
583 (cons name (cons 'menu-enable (cons label (cons item ret)))))
584 (item ; (or (symbolp item) (keymapp item) (eq (car-safe item) 'menu-item))
585 (cons name item)) ; Keymap or new menu format
589 "Lookup menu item NAME in keymap MAP.
591 and that NAME can be a string representing the menu item's name."
594 ;; `lookup-key' failed and we have a menu item name: look at the
597 (map-keymap (lambda (key item)
598 (if (condition-case nil (member name item)
603 ;; `name' from the item (via get_keyelt).
608 "Return a sparse keymap in which to add or remove an item.
609 MAP and PATH are as defined in `easy-menu-add-item'.
611 TO-MODIFY, if non-nil, is the name of the item the caller