comparison man/lispref/menus.texi @ 263:727739f917cb r20-5b30

Import from CVS: tag r20-5b30
author cvs
date Mon, 13 Aug 2007 10:24:41 +0200
parents 11cf20601dec
children 341dac730539
comparison
equal deleted inserted replaced
262:9d8607af9e13 263:727739f917cb
242 @example 242 @example
243 ("File" 243 ("File"
244 :filter file-menu-filter ; file-menu-filter is a function that takes 244 :filter file-menu-filter ; file-menu-filter is a function that takes
245 ; one argument (a list of menu items) and 245 ; one argument (a list of menu items) and
246 ; returns a list of menu items 246 ; returns a list of menu items
247 [ "Save As..." write-file t ] 247 [ "Save As..." write-file]
248 [ "Revert Buffer" revert-buffer (buffer-modified-p) ] 248 [ "Revert Buffer" revert-buffer :active (buffer-modified-p) ]
249 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ] 249 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
250 ) 250 )
251 @end example 251 @end example
252 252
253 @node Menubar Format 253 @node Menubar Format
619 For example, the command 619 For example, the command
620 620
621 @example 621 @example
622 (add-submenu nil '("%_Test" 622 (add-submenu nil '("%_Test"
623 ["One" (insert "1") :accelerator ?1 :active t] 623 ["One" (insert "1") :accelerator ?1 :active t]
624 ["%_Two" (insert "2") t] 624 ["%_Two" (insert "2")]
625 ["%_3" (insert "3") t])) 625 ["%_3" (insert "3")]))
626 @end example 626 @end example
627 627
628 will add a new menu to the top level menubar. The new menu can be reached 628 will add a new menu to the top level menubar. The new menu can be reached
629 by pressing "t" while the top level menubar is active. When the menu is 629 by pressing "t" while the top level menubar is active. When the menu is
630 active, pressing "1" will activate the first item and insert the character 630 active, pressing "1" will activate the first item and insert the character
707 (setq menu-accelerator-prefix ?\C-x) 707 (setq menu-accelerator-prefix ?\C-x)
708 (setq menu-accelerator-modifiers '(meta control)) 708 (setq menu-accelerator-modifiers '(meta control))
709 (setq menu-accelerator-enabled 'menu-force) 709 (setq menu-accelerator-enabled 'menu-force)
710 (add-submenu nil '("%_Test" 710 (add-submenu nil '("%_Test"
711 ["One" (insert "1") :accelerator ?1 :active t] 711 ["One" (insert "1") :accelerator ?1 :active t]
712 ["%_Two" (insert "2") t] 712 ["%_Two" (insert "2")]
713 ["%_3" (insert "3") t])) 713 ["%_3" (insert "3")]))
714 @end example 714 @end example
715 715
716 will add the menu "Test" to the top level menubar. Pressing C-x followed by 716 will add the menu "Test" to the top level menubar. Pressing C-x followed by
717 C-M-T will activate the menubar and display the "Test" menu. Pressing 717 C-M-T will activate the menubar and display the "Test" menu. Pressing
718 C-M-T by itself will not activate the menubar. Neither will pressing C-x 718 C-M-T by itself will not activate the menubar. Neither will pressing C-x