annotate man/lispref/menus.texi @ 1738:f43f9ca6c7d9

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