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