This is ../info/emacs, produced by makeinfo version 4.3 from emacs.texi. This is the Fourteenth edition of the `GNU Emacs Manual', updated for Emacs version 21.3. INFO-DIR-SECTION Emacs START-INFO-DIR-ENTRY * Emacs: (emacs). The extensible self-documenting text editor. END-INFO-DIR-ENTRY Published by the Free Software Foundation 59 Temple Place, Suite 330 Boston, MA 02111-1307 USA Copyright (C) 1985,1986,1987,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being "The GNU Manifesto", "Distribution" and "GNU GENERAL PUBLIC LICENSE", with the Front-Cover texts being "A GNU Manual," and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled "GNU Free Documentation License." (a) The FSF's Back-Cover Text is: "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development."  File: emacs, Node: Kill Buffer, Next: Several Buffers, Prev: Misc Buffer, Up: Buffers Killing Buffers =============== If you continue an Emacs session for a while, you may accumulate a large number of buffers. You may then find it convenient to "kill" the buffers you no longer need. On most operating systems, killing a buffer releases its space back to the operating system so that other programs can use it. Here are some commands for killing buffers: `C-x k BUFNAME ' Kill buffer BUFNAME (`kill-buffer'). `M-x kill-some-buffers' Offer to kill each buffer, one by one. `C-x k' (`kill-buffer') kills one buffer, whose name you specify in the minibuffer. The default, used if you type just in the minibuffer, is to kill the current buffer. If you kill the current buffer, another buffer becomes current: one that was current in the recent past but is not displayed in any window now. If you ask to kill a file-visiting buffer that is modified (has unsaved editing), then you must confirm with `yes' before the buffer is killed. The command `M-x kill-some-buffers' asks about each buffer, one by one. An answer of `y' means to kill the buffer. Killing the current buffer or a buffer containing unsaved changes selects a new buffer or asks for confirmation just like `kill-buffer'. The buffer menu feature (*note Several Buffers::) is also convenient for killing various buffers. If you want to do something special every time a buffer is killed, you can add hook functions to the hook `kill-buffer-hook' (*note Hooks::). If you run one Emacs session for a period of days, as many people do, it can fill up with buffers that you used several days ago. The command `M-x clean-buffer-list' is a convenient way to purge them; it kills all the unmodified buffers that you have not used for a long time. An ordinary buffer is killed if it has not been displayed for three days; however, you can specify certain buffers that should never be killed automatically, and others that should be killed if they have been unused for a mere hour. You can also have this buffer purging done for you, every day at midnight, by enabling Midnight mode. Midnight mode operates each day at midnight; at that time, it runs `clean-buffer-list', or whichever functions you have placed in the normal hook `midnight-hook' (*note Hooks::). To enable Midnight mode, use the Customization buffer to set the variable `midnight-mode' to `t'. *Note Easy Customization::.  File: emacs, Node: Several Buffers, Next: Indirect Buffers, Prev: Kill Buffer, Up: Buffers Operating on Several Buffers ============================ The "buffer-menu" facility is like a "Dired for buffers"; it allows you to request operations on various Emacs buffers by editing an Emacs buffer containing a list of them. You can save buffers, kill them (here called "deleting" them, for consistency with Dired), or display them. `M-x buffer-menu' Begin editing a buffer listing all Emacs buffers. The command `buffer-menu' writes a list of all Emacs buffers into the buffer `*Buffer List*', and selects that buffer in Buffer Menu mode. The buffer is read-only, and can be changed only through the special commands described in this section. The usual Emacs cursor motion commands can be used in the `*Buffer List*' buffer. The following commands apply to the buffer described on the current line. `d' Request to delete (kill) the buffer, then move down. The request shows as a `D' on the line, before the buffer name. Requested deletions take place when you type the `x' command. `C-d' Like `d' but move up afterwards instead of down. `s' Request to save the buffer. The request shows as an `S' on the line. Requested saves take place when you type the `x' command. You may request both saving and deletion for the same buffer. `x' Perform previously requested deletions and saves. `u' Remove any request made for the current line, and move down. `' Move to previous line and remove any request made for that line. The `d', `C-d', `s' and `u' commands to add or remove flags also move down (or up) one line. They accept a numeric argument as a repeat count. These commands operate immediately on the buffer listed on the current line: `~' Mark the buffer "unmodified." The command `~' does this immediately when you type it. `%' Toggle the buffer's read-only flag. The command `%' does this immediately when you type it. `t' Visit the buffer as a tags table. *Note Select Tags Table::. There are also commands to select another buffer or buffers: `q' Quit the buffer menu--immediately display the most recent formerly visible buffer in its place. `' `f' Immediately select this line's buffer in place of the `*Buffer List*' buffer. `o' Immediately select this line's buffer in another window as if by `C-x 4 b', leaving `*Buffer List*' visible. `C-o' Immediately display this line's buffer in another window, but don't select the window. `1' Immediately select this line's buffer in a full-screen window. `2' Immediately set up two windows, with this line's buffer in one, and the previously current buffer (aside from the buffer `*Buffer List*') in the other. `b' Bury the buffer listed on this line. `m' Mark this line's buffer to be displayed in another window if you exit with the `v' command. The request shows as a `>' at the beginning of the line. (A single buffer may not have both a delete request and a display request.) `v' Immediately select this line's buffer, and also display in other windows any buffers previously marked with the `m' command. If you have not marked any buffers, this command is equivalent to `1'. All that `buffer-menu' does directly is create and switch to a suitable buffer, and turn on Buffer Menu mode. Everything else described above is implemented by the special commands provided in Buffer Menu mode. One consequence of this is that you can switch from the `*Buffer List*' buffer to another Emacs buffer, and edit there. You can reselect the `*Buffer List*' buffer later, to perform the operations already requested, or you can kill it, or pay no further attention to it. The only difference between `buffer-menu' and `list-buffers' is that `buffer-menu' switches to the `*Buffer List*' buffer in the selected window; `list-buffers' displays it in another window. If you run `list-buffers' (that is, type `C-x C-b') and select the buffer list manually, you can use all of the commands described here. The buffer `*Buffer List*' is not updated automatically when buffers are created and killed; its contents are just text. If you have created, deleted or renamed buffers, the way to update `*Buffer List*' to show what you have done is to type `g' (`revert-buffer') or repeat the `buffer-menu' command.  File: emacs, Node: Indirect Buffers, Next: Buffer Convenience, Prev: Several Buffers, Up: Buffers Indirect Buffers ================ An "indirect buffer" shares the text of some other buffer, which is called the "base buffer" of the indirect buffer. In some ways it is the analogue, for buffers, of a symbolic link between files. `M-x make-indirect-buffer BASE-BUFFER INDIRECT-NAME ' Create an indirect buffer named INDIRECT-NAME whose base buffer is BASE-BUFFER. `M-x clone-indirect-buffer ' Create an indirect buffer that is a twin copy of the current buffer. `C-x 4 c' Create an indirect buffer that is a twin copy of the current buffer, and select it in another window (`clone-indirect-buffer-other-window'). The text of the indirect buffer is always identical to the text of its base buffer; changes made by editing either one are visible immediately in the other. But in all other respects, the indirect buffer and its base buffer are completely separate. They have different names, different values of point, different narrowing, different markers, different major modes, and different local variables. An indirect buffer cannot visit a file, but its base buffer can. If you try to save the indirect buffer, that actually works by saving the base buffer. Killing the base buffer effectively kills the indirect buffer, but killing an indirect buffer has no effect on its base buffer. One way to use indirect buffers is to display multiple views of an outline. *Note Outline Views::. A quick and handy way to make an indirect buffer is with the command `M-x clone-indirect-buffer'. It creates and selects an indirect buffer whose base buffer is the current buffer. With a numeric argument, it prompts for the name of the indirect buffer; otherwise it defaults to the name of the current buffer, modifying it by adding a `' prefix if required. `C-x 4 c' (`clone-indirect-buffer-other-window') works like `M-x clone-indirect-buffer', but it selects the cloned buffer in another window. These commands come in handy if you want to create new `*info*' or `*Help*' buffers, for example. The more general way is with the command `M-x make-indirect-buffer'. It creates an indirect buffer from buffer BASE-BUFFER, under the name INDIRECT-NAME. It prompts for both BASE-BUFFER and INDIRECT-NAME using the minibuffer.  File: emacs, Node: Buffer Convenience, Prev: Indirect Buffers, Up: Buffers Convenience Features and Customization of Buffer Handling ========================================================= This section describes several modes and features that make it more convenient to switch between buffers. * Menu: * Uniquify:: Buffer names can contain directory parts. * Iswitchb:: Switching between buffers with substrings. * Buffer Menus:: Configurable buffer menu.  File: emacs, Node: Uniquify, Next: Iswitchb, Up: Buffer Convenience Making Buffer Names Unique -------------------------- When several buffers visit identically-named files, Emacs must give the buffers distinct names. The usual method for making buffer names unique adds `<2>', `<3>', etc. to the end of the buffer names (all but one of them). Other methods work by adding parts of each file's directory to the buffer name. To select one, customize the variable `uniquify-buffer-name-style' (*note Easy Customization::). For instance, the `forward' naming method puts part of the directory name at the beginning of the buffer name; using this method, buffers visiting `/u/mernst/tmp/Makefile' and `/usr/projects/zaphod/Makefile' would be named `tmp/Makefile' and `zaphod/Makefile', respectively (instead of `Makefile' and `Makefile<2>'). By contrast, the `post-forward' naming method would call the buffers `Makefile|tmp' and `Makefile|zaphod', and the `reverse' naming method would call them `Makefile\tmp' and `Makefile\zaphod'. The nontrivial difference between `post-forward' and `reverse' occurs when just one directory name is not enough to distinguish two files; then `reverse' puts the directory names in reverse order, so that `/top/middle/file' becomes `file\middle\top', while `post-forward' puts them in forward order after the file name, as in `file|top/middle'. Which rule to follow for putting the directory names in the buffer name is not very important if you are going to _look_ at the buffer names before you type one. But as an experienced user, if you know the rule, you won't have to look. And then you may find that one rule or another is easier for you to remember and utilize fast.  File: emacs, Node: Iswitchb, Next: Buffer Menus, Prev: Uniquify, Up: Buffer Convenience Switching Between Buffers using Substrings ------------------------------------------ Iswitchb global minor mode provides convenient switching between buffers using substrings of their names. It replaces the normal definitions of `C-x b', `C-x 4 b', `C-x 5 b', and `C-x 4 C-o' with alternative commands that are somewhat "smarter." When one of these commands prompts you for a buffer name, you can type in just a substring of the name you want to choose. As you enter the substring, Iswitchb mode continuously displays a list of buffers that match the substring you have typed. At any time, you can type to select the first buffer in the list. So the way to select a particular buffer is to make it the first in the list. There are two ways to do this. You can type more of the buffer name and thus narrow down the list, excluding unwanted buffers above the desired one. Alternatively, you can use `C-s' and `C-r' to rotate the list until the desired buffer is first. while entering the buffer name performs completion on the string you have entered, based on the displayed list of buffers. To enable Iswitchb mode, type `M-x iswitchb-mode', or customize the variable `iswitchb-mode' to `t' (*note Easy Customization::).  File: emacs, Node: Buffer Menus, Prev: Iswitchb, Up: Buffer Convenience Customizing Buffer Menus ------------------------ `M-x bs-show' Make a list of buffers similarly to `M-x list-buffers' but customizable. `M-x bs-show' pops up a buffer list similar to the one normally displayed by `C-x C-b' but which you can customize. If you prefer this to the usual buffer list, you can bind this command to `C-x C-b'. To customize this buffer list, use the `bs' Custom group (*note Easy Customization::). MSB global minor mode ("MSB" stands for "mouse select buffer") provides a different and customizable mouse buffer menu which you may prefer. It replaces the bindings of `mouse-buffer-menu', normally on `C-Down-Mouse-1', and the menu bar buffer menu. You can customize the menu in the `msb' Custom group.  File: emacs, Node: Windows, Next: Frames, Prev: Buffers, Up: Top Multiple Windows **************** Emacs can split a frame into two or many windows. Multiple windows can display parts of different buffers, or different parts of one buffer. Multiple frames always imply multiple windows, because each frame has its own set of windows. Each window belongs to one and only one frame. * Menu: * Basic Window:: Introduction to Emacs windows. * Split Window:: New windows are made by splitting existing windows. * Other Window:: Moving to another window or doing something to it. * Pop Up Window:: Finding a file or buffer in another window. * Force Same Window:: Forcing certain buffers to appear in the selected window rather than in another window. * Change Window:: Deleting windows and changing their sizes. * Window Convenience:: Convenience functions for window handling.  File: emacs, Node: Basic Window, Next: Split Window, Up: Windows Concepts of Emacs Windows ========================= Each Emacs window displays one Emacs buffer at any time. A single buffer may appear in more than one window; if it does, any changes in its text are displayed in all the windows where it appears. But the windows showing the same buffer can show different parts of it, because each window has its own value of point. At any time, one of the windows is the "selected window"; the buffer this window is displaying is the current buffer. The terminal's cursor shows the location of point in this window. Each other window has a location of point as well, but since the terminal has only one cursor there is no way to show where those locations are. When multiple frames are visible in X, each frame has a cursor which appears in the frame's selected window. The cursor in the selected frame is solid; the cursor in other frames is a hollow box. Commands to move point affect the value of point for the selected Emacs window only. They do not change the value of point in any other Emacs window, even one showing the same buffer. The same is true for commands such as `C-x b' to change the current buffer in the selected window; they do not affect other windows at all. However, there are other commands such as `C-x 4 b' that select a different window and switch buffers in it. Also, all commands that display information in a window, including (for example) `C-h f' (`describe-function') and `C-x C-b' (`list-buffers'), work by switching buffers in a nonselected window without affecting the selected window. When multiple windows show the same buffer, they can have different regions, because they can have different values of point. However, they all have the same value for the mark, because each buffer has only one mark position. Each window has its own mode line, which displays the buffer name, modification status and major and minor modes of the buffer that is displayed in the window. *Note Mode Line::, for full details on the mode line.  File: emacs, Node: Split Window, Next: Other Window, Prev: Basic Window, Up: Windows Splitting Windows ================= `C-x 2' Split the selected window into two windows, one above the other (`split-window-vertically'). `C-x 3' Split the selected window into two windows positioned side by side (`split-window-horizontally'). `C-Mouse-2' In the mode line or scroll bar of a window, split that window. The command `C-x 2' (`split-window-vertically') breaks the selected window into two windows, one above the other. Both windows start out displaying the same buffer, with the same value of point. By default the two windows each get half the height of the window that was split; a numeric argument specifies how many lines to give to the top window. `C-x 3' (`split-window-horizontally') breaks the selected window into two side-by-side windows. A numeric argument specifies how many columns to give the one on the left. A line of vertical bars separates the two windows. Windows that are not the full width of the screen have mode lines, but they are truncated. On terminals where Emacs does not support highlighting, truncated mode lines sometimes do not appear in inverse video. You can split a window horizontally or vertically by clicking `C-Mouse-2' in the mode line or the scroll bar. (This does not work in scroll bars implemented by X toolkits.) The line of splitting goes through the place where you click: if you click on the mode line, the new scroll bar goes above the spot; if you click in the scroll bar, the mode line of the split window is side by side with your click. When a window is less than the full width, text lines too long to fit are frequent. Continuing all those lines might be confusing. The variable `truncate-partial-width-windows' can be set non-`nil' to force truncation in all windows less than the full width of the screen, independent of the buffer being displayed and its value for `truncate-lines'. *Note Continuation Lines::. Horizontal scrolling is often used in side-by-side windows. *Note Display::. If `split-window-keep-point' is non-`nil', the default, both of the windows resulting from `C-x 2' inherit the value of point from the window that was split. This means that scrolling is inevitable. If this variable is `nil', then `C-x 2' tries to avoid scrolling the text currently visible on the screen, by putting point in each window at a position already visible in the window. It also selects whichever window contain the screen line that the cursor was previously on. Some users prefer the latter mode on slow terminals.  File: emacs, Node: Other Window, Next: Pop Up Window, Prev: Split Window, Up: Windows Using Other Windows =================== `C-x o' Select another window (`other-window'). That is `o', not zero. `C-M-v' Scroll the next window (`scroll-other-window'). `M-x compare-windows' Find next place where the text in the selected window does not match the text in the next window. `Mouse-1' `Mouse-1', in a window's mode line, selects that window but does not move point in it (`mouse-select-window'). To select a different window, click with `Mouse-1' on its mode line. With the keyboard, you can switch windows by typing `C-x o' (`other-window'). That is an `o', for "other," not a zero. When there are more than two windows, this command moves through all the windows in a cyclic order, generally top to bottom and left to right. After the rightmost and bottommost window, it goes back to the one at the upper left corner. A numeric argument means to move several steps in the cyclic order of windows. A negative argument moves around the cycle in the opposite order. When the minibuffer is active, the minibuffer is the last window in the cycle; you can switch from the minibuffer window to one of the other windows, and later switch back and finish supplying the minibuffer argument that is requested. *Note Minibuffer Edit::. The usual scrolling commands (*note Display::) apply to the selected window only, but there is one command to scroll the next window. `C-M-v' (`scroll-other-window') scrolls the window that `C-x o' would select. It takes arguments, positive and negative, like `C-v'. (In the minibuffer, `C-M-v' scrolls the window that contains the minibuffer help display, if any, rather than the next window in the standard cyclic order.) The command `M-x compare-windows' lets you compare two files or buffers visible in two windows, by moving through them to the next mismatch. *Note Comparing Files::, for details.  File: emacs, Node: Pop Up Window, Next: Force Same Window, Prev: Other Window, Up: Windows Displaying in Another Window ============================ `C-x 4' is a prefix key for commands that select another window (splitting the window if there is only one) and select a buffer in that window. Different `C-x 4' commands have different ways of finding the buffer to select. `C-x 4 b BUFNAME ' Select buffer BUFNAME in another window. This runs `switch-to-buffer-other-window'. `C-x 4 C-o BUFNAME ' Display buffer BUFNAME in another window, but don't select that buffer or that window. This runs `display-buffer'. `C-x 4 f FILENAME ' Visit file FILENAME and select its buffer in another window. This runs `find-file-other-window'. *Note Visiting::. `C-x 4 d DIRECTORY ' Select a Dired buffer for directory DIRECTORY in another window. This runs `dired-other-window'. *Note Dired::. `C-x 4 m' Start composing a mail message in another window. This runs `mail-other-window'; its same-window analogue is `C-x m' (*note Sending Mail::). `C-x 4 .' Find a tag in the current tags table, in another window. This runs `find-tag-other-window', the multiple-window variant of `M-.' (*note Tags::). `C-x 4 r FILENAME ' Visit file FILENAME read-only, and select its buffer in another window. This runs `find-file-read-only-other-window'. *Note Visiting::.  File: emacs, Node: Force Same Window, Next: Change Window, Prev: Pop Up Window, Up: Windows Forcing Display in the Same Window ================================== Certain Emacs commands switch to a specific buffer with special contents. For example, `M-x shell' switches to a buffer named `*Shell*'. By convention, all these commands are written to pop up the buffer in a separate window. But you can specify that certain of these buffers should appear in the selected window. If you add a buffer name to the list `same-window-buffer-names', the effect is that such commands display that particular buffer by switching to it in the selected window. For example, if you add the element `"*grep*"' to the list, the `grep' command will display its output buffer in the selected window. The default value of `same-window-buffer-names' is not `nil': it specifies buffer names `*info*', `*mail*' and `*shell*' (as well as others used by more obscure Emacs packages). This is why `M-x shell' normally switches to the `*shell*' buffer in the selected window. If you delete this element from the value of `same-window-buffer-names', the behavior of `M-x shell' will change--it will pop up the buffer in another window instead. You can specify these buffers more generally with the variable `same-window-regexps'. Set it to a list of regular expressions; then any buffer whose name matches one of those regular expressions is displayed by switching to it in the selected window. (Once again, this applies only to buffers that normally get displayed for you in a separate window.) The default value of this variable specifies Telnet and rlogin buffers. An analogous feature lets you specify buffers which should be displayed in their own individual frames. *Note Special Buffer Frames::.  File: emacs, Node: Change Window, Next: Window Convenience, Prev: Force Same Window, Up: Windows Deleting and Rearranging Windows ================================ `C-x 0' Delete the selected window (`delete-window'). The last character in this key sequence is a zero. `C-x 1' Delete all windows in the selected frame except the selected window (`delete-other-windows'). `C-x 4 0' Delete the selected window and kill the buffer that was showing in it (`kill-buffer-and-window'). The last character in this key sequence is a zero. `C-x ^' Make selected window taller (`enlarge-window'). `C-x }' Make selected window wider (`enlarge-window-horizontally'). `C-x {' Make selected window narrower (`shrink-window-horizontally'). `C-x -' Shrink this window if its buffer doesn't need so many lines (`shrink-window-if-larger-than-buffer'). `C-x +' Make all windows the same height (`balance-windows'). `Drag-Mouse-1' Dragging a window's mode line up or down with `Mouse-1' changes window heights. `Mouse-2' `Mouse-2' in a window's mode line deletes all other windows in the frame (`mouse-delete-other-windows'). `Mouse-3' `Mouse-3' in a window's mode line deletes that window (`mouse-delete-window'), unless the frame has only one window, in which case it buries the current buffer instead and switches to another buffer. To delete a window, type `C-x 0' (`delete-window'). (That is a zero.) The space occupied by the deleted window is given to an adjacent window (but not the minibuffer window, even if that is active at the time). Once a window is deleted, its attributes are forgotten; only restoring a window configuration can bring it back. Deleting the window has no effect on the buffer it used to display; the buffer continues to exist, and you can select it in any window with `C-x b'. `C-x 4 0' (`kill-buffer-and-window') is a stronger command than `C-x 0'; it kills the current buffer and then deletes the selected window. `C-x 1' (`delete-other-windows') is more powerful in a different way; it deletes all the windows except the selected one (and the minibuffer); the selected window expands to use the whole frame except for the echo area. You can also delete a window by clicking on its mode line with `Mouse-2', and delete all the windows in a frame except one window by clicking on that window's mode line with `Mouse-3'. The easiest way to adjust window heights is with a mouse. If you press `Mouse-1' on a mode line, you can drag that mode line up or down, changing the heights of the windows above and below it. To readjust the division of space among vertically adjacent windows, use `C-x ^' (`enlarge-window'). It makes the currently selected window get one line bigger, or as many lines as is specified with a numeric argument. With a negative argument, it makes the selected window smaller. `C-x }' (`enlarge-window-horizontally') makes the selected window wider by the specified number of columns. `C-x {' (`shrink-window-horizontally') makes the selected window narrower by the specified number of columns. When you make a window bigger, the space comes from one of its neighbors. If this makes any window too small, it is deleted and its space is given to an adjacent window. The minimum size is specified by the variables `window-min-height' and `window-min-width'. The command `C-x -' (`shrink-window-if-larger-than-buffer') reduces the height of the selected window, if it is taller than necessary to show the whole text of the buffer it is displaying. It gives the extra lines to other windows in the frame. You can also use `C-x +' (`balance-windows') to even out the heights of all the windows in the selected frame.  File: emacs, Node: Window Convenience, Prev: Change Window, Up: Windows Window Handling Convenience Features and Customization ====================================================== `M-x winner-mode' is a global minor mode that records the changes in the window configuration (i.e. how the frames are partitioned into windows), so that you can "undo" them. To undo, use `C-x left' (`winner-undo'). If you change your mind while undoing, you can redo the changes you had undone using `C-x right' (`M-x winner-redo'). Another way to enable Winner mode is by customizing the variable `winner-mode'. The Windmove commands move directionally between neighboring windows in a frame. `M-x windmove-right' selects the window immediately to the right of the currently selected one, and similarly for the "left," "up," and "down" counterparts. `M-x windmove-default-keybindings' binds these commands to `S-right' etc. (Not all terminals support shifted arrow keys, however.) Follow minor mode (`M-x follow-mode') synchronizes several windows on the same buffer so that they always display adjacent sections of that buffer. *Note Follow Mode::. `M-x scroll-all-mode' provides commands to scroll all visible windows together. You can also turn it on by customizing the variable `scroll-all-mode'. The commands provided are `M-x scroll-all-scroll-down-all', `M-x scroll-all-page-down-all' and their corresponding "up" equivalents. To make this mode useful, you should bind these commands to appropriate keys.  File: emacs, Node: Frames, Next: International, Prev: Windows, Up: Top Frames and X Windows ******************** When using the X Window System, you can create multiple windows at the X level in a single Emacs session. Each X window that belongs to Emacs displays a "frame" which can contain one or several Emacs windows. A frame initially contains a single general-purpose Emacs window which you can subdivide vertically or horizontally into smaller windows. A frame normally contains its own echo area and minibuffer, but you can make frames that don't have these--they use the echo area and minibuffer of another frame. Editing you do in one frame also affects the other frames. For instance, if you put text in the kill ring in one frame, you can yank it in another frame. If you exit Emacs through `C-x C-c' in one frame, it terminates all the frames. To delete just one frame, use `C-x 5 0' (that is zero, not `o'). To avoid confusion, we reserve the word "window" for the subdivisions that Emacs implements, and never use it to refer to a frame. Emacs compiled for MS-DOS emulates some aspects of the window system so that you can use many of the features described in this chapter. *Note MS-DOS Input::, for more information. Emacs compiled for MS Windows mostly supports the same features as under X. However, images, tool bars, and tooltips are not yet available in Emacs version 21.1 on MS-Windows. * Menu: * Mouse Commands:: Moving, cutting, and pasting, with the mouse. * Secondary Selection:: Cutting without altering point and mark. * Clipboard:: Using the clipboard for selections. * Mouse References:: Using the mouse to select an item from a list. * Menu Mouse Clicks:: Mouse clicks that bring up menus. * Mode Line Mouse:: Mouse clicks on the mode line. * Creating Frames:: Creating additional Emacs frames with various contents. * Frame Commands:: Iconifying, deleting, and switching frames. * Speedbar:: How to make and use a speedbar frame. * Multiple Displays:: How one Emacs job can talk to several displays. * Special Buffer Frames:: You can make certain buffers have their own frames. * Frame Parameters:: Changing the colors and other modes of frames. * Scroll Bars:: How to enable and disable scroll bars; how to use them. * Wheeled Mice:: Using mouse wheels for scrolling. * Menu Bars:: Enabling and disabling the menu bar. * Tool Bars:: Enabling and disabling the tool bar. * Dialog Boxes:: Controlling use of dialog boxes. * Tooltips:: Showing "tooltips", AKA "balloon help" for active text. * Mouse Avoidance:: Moving the mouse pointer out of the way. * Non-Window Terminals:: Multiple frames on terminals that show only one. * XTerm Mouse:: Using the mouse in an XTerm terminal emulator.  File: emacs, Node: Mouse Commands, Next: Secondary Selection, Up: Frames Mouse Commands for Editing ========================== The mouse commands for selecting and copying a region are mostly compatible with the `xterm' program. You can use the same mouse commands for copying between Emacs and other X client programs. If you select a region with any of these mouse commands, and then immediately afterward type the function key, it deletes the region that you selected. The function key and the ASCII character do not do this; if you type any other key in between the mouse command and , it does not do this. `Mouse-1' Move point to where you click (`mouse-set-point'). This is normally the left button. `Drag-Mouse-1' Set the region to the text you select by dragging, and copy it to the kill ring (`mouse-set-region'). You can specify both ends of the region with this single command. If you move the mouse off the top or bottom of the window while dragging, the window scrolls at a steady rate until you move the mouse back into the window. This way, you can select regions that don't fit entirely on the screen. The number of lines scrolled per step depends on how far away from the window edge the mouse has gone; the variable `mouse-scroll-min-lines' specifies a minimum step size. `Mouse-2' Yank the last killed text, where you click (`mouse-yank-at-click'). This is normally the middle button. `Mouse-3' This command, `mouse-save-then-kill', has several functions depending on where you click and the status of the region. The most basic case is when you click `Mouse-1' in one place and then `Mouse-3' in another. This selects the text between those two positions as the region. It also copies the new region to the kill ring, so that you can copy it to someplace else. If you click `Mouse-1' in the text, scroll with the scroll bar, and then click `Mouse-3', it remembers where point was before scrolling (where you put it with `Mouse-1'), and uses that position as the other end of the region. This is so that you can select a region that doesn't fit entirely on the screen. More generally, if you do not have a highlighted region, `Mouse-3' selects the text between point and the click position as the region. It does this by setting the mark where point was, and moving point to where you click. If you have a highlighted region, or if the region was set just before by dragging button 1, `Mouse-3' adjusts the nearer end of the region by moving it to where you click. The adjusted region's text also replaces the old region's text in the kill ring. If you originally specified the region using a double or triple `Mouse-1', so that the region is defined to consist of entire words or lines, then adjusting the region with `Mouse-3' also proceeds by entire words or lines. If you use `Mouse-3' a second time consecutively, at the same place, that kills the region already selected. `Double-Mouse-1' This key sets the region around the word which you click on. If you click on a character with "symbol" syntax (such as underscore, in C mode), it sets the region around the symbol surrounding that character. If you click on a character with open-parenthesis or close-parenthesis syntax, it sets the region around the parenthetical grouping which that character starts or ends. If you click on a character with string-delimiter syntax (such as a singlequote or doublequote in C), it sets the region around the string constant (using heuristics to figure out whether that character is the beginning or the end of it). `Double-Drag-Mouse-1' This key selects a region made up of the words you drag across. `Triple-Mouse-1' This key sets the region around the line you click on. `Triple-Drag-Mouse-1' This key selects a region made up of the lines you drag across. The simplest way to kill text with the mouse is to press `Mouse-1' at one end, then press `Mouse-3' twice at the other end. *Note Killing::. To copy the text into the kill ring without deleting it from the buffer, press `Mouse-3' just once--or just drag across the text with `Mouse-1'. Then you can copy it elsewhere by yanking it. To yank the killed or copied text somewhere else, move the mouse there and press `Mouse-2'. *Note Yanking::. However, if `mouse-yank-at-point' is non-`nil', `Mouse-2' yanks at point. Then it does not matter where you click, or even which of the frame's windows you click on. The default value is `nil'. This variable also affects yanking the secondary selection. To copy text to another X window, kill it or save it in the kill ring. Under X, this also sets the "primary selection". Then use the "paste" or "yank" command of the program operating the other window to insert the text from the selection. To copy text from another X window, use the "cut" or "copy" command of the program operating the other window, to select the text you want. Then yank it in Emacs with `C-y' or `Mouse-2'. The standard coding system for X selections is `compound-text'. To specify another coding system for X selections, use `C-x x' or `C-x X'. *Note Specify Coding::. These cutting and pasting commands also work on MS-Windows. When Emacs puts text into the kill ring, or rotates text to the front of the kill ring, it sets the "primary selection" in the X server. This is how other X clients can access the text. Emacs also stores the text in the cut buffer, but only if the text is short enough (the value of `x-cut-buffer-max' specifies the maximum number of characters); putting long strings in the cut buffer can be slow. The commands to yank the first entry in the kill ring actually check first for a primary selection in another program; after that, they check for text in the cut buffer. If neither of those sources provides text to yank, the kill ring contents are used.  File: emacs, Node: Secondary Selection, Next: Clipboard, Prev: Mouse Commands, Up: Frames Secondary Selection =================== The "secondary selection" is another way of selecting text using X. It does not use point or the mark, so you can use it to kill text without setting point or the mark. `M-Drag-Mouse-1' Set the secondary selection, with one end at the place where you press down the button, and the other end at the place where you release it (`mouse-set-secondary'). The highlighting appears and changes as you drag. You can control the appearance of the highlighting by customizing the `secondary-selection' face (*note Face Customization::). If you move the mouse off the top or bottom of the window while dragging, the window scrolls at a steady rate until you move the mouse back into the window. This way, you can mark regions that don't fit entirely on the screen. `M-Mouse-1' Set one endpoint for the "secondary selection" (`mouse-start-secondary'). `M-Mouse-3' Make a secondary selection, using the place specified with `M-Mouse-1' as the other end (`mouse-secondary-save-then-kill'). A second click at the same place kills the secondary selection just made. `M-Mouse-2' Insert the secondary selection where you click (`mouse-yank-secondary'). This places point at the end of the yanked text. Double or triple clicking of `M-Mouse-1' operates on words and lines, much like `Mouse-1'. If `mouse-yank-at-point' is non-`nil', `M-Mouse-2' yanks at point. Then it does not matter precisely where you click; all that matters is which window you click on. *Note Mouse Commands::.  File: emacs, Node: Clipboard, Next: Mouse References, Prev: Secondary Selection, Up: Frames Using the Clipboard =================== As well as the primary and secondary selection types, X supports a "clipboard" selection type which is used by some applications, particularly under OpenWindows and Gnome. The command `M-x menu-bar-enable-clipboard' makes the `Cut', `Paste' and `Copy' menu items, as well as the keys of the same names, all use the clipboard. You can customize the option `x-select-enable-clipboard' to make the Emacs yank functions consult the clipboard before the primary selection, and to make the kill functions to store in the clipboard as well as the primary selection. Otherwise they do not access the clipboard at all. Using the clipboard is the default on MS-Windows, unlike most systems.  File: emacs, Node: Mouse References, Next: Menu Mouse Clicks, Prev: Clipboard, Up: Frames Following References with the Mouse =================================== Some Emacs buffers display lists of various sorts. These include lists of files, of buffers, of possible completions, of matches for a pattern, and so on. Since yanking text into these buffers is not very useful, most of them define `Mouse-2' specially, as a command to use or view the item you click on. For example, if you click `Mouse-2' on a file name in a Dired buffer, you visit that file. If you click `Mouse-2' on an error message in the `*Compilation*' buffer, you go to the source code for that error message. If you click `Mouse-2' on a completion in the `*Completions*' buffer, you choose that completion. You can usually tell when `Mouse-2' has this special sort of meaning because the sensitive text highlights when you move the mouse over it.  File: emacs, Node: Menu Mouse Clicks, Next: Mode Line Mouse, Prev: Mouse References, Up: Frames Mouse Clicks for Menus ====================== Mouse clicks modified with the and keys bring up menus. `C-Mouse-1' This menu is for selecting a buffer. The MSB ("mouse select buffer") global minor mode makes this menu smarter and more customizable. *Note Buffer Menus::. `C-Mouse-2' This menu is for specifying faces and other text properties for editing formatted text. *Note Formatted Text::. `C-Mouse-3' This menu is mode-specific. For most modes if Menu-bar mode is on, this menu has the same items as all the mode-specific menu-bar menus put together. Some modes may specify a different menu for this button.(1) If Menu-bar mode is off, this menu contains all the items which would be present in the menu bar--not just the mode-specific ones--so that you can access them without having to display the menu bar. `S-Mouse-1' This menu is for specifying the frame's principal font. ---------- Footnotes ---------- (1) Some systems use `Mouse-3' for a mode-specific menu. We took a survey of users, and found they preferred to keep `Mouse-3' for selecting and killing regions. Hence the decision to use `C-Mouse-3' for this menu.  File: emacs, Node: Mode Line Mouse, Next: Creating Frames, Prev: Menu Mouse Clicks, Up: Frames Mode Line Mouse Commands ======================== You can use mouse clicks on window mode lines to select and manipulate windows. `Mouse-1' `Mouse-1' on a mode line selects the window above. By dragging `Mouse-1' on the mode line, you can move it, thus changing the height of the windows above and below. `Mouse-2' `Mouse-2' on a mode line expands that window to fill its frame. `Mouse-3' `Mouse-3' on a mode line deletes the window above. If the frame has only one window, it buries the current buffer instead and switches to another buffer. `C-Mouse-2' `C-Mouse-2' on a mode line splits the window above horizontally, above the place in the mode line where you click. `C-Mouse-2' on a scroll bar splits the corresponding window vertically, unless you are using an X toolkit's implementation of scroll bars. *Note Split Window::. The commands above apply to areas of the mode line which do not have special mouse bindings of their own. Some areas, such as the buffer name and the major mode name, have their own special mouse bindings. Emacs displays information about these bindings when you hold the mouse over such a place (*note Tooltips::).  File: emacs, Node: Creating Frames, Next: Frame Commands, Prev: Mode Line Mouse, Up: Frames Creating Frames =============== The prefix key `C-x 5' is analogous to `C-x 4', with parallel subcommands. The difference is that `C-x 5' commands create a new frame rather than just a new window in the selected frame (*note Pop Up Window::). If an existing visible or iconified frame already displays the requested material, these commands use the existing frame, after raising or deiconifying as necessary. The various `C-x 5' commands differ in how they find or create the buffer to select: `C-x 5 2' Create a new frame (`make-frame-command'). `C-x 5 b BUFNAME ' Select buffer BUFNAME in another frame. This runs `switch-to-buffer-other-frame'. `C-x 5 f FILENAME ' Visit file FILENAME and select its buffer in another frame. This runs `find-file-other-frame'. *Note Visiting::. `C-x 5 d DIRECTORY ' Select a Dired buffer for directory DIRECTORY in another frame. This runs `dired-other-frame'. *Note Dired::. `C-x 5 m' Start composing a mail message in another frame. This runs `mail-other-frame'. It is the other-frame variant of `C-x m'. *Note Sending Mail::. `C-x 5 .' Find a tag in the current tag table in another frame. This runs `find-tag-other-frame', the multiple-frame variant of `M-.'. *Note Tags::. `C-x 5 r FILENAME ' Visit file FILENAME read-only, and select its buffer in another frame. This runs `find-file-read-only-other-frame'. *Note Visiting::. You can control the appearance of new frames you create by setting the frame parameters in `default-frame-alist'. You can use the variable `initial-frame-alist' to specify parameters that affect only the initial frame. *Note Initial Parameters: (elisp)Initial Parameters, for more information. The easiest way to specify the principal font for all your Emacs frames is with an X resource (*note Font X::), but you can also do it by modifying `default-frame-alist' to specify the `font' parameter, as shown here: (add-to-list 'default-frame-alist '(font . "10x20")) Here's a similar example for specifying a foreground color: (add-to-list 'default-frame-alist '(background-color . "blue"))  File: emacs, Node: Frame Commands, Next: Speedbar, Prev: Creating Frames, Up: Frames Frame Commands ============== The following commands let you create, delete and operate on frames: `C-z' Iconify the selected Emacs frame (`iconify-or-deiconify-frame'). The normal meaning of `C-z', to suspend Emacs, is not useful under a window system, so it has a different binding in that case. If you type this command on an Emacs frame's icon, it deiconifies the frame. `C-x 5 0' Delete the selected frame (`delete-frame'). This is not allowed if there is only one frame. `C-x 5 o' Select another frame, raise it, and warp the mouse to it so that it stays selected. If you repeat this command, it cycles through all the frames on your terminal. `C-x 5 1' Delete all frames except the selected one.