annotate man/lispref/menus.texi @ 5940:c608d4b0b75e cygwin64 tip

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