XEmacs 21.2.12
[chise/xemacs-chise.git.1] / man / xemacs / menus.texi
1
2 @node Pull-down Menus, Entering Emacs, Keystrokes, Top
3 @comment  node-name,  next,  previous,  up
4 @section XEmacs Pull-down Menus 
5
6 If you are running XEmacs under X, a menu bar on top of the
7 Emacs frame provides access to pull-down menus of file, edit, and
8 help-related commands. The menus provide convenient shortcuts and an
9 easy interface for novice users.  They do not provide additions to the
10 functionality available via key commands; you can still invoke commands
11 from the keyboard as in previous versions of Emacs.
12         
13 @table @b
14 @item File
15 Perform file and buffer-related operations, such as opening and closing
16 files, saving and printing buffers, as well as exiting Emacs.
17 @cindex File menu
18
19 @item Edit
20 Perform standard editing operations, such as 
21 cutting, copying, pasting, and killing selected text.
22 @cindex Edit menu
23
24 @item Apps
25 Access to sub-applications implemented within XEmacs, such as the mail
26 reader, the World Wide Web browser, the spell-checker, and the calendar
27 program.
28 @cindex Apps menu
29
30 @item Options
31 Control various options regarding the way XEmacs works, such as controlling
32 which elements of the frame are visible, selecting the fonts to be used for
33 text, specifying whether searches are case-sensitive, etc.
34 @cindex Options menu
35
36 @item Buffers
37 Present a menu of buffers for selection as well as the option to display
38 a buffer list.
39 @cindex Buffers menu
40
41 @item Tools
42 Perform various actions designed to automate software development and
43 similar technical work, such as searching through many files, compiling
44 a program, and comparing or merging two or three files.
45 @cindex Tools menu
46
47 @item Help
48 Access to Emacs Info.
49 @cindex Help menu
50 @end table
51 @cindex Pull-down Menus
52 @cindex menus
53
54 There are two ways of selecting an item from a pull-down menu:
55
56 @itemize @bullet
57 @item
58 Select an item in the menu bar by moving the cursor over it and click the
59 left mouse-button.  Then move the cursor over the menu item you want to choose
60 and click left again.
61 @item
62 Select an item in the menu bar by moving the cursor over it and click and
63 hold the left mouse-button.  With the mouse-button depressed, move the
64 cursor over the menu item you want, then release it to make your selection. 
65 @end itemize
66
67 If a command in the pull-down menu is not applicable in a given
68 situation, the command is disabled and its name appears faded.  You
69 cannot invoke items that are faded.  For example, many commands on the
70 @b{Edit} menu appear faded until you select text on which they are to
71 operate; after you select a block of text, edit commands are enabled.
72 @xref{Mouse Selection}, for information on using the mouse to select
73 text.  @xref{Using X Selections}, for related information.
74
75 There are also @kbd{M-x} equivalents for each menu item.  To find the
76 equivalent for any left-button menu item, do the following:
77
78 @enumerate
79 @item
80 Type @kbd{C-h k} to get the @code{Describe Key} prompt. 
81 @item
82 Select the menu item and click. 
83 @end enumerate
84
85 Emacs displays the function associated with the menu item in a separate
86 window, usually together with some documentation. 
87
88 @menu
89 * File Menu::           Items on the File menu.
90 * Edit Menu::           Items on the Edit menu.
91 * Apps Menu::           Items on the Apps menu.
92 * Options Menu::        Items on the Options menu. 
93 * Buffers Menu::        Information about the Buffers menu.
94 * Tools Menu::          Items on the Tools menu.
95 * Help Menu::           Items on the Help menu. 
96 * Menu Customization::  Adding and removing menu items and related
97                         operations.
98 @end menu
99
100 @node File Menu
101 @subsection The File Menu
102
103 @cindex File menu
104
105 The @b{File} menu bar item contains the items @b{New Frame}, @b{Open
106 File...}, @b{Save Buffer}, @b{Save Buffer As...}, @b{Revert Buffer},
107 @b{Print Buffer}, @b{Delete Frame}, @b{Kill Buffer} and @b{Exit Emacs}
108 on the pull-down menu.  If you select a menu item, Emacs executes the
109 equivalent command.
110
111 @cindex Open File, New Frame... menu item
112 @cindex Open File... menu item
113 @cindex Insert File... menu item
114 @cindex Save Buffer menu item
115 @cindex Save Buffer As ... menu item
116 @cindex Revert Buffer menu item
117 @cindex Kill Buffer menu item
118 @cindex Print Buffer menu item
119 @cindex New Frame menu item
120 @cindex Delete Frame menu item
121 @cindex Split Frame
122 @cindex Un-split (Keep This)
123 @cindex Un-split (Keep Others)
124 @cindex Exit Emacs menu item
125
126 @table @b
127 @item Open File, New Frame...
128 Prompts you for a filename and loads that file into a new buffer in a
129 new Emacs frame, that is, a new X window running under the same Emacs
130 process.  You can remove the frame using the @b{Delete Frame} menu
131 item.  When you remove the last frame, you exit Emacs and are prompted
132 for confirmation. @refill
133
134 @item Open File...
135 Prompts you for a filename and loads that file into a new buffer. 
136 @b{Open File...} is equivalent to the Emacs command @code{find-file} (@kbd{C-x
137 C-f}).@refill 
138
139 @item Insert File...
140 Prompts you for a filename and inserts the contents of that file into
141 the current buffer.  The file associated with the current buffer is
142 not changed by this command.  This is equivalent to the Emacs command
143 @code{insert-file} (@kbd{C-x i}).@refill 
144
145 @item Save Buffer 
146 Writes and saves the current Emacs buffer as the latest
147 version of the current visited file.  @b{Save Buffer} is equivalent to the
148 Emacs command @code{save-buffer} (@kbd{C-x C-s}).@refill
149
150 @item Save Buffer As... 
151 Writes and saves the current Emacs buffer to the filename you specify.
152 @b{Save Buffer As...} is equivalent to the Emacs command
153 @code{write-file} (@kbd{C-x C-w}).@refill
154
155 @item Revert Buffer
156 Restores the last saved version of the file to the current buffer.  When
157 you edit a buffer containing a text file, you must save the buffer
158 before your changes become effective.  Use @b{Revert Buffer} if you do
159 not want to keep the changes you have made in the buffer.  @b{Revert
160 Buffer} is equivalent to the Emacs command @code{revert-file} (@kbd{M-x
161 revert-buffer}).@refill
162
163 @item Kill Buffer
164 Kills the current buffer, prompting you first if there are unsaved
165 changes.  This is roughly equivalent to the Emacs command 
166 @code{kill-buffer} (@kbd{C-x k}), except that @code{kill-buffer} 
167 prompts for the name of a buffer to kill. @refill
168
169 @item Print Buffer
170 Prints a hardcopy of the current buffer.  Equivalent
171 to the Emacs command @code{print-buffer} (@kbd{M-x print-buffer}).@refill
172
173 @item New Frame
174 Creates a new Emacs frame displaying the @code{*scratch*} buffer.  This
175 is like the @b{Open File, New Frame...} menu item, except that it does
176 not prompt for or load a file.@refill
177
178 @item Delete Frame 
179 Allows you to close all but one of the frames created by @b{New Frame}.
180 If you created several Emacs frames belonging to the same Emacs
181 process, you can close all but one of them.  When you attempt to close the
182 last frame, Emacs informs you that you are attempting to delete the
183 last frame.  You have to choose @b{Exit Emacs} for that.@refill
184
185 @item Split Frame
186 Divides the current window on the current frame into two equal-sized
187 windows, both displaying the same buffer.  Equivalent to the Emacs
188 command @code{split-window-vertically} (@kbd{C-x 2}).@refill
189
190 @item Un-split (Keep This)
191 If the frame is divided into multiple windows, this removes all windows
192 other than the selected one.  Equivalent to the Emacs command
193 @code{delete-other-windows} (@kbd{C-x 1}).@refill
194
195 @item Un-split (Keep Others)
196 If the frame is divided into multiple windows, this removes the
197 selected window from the frame, giving the space back to one of the
198 other windows.  Equivalent to the Emacs command @code{delete-window}
199 (@kbd{C-x 0}).@refill
200
201 @item Exit Emacs
202 Shuts down (kills) the Emacs process.  Equivalent to the Emacs command
203 @code{save-buffers-kill-emacs} (@kbd{C-x C-c}).  Before killing the
204 Emacs process, the system asks which unsaved buffers to save by going through
205 the list of all buffers in that Emacs process.@refill
206 @end table
207
208 @node Edit Menu
209 @subsection The Edit Menu
210 @cindex Edit menu
211
212 The @b{Edit} pull-down menu contains the @b{Undo}, @b{Cut}, @b{Copy},
213 @b{Paste}, and @b{Clear} menu items.  When you select a menu item, Emacs
214 executes the equivalent command.  Most commands on the @b{Edit} menu
215 work on a block of text, the X selection.  They appear faded until you
216 select a block of text (activate a region) with the mouse.  @xref{Using
217 X Selections}, @pxref{Killing}, and @pxref{Yanking} for more
218 information.@refill
219
220 @c  **** zmacs-regions is on by default these days - jwz
221 @c
222 @c Note: By default, you can use the @b{Edit} menu items on the region between
223 @c point an the mark as well as regions selected with the mouse. To change
224 @c this behavior, set the variable @code{zmacs-regions} to
225 @c @code{t}. @xref{Active Regions} for more information.
226
227 @cindex Undo menu item
228 @cindex Cut menu item
229 @cindex Copy menu item
230 @cindex Paste menu item
231 @cindex Clear menu item
232 @cindex Start Macro Recording menu item
233 @cindex End Macro Recording menu item
234 @cindex Execute Last Macro menu item
235 @table @b
236 @item Undo 
237 Undoes the previous command.  @b{Undo} is equivalent to
238 the Emacs command @code{undo} (@kbd{C-x u}).@refill
239
240 @item Cut
241 Removes the selected text block from the current buffer, makes it the X
242 clipboard selection, and places it in the kill ring.  Before executing
243 this command, you have to select a region using Emacs region selection
244 commands or with the mouse.@refill 
245
246 @item Copy 
247 Makes a selected text block the X clipboard selection, and places it in
248 the kill ring.  You can select text using one of the Emacs region
249 selection commands or by selecting a text region with the mouse.@refill
250
251 @item Paste 
252 Inserts the current value of the X clipboard selection in the current
253 buffer.  Note that this is not necessarily the same as the Emacs
254 @code{yank} command, because the Emacs kill ring and the X clipboard
255 selection are not the same thing.  You can paste in text you
256 have placed in the clipboard using @b{Copy} or @b{Cut}.  You can also
257 use @b{Paste} to insert text that was pasted into the clipboard from other
258 applications.
259
260 @item Clear
261 Removes the selected text block from the current buffer but does not
262 place it in the kill ring or the X clipboard selection. 
263
264 @item Start Macro Recording
265 After selecting this, Emacs will remember every keystroke you type until
266 @b{End Macro Recording} is selected.  This is the same as the Emacs 
267 command @code{start-kbd-macro} (@kbd{C-x (}).
268
269 @item End Macro Recording
270 Selecting this tells emacs to stop remembering your keystrokes.  This is
271 the same as the Emacs command @code{end-kbd-macro} (@kbd{C-x )}).
272
273 @item Execute Last Macro
274 Selecting this item will cause emacs to re-interpret all of the
275 keystrokes which were saved between selections of the @b{Start Macro
276 Recording} and @b{End Macro Recording} menu items.  This is the same
277 as the Emacs command @code{call-last-kbd-macro} (@kbd{C-x e}).
278 @end table
279
280 @node Apps Menu
281 @subsection The Apps Menu
282 @cindex Apps menu
283
284 The @b{Apps} pull-down menu contains the @b{Read Mail (VM)...}, @b{Read
285 Mail (MH)...}, @b{Send Mail...}, @b{Usenet News}, @b{Browse the Web},
286 @b{Gopher}, @b{Spell-Check Buffer} and @b{Emulate VI} menu items,
287 and the @b{Calendar} and @b{Games} sub-menus.  When you select a menu
288 item, Emacs executes the equivalent command.  For some of the menu
289 items, there are sub-menus which you will need to select.
290
291 @node Options Menu
292 @subsection The Options Menu
293 @cindex Options menu
294
295 The @b{Options} pull-down menu contains the @b{Read Only}, @b{Case 
296 Sensitive Search}, @b{Overstrike}, @b{Auto Delete Selection}, 
297 @b{Teach Extended Commands}, @b{Syntax Highlighting}, @b{Paren 
298 Highlighting}, @b{Font}, @b{Size}, @b{Weight}, @b{Buffers Menu 
299 Length...}, @b{Buffers Sub-Menus} and @b{Save Options} menu items. 
300 When you select a menu item, Emacs executes the equivalent command. 
301 For some of the menu items, there are sub-menus which you will need 
302 to select.
303
304 @cindex Read Only menu item
305 @cindex Case Sensitive Search menu item
306 @cindex Overstrike menu item
307 @cindex Auto Delete Selection menu item
308 @cindex Teach Extended Commands menu item
309 @cindex Syntax Highlighting menu item
310 @cindex Paren Highlighting menu item
311 @cindex Font menu item
312 @cindex Size menu item
313 @cindex Weight menu item
314 @cindex Buffers Menu Length... menu item
315 @cindex Buffers Sub-Menus menu item
316 @cindex Save Options
317 @table @b
318 @item Read Only
319 Selecting this item will cause the buffer to visit the file in a 
320 read-only mode. Changes to the file will not be allowed. This is 
321 equivalent to the Emacs command @code{toggle-read-only} 
322 (@kbd{C-x C-q}).
323
324 @item Case Sensitive Search
325 Selecting this item will cause searches to be case-sensitive. If 
326 its not selected then searches will ignore case. This option is 
327 local to the buffer.
328
329 @item Overstrike
330 After selecting this item, when you type letters they will replace 
331 existing text on a one-to-one basis, rather than pushing it to the 
332 right. At the end of a line, such characters extend the line. Before 
333 a tab, such characters insert until the tab is filled in. This is the 
334 same as Emacs command @code{quoted-insert} (@kbd{C-q}).
335
336 @item Auto Delete Selection
337 Selecting this item will cause automatic deletion of the selected 
338 region. The typed text will replace the selection if the selection 
339 is active (i.e. if its highlighted). If the option is not selected 
340 then the typed text is just inserted at the point.
341
342 @item Teach Extended Commands
343 After you  select this item, any time you execute a command with 
344 @kbd{M-x}which has a shorter keybinding, you will be shown the 
345 alternate binding before the command executes.
346
347 @item Syntax Highlighting
348 You can customize your @code{.emacs} file to include the font-lock 
349 mode so that when you select this item, the comments will be 
350 displayed in one face, strings in another, reserved words in another, 
351 and so on. When @b{Fonts} is selected, different parts of the program 
352 will appear in different Fonts. When @b{Colors} is selected, then the 
353 program will be displayed in different colors. Selecting @b{None} 
354 causes the program to appear in just one Font and Color. Selecting 
355 @b{Less} resets the Fonts and Colors to a fast, minimal set of 
356 decorations. Selecting @b{More} resets the Fonts and Colors to a larger 
357 set of decorations. For example, if @b{Less} is selected (which is the 
358 default setting) then you might have all comments in green color. 
359 Whereas, if @b{More} is selected then a function name in the comments 
360 themselves might appear in a different Color or Font.@refill
361
362 @item Paren Highlighting
363 After selecting @b{Blink} from this item, if you place the cursor 
364 on a parenthesis, the matching parenthesis will blink. If you select 
365 @b{Highlight} and place the cursor on a parenthesis, the whole 
366 expression of the parenthesis under the cursor will be highlighted. 
367 Selecting @b{None} will turn off the options (regarding @b{Paren 
368 Highlighting}) which you had selected earlier.@refill
369
370 @item Font
371 You can select any Font for your program by choosing from one of the 
372 available Fonts.
373
374 @item Size
375 You can select any size ranging from @b{2} to @b{24} by selecting the 
376 appropriate option.@refill
377
378 @item Weight
379 You can choose either @b{Bold} or @b{Medium} for the weight.@refill
380
381 @item Buffers Menu Length...
382 Prompts you for the number of buffers to display. Then it will display 
383 that number of most recently selected buffers.
384
385 @item Buffers Sub-Menus
386 After selection of this item the Buffers menu will contain several 
387 commands, as submenus of each buffer line. If this item is unselected, 
388 then there are no submenus for each buffer line, the only command 
389 available will be selecting that buffer.
390
391 @item Save Options
392 Selecting this item will save the current settings of your Options 
393 menu to your @code{.emacs} file.
394 @end table
395
396 @node Buffers Menu
397 @subsection The Buffers Menu
398 @cindex Buffers menu
399 The @b{Buffers} menu provides a selection of up to ten buffers and the
400 item @b{List All Buffers}, which provides a Buffer List. @xref{List
401 Buffers}, for more information.  
402
403 @node Tools Menu
404 @subsection The Tools Menu
405 @cindex Tools menu
406
407 The @b{Tools} pull-down menu contains the @b{Grep...}, @b{Compile...},
408 @b{Shell Command...}, @b{Shell Command on Region...}, @b{Debug(GDB)...}
409 and @b{Debug(DBX)...} menu items, and the @b{Compare}, @b{Merge},
410 @b{Apply Patch} and @b{Tags} sub-menus.  When you select a menu item,
411 Emacs executes the equivalent command.  For some of the menu items,
412 there are sub-menus which you will need to select.
413
414 @node Help Menu
415 @subsection The Help Menu
416 @cindex Help menu
417
418 The Help Menu gives you access to Emacs Info and provides a menu
419 equivalent for each of the choices you have when using @kbd{C-h}. 
420 @xref{Help}, for more information. 
421
422 The Help menu also gives access to UNIX online manual pages via the
423 @b{UNIX Manual Page} option.  
424
425 @node Menu Customization
426 @subsection Customizing XEmacs Menus
427
428 You can customize any of the pull-down menus by adding or removing menu
429 items and disabling or enabling existing menu items.
430  
431 The following functions are available: 
432 @table @kbd
433 @item add-menu: @var{(menu-path menu-name menu-items &optional before)}
434 Add a menu to the menu bar or one of its submenus.
435 @item add-menu-item: @var{(menu-path item-name function enabled-p
436 &optional before)}
437 Add a menu item to a menu, creating the menu first if necessary.
438 @item delete-menu-item: @var{(path)}
439 Remove the menu item defined by @var{path} from the menu hierarchy.
440 @item disable-menu-item: @var{(path)}
441 Disable the specified menu item.
442 @item enable-menu-item: @var{(path)}
443 Enable the specified previously disabled menu item.
444 @item relabel-menu-item: @var{(path new-name)}
445 Change the string of the menu item specified by @var{path} to
446 @var{new-name}.
447
448 @end table
449
450 @findex add-menu
451 @cindex adding menus
452 Use the function @code{add-menu} to add a new menu or submenu.
453 If a menu or submenu of the given name exists already, it is changed.
454
455 @var{menu-path} identifies the menu under which the new menu should be
456 inserted.  It is a list of strings; for example, @code{("File")} names
457 the top-level @b{File} menu.  @code{("File" "Foo")} names a hypothetical
458 submenu of @b{File}.  If @var{menu-path} is @code{nil}, the menu is
459 added to the menu bar itself.
460
461 @var{menu-name} is the string naming the menu to be added.  
462
463 @var{menu-items} is a list of menu item descriptions.  Each menu item
464 should be a vector of three elements:
465
466 @itemize @bullet
467 @item 
468 A string, which is the name of the menu item
469 @item 
470 A symbol naming a command, or a form to evaluate
471 @item 
472 @code{t} or @code{nil} to indicate whether the item is selectable
473 @end itemize
474
475 The optional argument @var{before} is the name of the menu before which
476 the new menu or submenu should be added.  If the menu is already
477 present, it is not moved.
478
479 @findex add-menu-item
480 @cindex adding menu items
481 The function @code{add-menu-item} adds a menu item to the specified
482 menu, creating the menu first if necessary.  If the named item already
483 exists, the menu remains unchanged.
484
485 @var{menu-path} identifies the menu into which the new menu item should
486 be inserted.  It is a list of strings; for example, @code{("File")}
487 names the top-level @b{File} menu.  @code{("File" "Foo")} names a
488 hypothetical submenu of @b{File}.
489
490 @var{item-name} is the string naming the menu item to add.
491
492 @var{function} is the command to invoke when this menu item is selected.
493 If it is a symbol, it is invoked with @code{call-interactively}, in the
494 same way that functions bound to keys are invoked.  If it is a list, the
495 list is simply evaluated.
496
497 @var{enabled-p} controls whether the item is selectable or not.
498 It should be @code{t}, @code{nil}, or a form to evaluate to decide.  
499 This form will be evaluated just before the menu is displayed, and 
500 the menu item will be selectable if that form returns non-@code{nil}.
501
502 For example, to make the @code{rename-file} command available from the
503 @b{File} menu, use the following code:
504
505 @example
506 (add-menu-item '("File") "Rename File" 'rename-file t)
507 @end example
508
509 To add a submenu of file management commands using a @b{File Management}
510 item, use the following code: 
511
512 @example
513 (add-menu-item '("File" "File Management") "Copy File" 'copy-file t)
514 (add-menu-item '("File" "File Management") "Delete File" 'delete-file t)
515 (add-menu-item '("File" "File Management") "Rename File" 'rename-file t)
516 @end example
517
518 The optional @var{before} argument is the name of a menu item before
519 which the new item should be added.  If the item is already present, it
520 is not moved.
521
522 @findex delete-menu-item
523 @cindex deleting menu items
524 To remove a specified menu item from the menu hierarchy, use
525 @code{delete-menu-item}.
526
527 @var{path} is a list of strings that identify the position of the menu
528 item in the menu hierarchy.  @code{("File" "Save")} means the menu item
529 called @b{Save} under the top level @b{File} menu.  @code{("Menu" "Foo"
530 "Item")} means the menu item called @b{Item} under the @b{Foo} submenu
531 of @b{Menu}.
532
533 @findex disable-menu-item
534 @findex enable-menu-item
535 @cindex enabling menu items
536 @cindex disabling menu items
537
538 To disable a menu item, use @code{disable-menu-item}.  The disabled
539 menu item is grayed and can no longer be selected.  To make the
540 item selectable again, use @code{enable-menu-item}.
541 @code{disable-menu-item} and @code{enable-menu-item} both have the
542 argument @var{path}.
543
544 @findex relabel-menu-item
545 @cindex changing menu items
546 To change the string of the specified menu item, use
547 @code{relabel-menu-item}. This function also takes the argument @var{path}.
548
549 @var{new-name} is the string to which the menu item will be changed.