annotate man/lispref/menus.texi @ 414:da8ed4261e83 r21-2-15

Import from CVS: tag r21-2-15
author cvs
date Mon, 13 Aug 2007 11:21:38 +0200
parents 697ef44129c6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @c Copyright (C) 1995 Sun Microsystems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @c See the file lispref.texi for copying conditions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @setfilename ../../info/menu.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @node Menus, Dialog Boxes, Keymaps, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @chapter Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 @cindex menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 @menu
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
12 * Menu Format:: Format of a menu description.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
13 * Menubar Format:: How to specify a menubar.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
14 * Menubar:: Functions for controlling the menubar.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
15 * Modifying Menus:: Modifying a menu description.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
16 * Pop-Up Menus:: Functions for specifying pop-up menus.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
17 * Menu Filters:: Filter functions for the default menubar.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
18 * Menu Accelerators:: Using and controlling menu accelerator keys
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
19 * Buffers Menu:: The menu that displays the list of buffers.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 @node Menu Format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 @section Format of Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 @cindex menu format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 @cindex format of menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 A menu is described using a @dfn{menu description}, which is a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 menu items, keyword-value pairs, strings, and submenus. The menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 description specifies which items are present in the menu, what function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 each item invokes, and whether the item is selectable or not. Pop-up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 menus are directly described with a menu description, while menubars are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 described slightly differently (see below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 The first element of a menu must be a string, which is the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 menu. This is the string that will be displayed in the parent menu or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 menubar, if any. This string is not displayed in the menu itself,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 except in the case of the top level pop-up menu, where there is no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 parent. In this case, the string will be displayed at the top of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 menu if @code{popup-menu-titles} is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 Immediately following the first element there may optionally be up
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
42 to four keyword-value pairs, as follows:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 @item :included @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 This can be used to control the visibility of a menu. The form is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 evaluated and the menu will be omitted if the result is @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 @item :config @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 This is an efficient shorthand for @code{:included (memq @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 menubar-configuration)}. See the variable @code{menubar-configuration}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 @item :filter @var{function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 A menu filter is used to sensitize or incrementally create a submenu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 only when it is selected by the user and not every time the menubar is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 activated. The filter function is passed the list of menu items in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 submenu and must return a list of menu items to be used for the menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 It is called only when the menu is about to be displayed, so other menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 may already be displayed. Vile and terrible things will happen if a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 menu filter function changes the current buffer, window, or frame. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 also should not raise, lower, or iconify any frames. Basically, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 filter function should have no side-effects.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
63
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
64 @item :accelerator @var{key}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
65 A menu accelerator is a keystroke which can be pressed while the menu is
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
66 visible which will immediately activate the item. @var{key} must be a char
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
67 or the symbol name of a key. @xref{Menu Accelerators}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 The rest of the menu consists of elements as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 A @dfn{menu item}, which is a vector in the following form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @code{[ @var{name} @var{callback} @var{:keyword} @var{value} @var{:keyword} @var{value} ... ]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 @var{name} is a string, the name of the menu item; it is the string to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 display on the menu. It is filtered through the resource database, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 it is possible for resources to override what string is actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 @var{callback} is a form that will be invoked when the menu item is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 selected. If the callback of a menu item is a symbol, then it must name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 a command. It will be invoked with @code{call-interactively}. If it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 a list, then it is evaluated with @code{eval}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 The valid keywords and their meanings are described below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 Note that for compatibility purposes, the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 @code{[ @var{name} @var{callback} @var{active-p} ]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 is also accepted and is equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @code{[ @var{name} @var{callback} :active @var{active-p} ]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 and the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @code{[ @var{name} @var{callback} @var{active-p} @var{suffix}]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 is accepted and is equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 @code{[ @var{name} @var{callback} :active @var{active-p} :suffix @var{suffix}]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 However, these older forms are deprecated and should generally not be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 If an element of a menu is a string, then that string will be presented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 in the menu as unselectable text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 If an element of a menu is a string consisting solely of hyphens, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 that item will be presented as a solid horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 If an element of a menu is a string beginning with @samp{--:}, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 a particular sort of horizontal line will be displayed, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 @item "--:singleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 A solid horizontal line. This is equivalent to a string consisting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 solely of hyphens.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 @item "--:doubleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 A solid double horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 @item "--:singleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 A dashed horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @item "--:doubleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 A dashed double horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @item "--:noLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 No line (but a small space is left).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 @item "--:shadowEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 A solid horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 @item "--:shadowEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 A solid horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 @item "--:shadowDoubleEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 A solid double horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 @item "--:shadowDoubleEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 A solid double horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 @item "--:shadowEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 A dashed horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 @item "--:shadowEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 A dashed horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 @item "--:shadowDoubleEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 A dashed double horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 @item "--:shadowDoubleEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 A dashed double horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 If an element of a menu is a list, it is treated as a submenu. The name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 of that submenu (the first element in the list) will be used as the name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 of the item representing this menu on the parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 The possible keywords are as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 @item :active @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 @var{form} will be evaluated when the menu that this item is a part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 is about to be displayed, and the item will be selectable only if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 result is non-@code{nil}. If the item is unselectable, it will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 usually be displayed grayed-out to indicate this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 175
diff changeset
175 @item :suffix @var{form}
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 175
diff changeset
176 @var{form} will be evaluated when the menu that this item is a part of
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 175
diff changeset
177 is about to be displayed, and the resulting string is appended to the
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 175
diff changeset
178 displayed name. This provides a convenient way of adding the name of a
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 175
diff changeset
179 command's ``argument'' to the menu, like @samp{Kill Buffer NAME}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 @item :keys @var{string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 Normally, the keyboard equivalents of commands in menus are displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 when the ``callback'' is a symbol. This can be used to specify keys for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 more complex menu items. It is passed through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 @code{substitute-command-keys} first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 @item :style @var{style}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 Specifies what kind of object this menu item is. @var{style} be one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 of the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 @item nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 A normal menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 @item toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 A toggle button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 @item radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 A radio button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @item button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 A menubar button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 The only difference between toggle and radio buttons is how they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 displayed. But for consistency, a toggle button should be used when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 there is one option whose value can be turned on or off, and radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 buttons should be used when there is a set of mutually exclusive options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 When using a group of radio buttons, you should arrange for no more than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 one to be marked as selected at a time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 @item :selected @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 Meaningful only when @var{style} is @code{toggle}, @code{radio} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 @code{button}. This specifies whether the button will be in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 selected or unselected state. @var{form} is evaluated, as for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 @code{:active}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 @item :included @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 This can be used to control the visibility of a menu item. The form is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 evaluated and the menu item is only displayed if the result is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 non-@code{nil}. Note that this is different from @code{:active}: If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 @code{:active} evaluates to @code{nil}, the item will be displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 grayed out, while if @code{:included} evaluates to @code{nil}, the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 will be omitted entirely.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 @item :config @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 This is an efficient shorthand for @code{:included (memq @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 menubar-configuration)}. See the variable @code{menubar-configuration}.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
226
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
227 @item :accelerator @var{key}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
228 A menu accelerator is a keystroke which can be pressed while the menu is
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
229 visible which will immediately activate the item. @var{key} must be a char
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
230 or the symbol name of a key. @xref{Menu Accelerators}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 @defvar menubar-configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 This variable holds a list of symbols, against which the value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 @code{:config} tag for each menubar item will be compared. If a menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 item has a @code{:config} tag, then it is omitted from the menubar if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 that tag is not a member of the @code{menubar-configuration} list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ("File"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
244 :filter file-menu-filter ; file-menu-filter is a function that takes
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
245 ; one argument (a list of menu items) and
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
246 ; returns a list of menu items
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 259
diff changeset
247 [ "Save As..." write-file]
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 259
diff changeset
248 [ "Revert Buffer" revert-buffer :active (buffer-modified-p) ]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @node Menubar Format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 @section Format of the Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 @cindex menubar format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 @cindex format of the menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 A menubar is a list of menus, menu items, and strings. The format is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 similar to that of a menu, except:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 The first item need not be a string, and is not treated specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 A string consisting solely of hyphens is not treated specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 If an element of a menubar is @code{nil}, then it is used to represent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 the division between the set of menubar items which are flush-left and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 those which are flush-right. (Note: this isn't completely implemented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 yet.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @node Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 @section Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 @cindex menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 @defvar current-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 This variable holds the description of the current menubar. This may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 buffer-local. When the menubar is changed, the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 @code{set-menubar-dirty-flag} has to be called in order for the menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 to be updated on the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 @defvr Constant default-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 This variable holds the menubar description of the menubar that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 visible at startup. This is the value that @code{current-menubar}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 has at startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 @end defvr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 @defun set-menubar-dirty-flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 This function tells XEmacs that the menubar widget has to be updated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 Changes to the menubar will generally not be visible until this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 The following convenience functions are provided for setting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 menubar. They are equivalent to doing the appropriate action to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 @code{current-menubar}, and then calling @code{set-menubar-dirty-flag}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 Note that these functions copy their argument using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 @code{copy-sequence}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 @defun set-menubar menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 This function sets the default menubar to be @var{menubar} (@pxref{Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 Format}). This is the menubar that will be visible in buffers that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 have not defined their own, buffer-local menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 @defun set-buffer-menubar menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 This function sets the buffer-local menubar to be @var{menubar}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 does not change the menubar in any buffers other than the current one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 Miscellaneous:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 @defvar menubar-show-keybindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 If true, the menubar will display keyboard equivalents. If false, only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 the command names will be displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 @defvar activate-menubar-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 Function or functions called before a menubar menu is pulled down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 These functions are called with no arguments, and should interrogate and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 modify the value of @code{current-menubar} as desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 The functions on this hook are invoked after the mouse goes down, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 before the menu is mapped, and may be used to activate, deactivate, add,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 or delete items from the menus. However, using a filter (with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 @code{:filter} keyword in a menu description) is generally a more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 efficient way of accomplishing the same thing, because the filter is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 invoked only when the actual menu goes down. With a complex menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 there can be a quite noticeable and sometimes aggravating delay if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 all menu modification is implemented using the @code{activate-menubar-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 See above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 These functions may return the symbol @code{t} to assert that they have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 made no changes to the menubar. If any other value is returned, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 menubar is recomputed. If @code{t} is returned but the menubar has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 changed, then the changes may not show up right away. Returning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 @code{nil} when the menubar has not changed is not so bad; more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 computation will be done, but redisplay of the menubar will still be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 performed optimally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 @defvar menu-no-selection-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 Function or functions to call when a menu or dialog box is dismissed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 without a selection having been made.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 @node Modifying Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 @section Modifying Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 The following functions are provided to modify the menubar of one of its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 submenus. Note that these functions modify the menu in-place, rather
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 than copying it and making a new menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 Some of these functions take a @dfn{menu path}, which is a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 strings identifying the menu to be modified. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 @code{("File")} names the top-level ``File'' menu. @code{("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 "Foo")} names a hypothetical submenu of ``File''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 Others take a @dfn{menu item path}, which is similar to a menu path but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 also specifies a particular item to be modified. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 @code{("File" "Save")} means the menu item called ``Save'' under the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 top-level ``File'' menu. @code{("Menu" "Foo" "Item")} means the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 item called ``Item'' under the ``Foo'' submenu of ``Menu''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 @defun add-submenu menu-path submenu &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 This function adds a menu to the menubar or one of its submenus. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 named menu exists already, it is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 @var{menu-path} identifies the menu under which the new menu should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 inserted. If @var{menu-path} is @code{nil}, then the menu will be added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 to the menubar itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 @var{submenu} is the new menu to add (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 @var{before}, if provided, is the name of a menu before which this menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 should be added, if this menu is not on its parent already. If the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 @defun add-menu-button menu-path menu-leaf &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 This function adds a menu item to some menu, creating the menu first if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 necessary. If the named item exists already, it is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 @var{menu-path} identifies the menu under which the new menu item should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 be inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @var{menu-leaf} is a menubar leaf node (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 @var{before}, if provided, is the name of a menu before which this item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 should be added, if this item is not on the menu already. If the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @defun delete-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 This function removes the menu item specified by @var{menu-item-path}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 from the menu hierarchy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @defun enable-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 This function makes the menu item specified by @var{menu-item-path} be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 selectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 @defun disable-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 This function makes the menu item specified by @var{menu-item-path} be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 unselectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 @defun relabel-menu-item menu-item-path new-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 This function changes the string of the menu item specified by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 @var{menu-item-path}. @var{new-name} is the string that the menu item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 will be printed as from now on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 The following function can be used to search for a particular item in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 a menubar specification, given a path to the item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 @defun find-menu-item menubar menu-item-path &optional parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 This function searches @var{menubar} for the item given by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 @var{menu-item-path} starting from @var{parent} (@code{nil} means start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 at the top of @var{menubar}). This function returns @code{(@var{item}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 . @var{parent})}, where @var{parent} is the immediate parent of the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 found (a menu description), and @var{item} is either a vector, list, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 string, depending on the nature of the menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 This function signals an error if the item is not found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 The following deprecated functions are also documented, so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 existing code can be understood. You should not use these functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 in new code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 @defun add-menu menu-path menu-name menu-items &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 This function adds a menu to the menubar or one of its submenus. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 named menu exists already, it is changed. This is obsolete; use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 @code{add-submenu} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 @var{menu-path} identifies the menu under which the new menu should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 inserted. If @var{menu-path} is @code{nil}, then the menu will be added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 to the menubar itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 @var{menu-name} is the string naming the menu to be added;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 @var{menu-items} is a list of menu items, strings, and submenus. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 two arguments are the same as the first and following elements of a menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 description (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 @var{before}, if provided, is the name of a menu before which this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 menu should be added, if this menu is not on its parent already. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 menu is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 @defun add-menu-item menu-path item-name function enabled-p &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 This function adds a menu item to some menu, creating the menu first if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 necessary. If the named item exists already, it is changed. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 obsolete; use @code{add-menu-button} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 @var{menu-path} identifies the menu under which the new menu item should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 be inserted. @var{item-name}, @var{function}, and @var{enabled-p} are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 the first, second, and third elements of a menu item vector (@pxref{Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 @var{before}, if provided, is the name of a menu item before which this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 item should be added, if this item is not on the menu already. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 item is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 @node Menu Filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 @section Menu Filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 @cindex menu filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 The following filter functions are provided for use in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 @code{default-menubar}. You may want to use them in your own menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 @defun file-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 This function changes the arguments and sensitivity of these File menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 @item Delete Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 @item Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 @item Pretty-Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 @item Save Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 Has the name of the current buffer appended to it, and is sensitive only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 when the current buffer is modified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 @item Revert Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 Has the name of the current buffer appended to it, and is sensitive only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 when the current buffer has a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 @item Delete Frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 Sensitive only when there is more than one visible frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 @defun edit-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 This function changes the arguments and sensitivity of these Edit menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 @item Cut
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 Sensitive only when XEmacs owns the primary X Selection (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 @code{zmacs-regions} is @code{t}, this is equivalent to saying that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 there is a region selected).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 @item Copy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 Sensitive only when XEmacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 @item Clear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 Sensitive only when XEmacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 @item Paste
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 Sensitive only when there is an owner for the X Clipboard Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 @item Undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 Sensitive only when there is undo information. While in the midst of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 undo, this is changed to @samp{Undo More}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 @defun buffers-menu-filter menu-items
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 373
diff changeset
521 This function sets up the Buffers menu. @xref{Buffers Menu}, for
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 @node Pop-Up Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 @section Pop-Up Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 @cindex pop-up menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 @defun popup-menu menu-desc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 This function pops up a menu specified by @var{menu-desc}, which is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 menu description (@pxref{Menu Format}). The menu is displayed at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 current mouse position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 @defun popup-menu-up-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 This function returns @code{t} if a pop-up menu is up, @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 @defvar popup-menu-titles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 If true (the default), pop-up menus will have title bars at the top.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 Some machinery is provided that attempts to provide a higher-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 mechanism onto pop-up menus. This only works if you do not redefine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 the binding for button3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 @deffn Command popup-mode-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 This function pops up a menu of global and mode-specific commands. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 menu is computed by combining @code{global-popup-menu} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 @code{mode-popup-menu}. This is the default binding for button3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 You should generally not change this binding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 @defvar global-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 This holds the global popup menu. This is present in all modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (This is @code{nil} by default.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 @defvar mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 The mode-specific popup menu. Automatically buffer local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 This is appended to the default items in @code{global-popup-menu}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 @defvr Constant default-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 This holds the default value of @code{mode-popup-menu}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 @end defvr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 @defvar activate-popup-menu-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 Function or functions run before a mode-specific popup menu is made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 visible. These functions are called with no arguments, and should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 interrogate and modify the value of @code{global-popup-menu} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 @code{mode-popup-menu} as desired. Note: this hook is only run if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 use @code{popup-mode-menu} for activating the global and mode-specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 commands; if you have your own binding for button3, this hook won't be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 The following convenience functions are provided for displaying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 pop-up menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 @defun popup-buffer-menu event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 This function pops up a copy of the @samp{Buffers} menu (from the menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 where the mouse is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 @defun popup-menubar-menu event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 This function pops up a copy of menu that also appears in the menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
591 @node Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
592 @section Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
593 @cindex menu accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
594 @cindex keyboard menu accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
595
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
596 Menu accelerators are keyboard shortcuts for accessing the menubar.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
597 Accelerator keys can be specified for menus as well as for menu items. An
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
598 accelerator key for a menu is used to activate that menu when it appears as a
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
599 submenu of another menu. An accelerator key for a menu item is used to
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
600 activate that item.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
601
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
602 @menu
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
603 * Creating Menu Accelerators:: How to add accelerator keys to a menu.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
604 * Keyboard Menu Traversal:: How to use and modify the keys which are used
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
605 to traverse the menu structure.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
606 * Menu Accelerator Functions:: Functions for working with menu accelerators.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
607 @end menu
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
608
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
609 @node Creating Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
610 @subsection Creating Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
611
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
612 Menu accelerators are specified as part of the menubar format using the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
613 :accelerator tag to specify a key or by placing "%_" in the menu or menu item
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
614 name prior to the letter which is to be used as the accelerator key. The
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
615 advantage of the second method is that the menu rendering code then knows to
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
616 draw an underline under that character, which is the canonical way of
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
617 indicating an accelerator key to a user.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
618
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
619 For example, the command
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
620
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
621 @example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
622 (add-submenu nil '("%_Test"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
623 ["One" (insert "1") :accelerator ?1 :active t]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
624 ["%_Two" (insert "2")]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
625 ["%_3" (insert "3")]))
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
626 @end example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
627
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
628 will add a new menu to the top level menubar. The new menu can be reached
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
629 by pressing "t" while the top level menubar is active. When the menu is
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
630 active, pressing "1" will activate the first item and insert the character
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
631 "1" into the buffer. Pressing "2" will activate the second item and insert
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
632 the character "2" into the buffer. Pressing "3" will activate the third item
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
633 and insert the character "3" into the buffer.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
634
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
635 It is possible to activate the top level menubar itself using accelerator keys.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
636 @xref{Menu Accelerator Functions}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
637
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
638 @node Keyboard Menu Traversal
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
639 @subsection Keyboard Menu Traversal
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
640
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
641 In addition to immediately activating a menu or menu item, the keyboard can
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
642 be used to traverse the menus without activating items. The keyboard arrow
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
643 keys, the return key and the escape key are defined to traverse the menus in a
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
644 way that should be familiar to users of any of a certain family of popular PC
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
645 operating systems.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
646
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
647 This behavior can be changed by modifying the bindings in
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
648 menu-accelerator-map. At this point, the online help is your best bet
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
649 for more information about how to modify the menu traversal keys.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
650
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
651 @node Menu Accelerator Functions
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
652 @subsection Menu Accelerator Functions
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
653
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
654 @defun accelerate-menu
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
655 Make the menubar immediately active and place the cursor on the left most entry
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
656 in the top level menu. Menu items can be selected as usual.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
657 @end defun
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
658
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
659 @defvar menu-accelerator-enabled
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
660 Whether menu accelerator keys can cause the menubar to become active.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
661
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
662 If @code{menu-force} or @code{menu-fallback}, then menu accelerator keys can
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
663 be used to activate the top level menu. Once the menubar becomes active, the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
664 accelerator keys can be used regardless of the value of this variable.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
665
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
666 @code{menu-force} is used to indicate that the menu accelerator key takes
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
667 precedence over bindings in the current keymap(s). @code{menu-fallback} means
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
668 that bindings in the current keymap take precedence over menu accelerator keys.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
669 Thus a top level menu with an accelerator of "T" would be activated on a
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
670 keypress of Meta-t if @var{menu-accelerator-enabled} is @code{menu-force}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
671 However, if @var{menu-accelerator-enabled} is @code{menu-fallback}, then
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
672 Meta-t will not activate the menubar and will instead run the function
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
673 transpose-words, to which it is normally bound.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
674
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
675 The default value is @code{nil}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
676
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
677 See also @var{menu-accelerator-modifiers} and @var{menu-accelerator-prefix}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
678 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
679
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
680 @defvar menu-accelerator-map
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
681 Keymap consulted to determine the commands to run in response to keypresses
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
682 occurring while the menubar is active. @xref{Keyboard Menu Traversal}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
683 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
684
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
685 @defvar menu-accelerator-modifiers
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
686 A list of modifier keys which must be pressed in addition to a valid menu
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
687 accelerator in order for the top level menu to be activated in response to
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
688 a keystroke. The default value of @code{(meta)} mirrors the usage of the alt key
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
689 as a menu accelerator in popular PC operating systems.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
690
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
691 The modifier keys in @var{menu-accelerator-modifiers} must match exactly the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
692 modifiers present in the keypress. The only exception is that the shift
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
693 modifier is accepted in conjunction with alphabetic keys even if it is not
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
694 a menu accelerator modifier.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
695
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
696 See also @var{menu-accelerator-enabled} and @var{menu-accelerator-prefix}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
697 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
698
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
699 @defvar menu-accelerator-prefix
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
700 Prefix key(s) that must be typed before menu accelerators will be activated.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
701 Must be a valid key descriptor.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
702
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
703 The default value is @code{nil}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
704 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
705
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
706 @example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
707 (setq menu-accelerator-prefix ?\C-x)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
708 (setq menu-accelerator-modifiers '(meta control))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
709 (setq menu-accelerator-enabled 'menu-force)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
710 (add-submenu nil '("%_Test"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
711 ["One" (insert "1") :accelerator ?1 :active t]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
712 ["%_Two" (insert "2")]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
713 ["%_3" (insert "3")]))
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
714 @end example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
715
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
716 will add the menu "Test" to the top level menubar. Pressing C-x followed by
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
717 C-M-T will activate the menubar and display the "Test" menu. Pressing
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
718 C-M-T by itself will not activate the menubar. Neither will pressing C-x
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
719 followed by anything else.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
720
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 @node Buffers Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 @section Buffers Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 @cindex buffers menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 The following options control how the @samp{Buffers} menu is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 This is a list of all (or a subset of) the buffers currently in existence,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 and is updated dynamically.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 @defopt buffers-menu-max-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 This user option holds the maximum number of entries which may appear on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 the @samp{Buffers} menu. If this is 10, then only the ten
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 most-recently-selected buffers will be shown. If this is @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 then all buffers will be shown. Setting this to a large number or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 @code{nil} will slow down menu responsiveness.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 @defun format-buffers-menu-line buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 This function returns a string to represent @var{buffer} in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 @samp{Buffers} menu. @code{nil} means the buffer shouldn't be listed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 You can redefine this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 @defopt complex-buffers-menu-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 If true, the @samp{Buffers} menu will contain several commands, as submenus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 of each buffer line. If this is false, then there will be only one command:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 select that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 @defopt buffers-menu-switch-to-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 This user option holds the function to call to select a buffer from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 @samp{Buffers} menu. @code{switch-to-buffer} is a good choice, as is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 @code{pop-to-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754