annotate man/lispref/menus.texi @ 175:2d532a89d707 r20-3b14

Import from CVS: tag r20-3b14
author cvs
date Mon, 13 Aug 2007 09:50:14 +0200
parents 131b0175ea99
children 11cf20601dec
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 * Menu Format:: Format of a menu description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 * Menubar Format:: How to specify a menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 * Menubar:: Functions for controlling the menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 * Modifying Menus:: Modifying a menu description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 * Pop-Up Menus:: Functions for specifying pop-up menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 * Menu Filters:: Filter functions for the default menubar.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
18 * Menu Accelerators:: Using and controlling menu accelerator keys
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 * Buffers Menu:: The menu that displays the list of buffers.
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 @item :suffix @var{string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 The string is appended to the displayed name. This provides a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 convenient way of adding the name of a command's ``argument'' to the
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
178 menu, like @samp{Kill Buffer NAME}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 @item :keys @var{string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Normally, the keyboard equivalents of commands in menus are displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 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
183 more complex menu items. It is passed through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 @code{substitute-command-keys} first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 @item :style @var{style}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 Specifies what kind of object this menu item is. @var{style} be one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 of the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @item nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 A normal menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 @item toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 A toggle button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 @item radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 A radio button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 @item button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 A menubar button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 The only difference between toggle and radio buttons is how they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 displayed. But for consistency, a toggle button should be used when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 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
204 buttons should be used when there is a set of mutually exclusive options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 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
206 one to be marked as selected at a time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 @item :selected @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 Meaningful only when @var{style} is @code{toggle}, @code{radio} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 @code{button}. This specifies whether the button will be in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 selected or unselected state. @var{form} is evaluated, as for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 @code{:active}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 @item :included @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 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
216 evaluated and the menu item is only displayed if the result is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 non-@code{nil}. Note that this is different from @code{:active}: If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 @code{:active} evaluates to @code{nil}, the item will be displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 grayed out, while if @code{:included} evaluates to @code{nil}, the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 will be omitted entirely.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 @item :config @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 This is an efficient shorthand for @code{:included (memq @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 menubar-configuration)}. See the variable @code{menubar-configuration}.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
225
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
226 @item :accelerator @var{key}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
227 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
228 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
229 or the symbol name of a key. @xref{Menu Accelerators}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 @defvar menubar-configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 This variable holds a list of symbols, against which the value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 @code{:config} tag for each menubar item will be compared. If a menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 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
236 that tag is not a member of the @code{menubar-configuration} list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 :filter file-menu-filter ; file-menu-filter is a function that takes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ; one argument (a list of menu items) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ; returns a list of menu items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 [ "Save As..." write-file t ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 [ "Revert Buffer" revert-buffer (buffer-modified-p) ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 @node Menubar Format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @section Format of the Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 @cindex menubar format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 @cindex format of the menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 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
258 similar to that of a menu, except:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 The first item need not be a string, and is not treated specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 A string consisting solely of hyphens is not treated specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 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
269 the division between the set of menubar items which are flush-left and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 those which are flush-right. (Note: this isn't completely implemented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 yet.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 @node Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @section Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 @cindex menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @defvar current-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 This variable holds the description of the current menubar. This may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 buffer-local. When the menubar is changed, the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 @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
282 to be updated on the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 @defvr Constant default-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 This variable holds the menubar description of the menubar that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 visible at startup. This is the value that @code{current-menubar}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 has at startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 @end defvr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 @defun set-menubar-dirty-flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 This function tells XEmacs that the menubar widget has to be updated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 Changes to the menubar will generally not be visible until this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 The following convenience functions are provided for setting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 menubar. They are equivalent to doing the appropriate action to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 @code{current-menubar}, and then calling @code{set-menubar-dirty-flag}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 Note that these functions copy their argument using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 @code{copy-sequence}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 @defun set-menubar menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 This function sets the default menubar to be @var{menubar} (@pxref{Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 Format}). This is the menubar that will be visible in buffers that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 have not defined their own, buffer-local menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 @defun set-buffer-menubar menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 This function sets the buffer-local menubar to be @var{menubar}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 does not change the menubar in any buffers other than the current one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 Miscellaneous:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 @defvar menubar-show-keybindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 If true, the menubar will display keyboard equivalents. If false, only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 the command names will be displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 @defvar activate-menubar-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 Function or functions called before a menubar menu is pulled down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 These functions are called with no arguments, and should interrogate and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 modify the value of @code{current-menubar} as desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 The functions on this hook are invoked after the mouse goes down, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 before the menu is mapped, and may be used to activate, deactivate, add,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 or delete items from the menus. However, using a filter (with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 @code{:filter} keyword in a menu description) is generally a more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 efficient way of accomplishing the same thing, because the filter is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 invoked only when the actual menu goes down. With a complex menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 there can be a quite noticeable and sometimes aggravating delay if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 all menu modification is implemented using the @code{activate-menubar-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 See above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 These functions may return the symbol @code{t} to assert that they have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 made no changes to the menubar. If any other value is returned, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 menubar is recomputed. If @code{t} is returned but the menubar has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 changed, then the changes may not show up right away. Returning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 @code{nil} when the menubar has not changed is not so bad; more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 computation will be done, but redisplay of the menubar will still be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 performed optimally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 @defvar menu-no-selection-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 Function or functions to call when a menu or dialog box is dismissed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 without a selection having been made.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 @node Modifying Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 @section Modifying Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 The following functions are provided to modify the menubar of one of its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 submenus. Note that these functions modify the menu in-place, rather
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 than copying it and making a new menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 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
358 strings identifying the menu to be modified. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 @code{("File")} names the top-level ``File'' menu. @code{("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 "Foo")} names a hypothetical submenu of ``File''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 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
363 also specifies a particular item to be modified. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 @code{("File" "Save")} means the menu item called ``Save'' under the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 top-level ``File'' menu. @code{("Menu" "Foo" "Item")} means the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 item called ``Item'' under the ``Foo'' submenu of ``Menu''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 @defun add-submenu menu-path submenu &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 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
370 named menu exists already, it is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 @var{menu-path} identifies the menu under which the new menu should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 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
374 to the menubar itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 @var{submenu} is the new menu to add (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 @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
379 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
380 is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 @defun add-menu-button menu-path menu-leaf &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 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
385 necessary. If the named item exists already, it is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 @var{menu-path} identifies the menu under which the new menu item should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 be inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 @var{menu-leaf} is a menubar leaf node (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 @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
393 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
394 is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 @defun delete-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 This function removes the menu item specified by @var{menu-item-path}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 from the menu hierarchy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 @defun enable-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 This function makes the menu item specified by @var{menu-item-path} be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 selectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 @defun disable-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 This function makes the menu item specified by @var{menu-item-path} be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 unselectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 @defun relabel-menu-item menu-item-path new-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 This function changes the string of the menu item specified by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 @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
415 will be printed as from now on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 The following function can be used to search for a particular item in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 a menubar specification, given a path to the item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 @defun find-menu-item menubar menu-item-path &optional parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 This function searches @var{menubar} for the item given by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 @var{menu-item-path} starting from @var{parent} (@code{nil} means start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 at the top of @var{menubar}). This function returns @code{(@var{item}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 . @var{parent})}, where @var{parent} is the immediate parent of the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 found (a menu description), and @var{item} is either a vector, list, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 string, depending on the nature of the menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 This function signals an error if the item is not found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 The following deprecated functions are also documented, so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 existing code can be understood. You should not use these functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 in new code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 @defun add-menu menu-path menu-name menu-items &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 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
438 named menu exists already, it is changed. This is obsolete; use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 @code{add-submenu} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 @var{menu-path} identifies the menu under which the new menu should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 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
443 to the menubar itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 @var{menu-name} is the string naming the menu to be added;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 @var{menu-items} is a list of menu items, strings, and submenus. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 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
448 description (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 @var{before}, if provided, is the name of a menu before which this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 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
452 menu is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 @defun add-menu-item menu-path item-name function enabled-p &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 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
457 necessary. If the named item exists already, it is changed. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 obsolete; use @code{add-menu-button} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 @var{menu-path} identifies the menu under which the new menu item should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 be inserted. @var{item-name}, @var{function}, and @var{enabled-p} are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 the first, second, and third elements of a menu item vector (@pxref{Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 @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
466 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
467 item is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 @node Menu Filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 @section Menu Filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 @cindex menu filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 The following filter functions are provided for use in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 @code{default-menubar}. You may want to use them in your own menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 @defun file-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 This function changes the arguments and sensitivity of these File menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 @item Delete Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 @item Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 @item Pretty-Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 @item Save Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 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
490 when the current buffer is modified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 @item Revert Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 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
493 when the current buffer has a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 @item Delete Frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 Sensitive only when there is more than one visible frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 @defun edit-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 This function changes the arguments and sensitivity of these Edit menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 @item Cut
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 Sensitive only when XEmacs owns the primary X Selection (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 @code{zmacs-regions} is @code{t}, this is equivalent to saying that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 there is a region selected).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 @item Copy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 Sensitive only when XEmacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 @item Clear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 Sensitive only when XEmacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @item Paste
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 Sensitive only when there is an owner for the X Clipboard Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 @item Undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 Sensitive only when there is undo information. While in the midst of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 undo, this is changed to @samp{Undo More}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 @defun buffers-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 This function sets up the Buffers menu. @xref{Buffers Menu} for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 @node Pop-Up Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 @section Pop-Up Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 @cindex pop-up menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 @defun popup-menu menu-desc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 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
530 menu description (@pxref{Menu Format}). The menu is displayed at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 current mouse position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 @defun popup-menu-up-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 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
536 otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 @defvar popup-menu-titles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 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
541 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 Some machinery is provided that attempts to provide a higher-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 mechanism onto pop-up menus. This only works if you do not redefine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 the binding for button3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 @deffn Command popup-mode-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 This function pops up a menu of global and mode-specific commands. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 menu is computed by combining @code{global-popup-menu} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 @code{mode-popup-menu}. This is the default binding for button3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 You should generally not change this binding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 @defvar global-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 This holds the global popup menu. This is present in all modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (This is @code{nil} by default.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 @defvar mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 The mode-specific popup menu. Automatically buffer local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 This is appended to the default items in @code{global-popup-menu}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 @defvr Constant default-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 This holds the default value of @code{mode-popup-menu}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 @end defvr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 @defvar activate-popup-menu-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 Function or functions run before a mode-specific popup menu is made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 visible. These functions are called with no arguments, and should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 interrogate and modify the value of @code{global-popup-menu} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 @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
573 use @code{popup-mode-menu} for activating the global and mode-specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 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
575 run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 The following convenience functions are provided for displaying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 pop-up menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 @defun popup-buffer-menu event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 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
583 where the mouse is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 @defun popup-menubar-menu event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 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
588 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
590 @node Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
591 @section Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
592 @cindex menu accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
593 @cindex keyboard menu accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
594
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
595 Menu accelerators are keyboard shortcuts for accessing the menubar.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
596 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
597 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
598 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
599 activate that item.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
600
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
601 @menu
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
602 * Creating Menu Accelerators:: How to add accelerator keys to a menu.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
603 * Keyboard Menu Traversal:: How to use and modify the keys which are used
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
604 to traverse the menu structure.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
605 * Menu Accelerator Functions:: Functions for working with menu accelerators.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
606 @end menu
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
607
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
608 @node Creating Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
609 @subsection Creating Menu Accelerators
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
610
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
611 Menu accelerators are specified as part of the menubar format using the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
612 :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
613 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
614 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
615 draw an underline under that character, which is the canonical way of
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
616 indicating an accelerator key to a user.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
617
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
618 For example, the command
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
619
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
620 @example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
621 (add-submenu nil '("%_Test"
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
622 ["One" (insert "1") :accelerator ?1 :active t]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
623 ["%_Two" (insert "2") t]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
624 ["%_3" (insert "3") t]))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
625 @end example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
626
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
627 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
628 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
629 active, pressing "1" will activate the first item and insert the character
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
630 "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
631 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
632 and insert the character "3" into the buffer.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
633
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
634 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
635 @xref{Menu Accelerator Functions}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
636
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
637 @node Keyboard Menu Traversal
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
638 @subsection Keyboard Menu Traversal
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
639
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
640 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
641 be used to traverse the menus without activating items. The keyboard arrow
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
642 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
643 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
644 operating systems.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
645
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
646 This behaviour can be changed by modifying the bindings in
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
647 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
648 for more information about how to modify the menu traversal keys.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
649
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
650 @node Menu Accelerator Functions
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
651 @subsection Menu Accelerator Functions
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
652
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
653 @defun accelerate-menu
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
654 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
655 in the top level menu. Menu items can be selected as usual.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
656 @end defun
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
657
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
658 @defvar menu-accelerator-enabled
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
659 Whether menu accelerator keys can cause the menubar to become active.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
660
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
661 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
662 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
663 accelerator keys can be used regardless of the value of this variable.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
664
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
665 @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
666 precedence over bindings in the current keymap(s). @code{menu-fallback} means
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
667 that bindings in the current keymap take precedence over menu accelerator keys.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
668 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
669 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
670 However, if @var{menu-accelerator-enabled} is @code{menu-fallback}, then
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
671 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
672 transpose-words, to which it is normally bound.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
673
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
674 The default value is @code{nil}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
675
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
676 See also @var{menu-accelerator-modifiers} and @var{menu-accelerator-prefix}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
677 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
678
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
679 @defvar menu-accelerator-map
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
680 Keymap consulted to determine the commands to run in response to keypresses
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
681 occurring while the menubar is active. @xref{Keyboard Menu Traversal}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
682 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
683
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
684 @defvar menu-accelerator-modifiers
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
685 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
686 accelerator in order for the top level menu to be activated in response to
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
687 a keystroke. The default value of @code{(meta)} mirrors the useage of the alt key
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
688 as a menu accelerator in popular PC operating systems.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
689
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
690 The modifier keys in @var{menu-accelerator-modifiers} must match exactly the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
691 modifiers present in the keypress. The only exception is that the shift
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
692 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
693 a menu accelerator modifier.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
694
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
695 See also @var{menu-accelerator-enabled} and @var{menu-accelerator-prefix}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
696 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
697
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
698 @defvar menu-accelerator-prefix
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
699 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
700 Must be a valid key descriptor.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
701
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
702 The default value is @code{nil}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
703 @end defvar
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
704
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
705 @example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
706 (setq menu-accelerator-prefix ?\C-x)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
707 (setq menu-accelerator-modifiers '(meta control))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
708 (setq menu-accelerator-enabled 'menu-force)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
709 (add-submenu nil '("%_Test"
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
710 ["One" (insert "1") :accelerator ?1 :active t]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
711 ["%_Two" (insert "2") t]
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
712 ["%_3" (insert "3") t]))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
713 @end example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
714
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
715 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
716 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
717 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
718 followed by anything else.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 70
diff changeset
719
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 @node Buffers Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 @section Buffers Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 @cindex buffers menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 The following options control how the @samp{Buffers} menu is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 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
726 and is updated dynamically.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 @defopt buffers-menu-max-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 This user option holds the maximum number of entries which may appear on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 the @samp{Buffers} menu. If this is 10, then only the ten
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 most-recently-selected buffers will be shown. If this is @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 then all buffers will be shown. Setting this to a large number or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 @code{nil} will slow down menu responsiveness.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 @defun format-buffers-menu-line buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 This function returns a string to represent @var{buffer} in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 @samp{Buffers} menu. @code{nil} means the buffer shouldn't be listed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 You can redefine this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 @defopt complex-buffers-menu-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 If true, the @samp{Buffers} menu will contain several commands, as submenus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 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
745 select that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 @defopt buffers-menu-switch-to-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 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
750 @samp{Buffers} menu. @code{switch-to-buffer} is a good choice, as is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 @code{pop-to-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753