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

Lines Matching defs:menu

33 ;; Arrange to use current-menubar to set up part of the menu bar.
41 (define-key lucid-menubar-map [menu-bar]
43 (make-lucid-menu-keymap "menu-bar" current-menubar)
48 (setq lucid-menu-bar-dirty-flag nil))
59 (setq lucid-menu-bar-dirty-flag t))
61 (defvar add-menu-item-count 0)
64 (defvar make-lucid-menu-keymap-disable nil)
66 ;; Return a menu keymap corresponding to a Lucid-style menu list
68 (defun make-lucid-menu-keymap (menu-name menu-items)
69 (let ((menu (make-sparse-keymap menu-name)))
72 (setq menu-items (reverse menu-items))
73 (while menu-items
74 (let ((item (car menu-items))
80 (setq command (make-lucid-menu-keymap (car item) (cdr item)))
83 (setq command (make-symbol (format "menu-function-%d"
84 add-menu-item-count))
85 add-menu-item-count (1+ add-menu-item-count)
91 (put command 'menu-alias t)
96 (put command 'menu-enable
98 'make-lucid-menu-keymap-disable))
114 (error "Unrecognized menu item keyword: %S"
118 (put command 'menu-enable
119 (or (aref item i) 'make-lucid-menu-keymap-disable))
123 (error "Unexpected menu item value: %S"
128 (setcdr menu (cons (list nil name) (cdr menu)))
130 (define-key menu (vector (intern name)) (cons name command)))))
131 (setq menu-items (cdr menu-items)))
132 menu))
185 ;; This is empty because the usual elements of the menu bar
186 ;; are provided by menu-bar.el instead.
205 ;;; menu manipulation functions
208 (defun find-menu-item (menubar item-path-list &optional parent)
230 (find-menu-item (cdr result) (cdr item-path-list) result)
238 (defun disable-menu-item (path)
239 "Make the named menu item be unselectable.
240 PATH is a list of strings which identify the position of the menu item in
241 the menu hierarchy. (\"File\" \"Save\") means the menu item called \"Save\"
242 under the toplevel \"File\" menu. (\"Menu\" \"Foo\" \"Item\") means the
243 menu item called \"Item\" under the \"Foo\" submenu of \"Menu\"."
245 (pair (find-menu-item menubar path))
247 (menu (cdr pair)))
249 (signal 'error (list (if menu "No such menu item" "No such menu")
251 (if (consp item) (error "can't disable menus, only menu items"))
258 (defun enable-menu-item (path)
259 "Make the named menu item be selectable.
260 PATH is a list of strings which identify the position of the menu item in
261 the menu hierarchy. (\"File\" \"Save\") means the menu item called \"Save\"
262 under the toplevel \"File\" menu. (\"Menu\" \"Foo\" \"Item\") means the
263 menu item called \"Item\" under the \"Foo\" submenu of \"Menu\"."
265 (pair (find-menu-item menubar path))
267 (menu (cdr pair)))
269 (signal 'error (list (if menu "No such menu item" "No such menu")
271 (if (consp item) (error "%S is a menu, not a menu item" path))
277 (defun add-menu-item-1 (item-p menu-path item-name item-data enabled-p before)
280 (menu (condition-case ()
281 (car (find-menu-item menubar menu-path))
283 (item (if (listp menu)
284 (car (find-menu-item (cdr menu) (list item-name)))
285 (signal 'error (list "not a submenu" menu-path)))))
286 (or menu
287 (let ((rest menu-path)
290 ;;; (setq menu (car (find-menu-item (cdr so-far) (list (car rest)))))
291 (setq menu
293 (car (find-menu-item so-far (list (car rest))))
294 (car (find-menu-item (cdr so-far) (list (car rest))))))
295 (or menu
298 (error "Trying to modify a menu that doesn't exist"))
302 (nconc (list (setq menu (list (car rest))))
304 (setq so-far menu)
306 (or menu (setq menu menubar))
314 (setq before (car (find-menu-item menu (list before)))))
315 (let ((rest menu)
325 (if (and (eq menu menubar) (eq before (car menu)))
326 (setq menu (cons item menu)
327 current-menubar menu)
329 (nconc menu (list item))))))
340 (defun add-menu-item (menu-path item-name function enabled-p &optional before)
341 "Add a menu item to some menu, creating the menu first if necessary.
343 MENU-PATH identifies the menu under which the new menu item should be inserted.
345 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
346 ITEM-NAME is the string naming the menu item to be added.
347 FUNCTION is the command to invoke when this menu item is selected.
352 BEFORE, if provided, is the name of a menu item before which this item should
353 be added, if this item is not on the menu already. If the item is already
355 (or menu-path (error "must specify a menu path"))
357 (add-menu-item-1 t menu-path item-name function enabled-p before))
361 (defun delete-menu-item (path)
362 "Remove the named menu item from the menu hierarchy.
363 PATH is a list of strings which identify the position of the menu item in
364 the menu hierarchy. (\"File\" \"Save\") means the menu item called \"Save\"
365 under the toplevel \"File\" menu. (\"Menu\" \"Foo\" \"Item\") means the
366 menu item called \"Item\" under the \"Foo\" submenu of \"Menu\"."
368 (pair (find-menu-item menubar path))
370 (menu (or (cdr pair) menubar)))
375 (if (eq menu current-menubar)
376 (setq current-menubar (delq item menu))
377 (delq item menu))
383 (defun relabel-menu-item (path new-name)
384 "Change the string of the specified menu item.
385 PATH is a list of strings which identify the position of the menu item in
386 the menu hierarchy. (\"File\" \"Save\") means the menu item called \"Save\"
387 under the toplevel \"File\" menu. (\"Menu\" \"Foo\" \"Item\") means the
388 menu item called \"Item\" under the \"Foo\" submenu of \"Menu\".
389 NEW-NAME is the string that the menu item will be printed as from now on."
393 (pair (find-menu-item menubar path))
395 (menu (cdr pair)))
397 (signal 'error (list (if menu "No such menu item" "No such menu")
407 (defun add-menu (menu-path menu-name menu-items &optional before)
408 "Add a menu to the menubar or one of its submenus.
409 If the named menu exists already, it is changed.
410 MENU-PATH identifies the menu under which the new menu should be inserted.
412 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
413 If MENU-PATH is nil, then the menu will be added to the menubar itself.
414 MENU-NAME is the string naming the menu to be added.
415 MENU-ITEMS is a list of menu item descriptions.
416 Each menu item should be a vector of three elements:
417 - a string, the name of the menu item;
420 BEFORE, if provided, is the name of a menu before which this menu should
421 be added, if this menu is not on its parent already. If the menu is already
423 (or menu-name (error "must specify a menu name"))
424 (or menu-items (error "must specify some menu items"))
425 (add-menu-item-1 nil menu-path menu-name menu-items t before))
430 (defvar put-buffer-names-in-file-menu t)
433 ;; Don't unconditionally enable menu bars; leave that up to the user.
436 ;; (modify-frame-parameters (car frames) '((menu-bar-lines . 1)))
438 ;;(or (assq 'menu-bar-lines default-frame-alist)
440 ;; (cons '(menu-bar-lines . 1) default-frame-alist)))