SXEmacs Windows and Menus
*************************

The first section of this chapter will show you how you can manipulate SXEmacs Windows and the other section will explain the Pull-down Menus of an SXEmacs window.

SXEmacs Windows
===============

When you use SXEmacs under X, you can open multiple windows and each window can display one buffer or multiple parts of one buffer. Each window will have its own mode line and echo area. At any one time there is only one selected window and the buffer it displays is the selected buffer. There are some commands for manipulating windows:

M-C-v
     This command will scroll the window which is not selected (scroll-other-window).

C-x 0
     This command will get rid of the selected window (delete-window). That is a zero. If there is more than one Emacs frame, deleting the sole remaining window on that frame deletes the frame as well. If the current frame is the only frame, it is not deleted.

C-x 1
     This command will get rid of all the windows except the selected one. (delete-other-windows). For example, if you use the Describe variable option from the Help menu, the window will split vertically and the bottom window will contain documentation for that variable. After you are done looking at that variable's documentation you might want to come back to your original single window. Just type C-x 1 after your cursor is in the top window (the window which you want to keep) and hit RET.

C-x 2
     This command will split the selected window into two windows, one above the other (split-window-vertically). Both the windows will start out by displaying the same buffer. The window in which you have your cursor will be your selected window.

C-x 3
     This will split the selected window into two windows positioned side by side (split-window-horizontally). A line of vertical bars will separate the window.

You can select a buffer in another window by using some other commands. These commands all have a prefix key C-x 4

C-x 4 b BUFNAME RET
     This command will select a buffer BUFNAME in another window.  This runs switch-to-buffer-other-window. It will prompt you for a buffername.

C-x 4 f FILENAME RET
     Visit file FILENAME and select its buffer in another window.  This runs find-file-other-window.  See Visiting (SXEmacs User's Manual). It will prompt you for a filename.

C-x 4 d DIRECTORY RET
     Select a Dired buffer for directory DIRECTORY in another window. This runs dired-other-window.  See Dired (SXEmacs User's Manual).

C-x 4 m
     Start composing a mail message in another window.  This runs mail-other-window, and its same-window version is C-x m. See Sending Mail (SXEmacs User's Manual), for information on how to Send Mail using SXEmacs. See Reading Mail With Rmail (SXEmacs User's Manual), for information on reading mail using Rmail.

If you click the right button on the mouse on a mode line, you will get a menu with following options:

Delete Window
     Choosing this menu will remove the window above this modeline from the frame.

Delete Other Windows
     Delete all windows on the frame except for the one above this modeline.

Split Window
     Split the window above the mode line in half, creating another window.

Split Window Horizontally
     Split the window above the mode line in half horizontally, so that there will be two windows side-by-side.

Balance Windows
     Readjust the sizes of all windows on the frame until all windows have roughly the same number of lines.

SXEmacs Pull-down Menus
=======================

When you run SXEmacs under X, each Emacs frame has a menu-bar at the top which provides commands for editing, help and other options. All these options are also available via key commands, the menus just provide convenient short-cuts. The key commands are displayed right besides some of the options. The following is a brief description of the four default menus on the menu bar:

The File Menu
-------------

The File menu bar contains the following items. To choose a particular option, press the left mouse button and drag it to the item you wish to select. Then release the button.

Open...
     This option will prompt you for a file name. You will get a message in the echo area:

          Find File:

     After Find File, there might be a directory path also. After you type the file name and press RET the file will be loaded into a new buffer.

Open in New Frame...
     It prompts you for a file name and loads that file in a new buffer in a new frame. You can open many frames for the same Emacs session. You can delete the frame by selecting Delete Frame.

Insert File...
     Prompts you for a filename and inserts the contents of this filename in your current buffer. Position your cursor at the place you wish to insert the file and select this option. You will get the following message in the echo area:

          Insert file:

     Insert the file name and press RET.

Save <Buffername>
     It saves the changes you have made to the buffer. If you have made changes which are not saved yet, the option will appear dark, otherwise it will be light and unselectable. If you do not wish to save the changes, select Revert Buffer.

Save As...
     Prompts you for a filename and saves the current buffer in that file. It loads the new file if the filename you specify is different from the one you were working with.

Print Buffer <buffername>
     Prints a hardcopy of the current or selected buffer.

New Frame
     Opens a new frame with *scratch* as the default buffer. It doesn't prompt you for a filename. To open a file you need to go to that frame and select Open...

Split Frame
     Splits the current window into two equal-sized windows with the same buffer. To get back a single frame, select Un-Split (Keep This). See SXEmacs Window, for more information about windows.

Un-Split (Keep This)
     If the frame contains multiple windows, it will remove all windows except the selected one.

Un-Split (Keep Others)
     If the frame contains multiple windows, it will remove the selected window and keep the other one.

Revert Buffer <buffername>
     If you do not wish to save the changes you made to the file since you opened it, select this option. It will restore the last saved version of the file to the current buffer.

Kill Buffer <buffername>
     It will kill the current buffer. If will prompt you if there are unsaved changes.

Exit Emacs
     It will kill the Emacs process as opposed to simply killing the buffer. Before it kills the process, it will prompt you as to which unsaved buffers you wish to save by going through the list of the buffers.

The Edit Menu
-------------

Most of the commands in this menu work on a block of text or a selected region. The text will be highlighted as you select it.

Undo
     Undoes the previous command.  If you type something by mistake you can use this command. For example, if you select Insert File... from the File menu and insert a wrong file by mistake, you can select this item and it will remove the inserted file. It undoes a batch of text which is worth an emacs command.

Cut
     Removes the selected text block from the current buffer, makes it the X clipboard selection, and places it in the kill ring (see Moving Text). Before executing this command, you have to select a region using Emacs region selection commands or with the mouse. See Selecting Text.

Copy
     Makes a selected text block the X clipboard selection, and places it in the kill ring.  You can select text using one of the Emacs region selection commands or by selecting a text region with the mouse. See Selecting Text, for more information.

Paste
     Inserts the current value of the X clipboard selection in the current buffer.  Note that this is not necessarily the same as the Emacs yank command, because the Emacs kill ring and the X clipboard selection are not the same thing.  You can paste in text you have placed in the clipboard using Copy or Cut.  You can also use Paste to insert text that was pasted into the clipboard from other applications. See X Clipboard Selection (SXEmacs User's Manual), for information on using Clipboard Selection.

Clear
     Removes the selected text block from the current buffer but does not place it in the kill ring or the X clipboard selection. You will not be able to get this text back.

Start Macro Recording
     After selecting this, Emacs will remember every keystroke you type until End Macro Recording is selected.

End Macro Recording
     Selecting this tells emacs to stop remembering your keystrokes.

Execute Last Macro
     Selecting this item will cause emacs to re-interpret all of the keystrokes which were saved between selections of the Start Macro Recording and End Macro Recording menu items.  You can now execute the most recent keyboard macro. See Keyboard Macros (SXEmacs User's Manual), for further information.

The Options Menu
----------------

There are sub-menus for some of the menus which you will need to select. If sub-menus exist for an item, they will be displayed automatically when you drag the mouse on that item. The items in this menu provide some fancy editing operations.

Read Only
     Selecting this item will cause the buffer to visit the file in a read-only mode. Changes to the file will not be allowed.

Case Sensitive Search
     Selecting this item will cause searches to be case-sensitive. If its not selected then searches will ignore case. This option is local to the buffer. For example, if this item is selected and you are searching for Smile, then an occurrence of smile will not be recognized because of the smaller case of s.

Overstrike
     After selecting this item, when you type letters they will replace existing text on a one-to-one basis, rather than pushing it to the right. At the end of a line, such characters extend the line. Before a tab, such characters insert until the tab is filled in.

Auto Delete Selection
     Selecting this item will cause automatic deletion of the selected region. After you select a region and hit the RET key, the selected text will be deleted. The typed text will replace the selection if the selection is active (i.e. if its highlighted). If the option is not selected then the typed text is just inserted at the cursor.

Teach Extended Commands
     After you  select this item, any time you execute a command with M-x which has a shorter keybinding, you will be shown the alternate binding before the command executes. For example if you type M-x find-file-other-window which performs the same function as the Open in Other Window... in File menu you will see the following message:

          M-x find-file-other-window (bound to keys: C-x 4 f, C-x 4 C-f)

Syntax Highlighting
     You can customize your init.el file to include the font-lock mode so that when you select this item, the comments will be displayed in one face, strings in another, reserved words in another, and so on. See Customization (SXEmacs User's Manual), for more information on customizing init.el file.  After selecting this item, you will find your code a lot easier to read. When Fonts is selected, different parts of the program will appear in different Fonts. When Colors is selected, then the program will be displayed in different colors. Selecting None causes the program to appear in just one Font and Color. Selecting Less resets the Fonts and Colors to a fast, minimal set of decorations. Selecting More resets the Fonts and Colors to a larger set of decorations. For example, if Less is selected (which is the default setting) then you might have all comments in green color. It does not matter what the comments contain. Whereas, if More is selected then a function name in the comments themselves might appear in a different Color or Font. Even though the comments themselves might appear in green color, a function name within the comments might appear in red color.

Paren Highlighting
     After selecting Blink from this item, if you place the cursor on a parenthesis, the matching parenthesis will blink. If you select Highlight and place the cursor on a parenthesis, the whole expression of the parenthesis under the cursor will be highlighted. Selecting None will turn off the options (regarding Paren Highlighting) which you had selected earlier.

Font
     You can select any Font for your program by choosing from one of the available Fonts. The whole buffer will be converted to the Font you select.

Size
     You can select any size for the text in your buffer (ranging from 2 to 24) by selecting the appropriate option.

Weight
     You can choose either Bold or Medium for the weight of the text of your buffer.

Buffers Menu Length...
     Prompts you for the number of buffers to display. Then it will display that number of most recently selected buffers.

Buffers Sub-Menus
     After selection of this item the Buffers menu will contain several commands, as submenus of each buffer line. If this item is unselected, then there are no submenus for each buffer line, the only command available will be selecting that buffer.

Save Options
     Selecting this item will save the current settings of your Options menu to your init.el file so that the next time you start SXEmacs, you won't need to select the options again.

The Buffers Menu
----------------

The Buffers menu provides a selection of up to ten buffers and the item List All Buffers, which provides a Buffer List. If you select Buffers Sub-menus from the Options menu, you will get some sub-menus for each of the buffer listing.

The Help Menu
-------------

The Help Menu gives you access to Emacs Info and provides a menu equivalent for some of the choices you have when using C-h. See Help, for more information.

The Describe variable and Describe function will provide documentation for the corresponding variable or function. The Help menu also gives access to UNIX online manual pages via the UNIX Manual... option.