Frames and Graphical Displays
When Emacs is started on a graphical display, e.g., on the X Window System, it occupies a graphical system-level display region. In this manual, we call this a frame, reserving the word "window" for the part of the frame used for displaying a buffer. A frame initially contains one window, but it can be subdivided into multiple windows (Windows). A frame normally also contains a menu bar, tool bar, and echo area. You can also create additional frames (Creating Frames). All frames created in the same Emacs session have access to the same underlying buffers and other data. For instance, if a buffer is being shown in more than one frame, any changes made to it in one frame show up immediately in the other frames too. Typing C-x C-c closes all the frames on the current display, and ends the Emacs session if it has no frames open on any other displays (Exiting). To close just the selected frame, type C-x 5 0 (that is zero, not o). This chapter describes Emacs features specific to graphical displays (particularly mouse commands), and features for managing multiple frames. On text terminals, many of these features are unavailable. However, it is still possible to create multiple frames on text terminals; such frames are displayed one at a time, filling the entire terminal screen (Text Terminals). It is also possible to use the mouse on some text terminals (Text-Only Mouse, for doing so on GNU and Unix systems; and MS-DOS Mouse, for doing so on MS-DOS). Menus are supported on all text terminals.
Mouse Commands for Editing
-
mouse-1 - Move point to where you click (
mouse-set-point). -
Drag-mouse-1 - Activate the region around the text selected by dragging, and put the text in the primary selection (
mouse-set-region). -
mouse-2 - Move point to where you click, and insert the contents of the primary selection there (
mouse-yank-primary). -
mouse-3 - If the region is active, move the nearer end of the region to the click position; otherwise, set mark at the current value of point and point at the click position. Save the resulting region in the kill ring; on a second click, kill it (
mouse-save-then-kill). -
C-M-mouse-1 - Activate a rectangular region around the text selected by dragging. Rectangles.
The most basic mouse command is mouse-set-point, which is invoked by clicking with the left mouse button, mouse-1, in the text area of a window. This moves point to the position where you clicked. If that window was not the selected window, it becomes the selected window. You can also activate a region by double-clicking mouse-1 (Word and Line Mouse). Normally, if the frame you clicked in was not the selected frame, it is made the selected frame, in addition to selecting the window and setting the cursor. On the X Window System, you can change this by setting the variable x-mouse-click-focus-ignore-position to t. In that case, the initial click on an unselected frame just selects the frame, without doing anything else; clicking again selects the window and sets the cursor position. Holding down mouse-1 and dragging the mouse over a stretch of text activates the region around that text (mouse-set-region), placing the mark where you started holding down the mouse button, and point where you release it (Mark). In addition, the text in the region becomes the primary selection (Primary Selection). If you change the variable mouse-drag-copy-region to a non-nil value, dragging the mouse over a stretch of text also adds the text to the kill ring. The default is nil. If this variable is non-empty, only copy to the kill ring if the region is non-empty. For instance, if you mouse drag an area that is less than a half a character, you'd normally get the empty string in your kill ring, but with non-empty, this short mouse drag won't affect the kill ring. 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. If you enable the option mouse-drag-mode-line-buffer and dragging files is supported by the window system, then dragging the mouse on the buffer name portion of the mode line will drag that buffer's file to another program or frame. Clicking with the middle mouse button, mouse-2, moves point to the position where you clicked and inserts the contents of the primary selection (mouse-yank-primary). Primary Selection. This behavior is consistent with other X applications. Alternatively, you can rebind mouse-2 to mouse-yank-at-click, which performs a yank at the position you click. If you change the variable mouse-yank-at-point to a non-nil value, mouse-2 does not move point; it inserts the text at point, regardless of where you clicked or even which of the frame's windows you clicked on. This variable affects both mouse-yank-primary and mouse-yank-at-click. Clicking with the right mouse button, mouse-3, runs the command mouse-save-then-kill. This performs several actions depending on where you click and the status of the region:
- If no region is active, clicking
mouse-3activates the region, placing the mark where point was and point at the clicked position. - If a region is active, clicking
mouse-3adjusts the nearer end of the region by moving it to the clicked position. The adjusted region's text is copied to the kill ring; if the text in the original region was already on the kill ring, it replaces it there. - 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 (Word and Line Mouse), then adjusting the region withmouse-3also proceeds by entire words or lines. - If you use
mouse-3a second time consecutively, at the same place, that kills the region already selected. Thus, the simplest way to kill text with the mouse is to clickmouse-1at one end, then clickmouse-3twice at the other end. To copy the text into the kill ring without deleting it from the buffer, pressmouse-3just once—or just drag across the text withmouse-1. Then you can copy it elsewhere by yanking it.
The mouse-save-then-kill command also obeys the variable mouse-drag-copy-region (described above). If the value is non-nil, then whenever the command sets or adjusts the active region, the text in the region is also added to the kill ring. If the latest kill ring entry had been added the same way, that entry is replaced rather than making a new entry. Whenever you set the region using any of the mouse commands described above, the mark will be deactivated by any subsequent unshifted cursor motion command, in addition to the usual ways of deactivating the mark. Shift Selection. Some mice have a "wheel" which can be used for scrolling. Emacs supports scrolling windows with the mouse wheel, by default, on most graphical displays. To toggle this feature, use M-x mouse-wheel-mode. The variables mouse-wheel-follow-mouse and mouse-wheel-scroll-amount determine where and by how much buffers are scrolled. The variable mouse-wheel-progressive-speed determines whether the scroll speed is linked to how fast you move the wheel. This mode also supports increasing or decreasing the font size, by default bound to scrolling with the Ctrl modifier. When this mode is enabled, mouse wheel produces special events like wheel-up and wheel-down. (Some older systems report them as mouse-4 and mouse-5.) If the mouse has a horizontal scroll wheel, it produces wheel-left and wheel-right events as well. Emacs also supports horizontal scrolling with the Shift modifier. Typing a numeric prefix arg (e.g., M-5) before starting horizontal scrolling changes its step value defined by the user option mouse-wheel-scroll-amount-horizontal. If your mouse's wheel can be tilted, or if your touchpad supports it, then you can also enable horizontal scrolling by customizing the variable mouse-wheel-tilt-scroll to a non-nil value. By default, tilting the mouse wheel scrolls the window's view horizontally in the direction of the tilt: e.g., tilting to the right scrolls the window to the right, so that the text displayed in the window moves horizontally to the left. If you'd like to reverse the direction of horizontal scrolling, customize the variable mouse-wheel-flip-direction to a non-nil value. When the mouse pointer is over an image in Image mode, Image Mode, scrolling the mouse wheel with the Ctrl modifier scales the image under the mouse pointer, and scrolling the mouse wheel with the Shift modifier scrolls the image horizontally.
Mouse Commands for Words and Lines
These variants of mouse-1 select entire words or lines at a time. Emacs activates the region around the selected text, which is also copied to the kill ring.
-
Double-mouse-1 - Select the text around the word or character which you click on. Double-clicking on a character with symbol syntax (such as underscore, in C mode) selects the symbol surrounding that character. Double-clicking on a character with open- or close-parenthesis syntax selects the parenthetical grouping which that character starts or ends. Double-clicking on a character with string-delimiter syntax (such as a single-quote or double-quote in C) selects the string constant (Emacs uses heuristics to figure out whether that character is the beginning or the end of it). Double-clicking on the beginning of a parenthetical grouping or beginning string-delimiter moves point to the end of the region, scrolling the buffer display forward if necessary to show the new location of point. Double-clicking on the end of a parenthetical grouping or end string-delimiter keeps point at the end of the region by default, so the beginning of the region will not be visible if it is above the top of the window; setting the user option
mouse-select-region-move-to-beginningto non-nilchanges this to move point to the beginning of the region, scrolling the display backward if necessary. -
Double-Drag-mouse-1 - Select the text you drag across, in units of whole words.
-
Triple-mouse-1 - Select the line you click on.
-
Triple-Drag-mouse-1 - Select the text you drag across, in units of whole lines.
Following References with the Mouse
Some Emacs buffers include buttons, or hyperlinks: pieces of text that perform some action (e.g., following a reference) when activated (e.g., by clicking on them). Usually, a button's text is visually highlighted: it is underlined, or a box is drawn around it. If you move the mouse over a button, the shape of the mouse cursor changes and the button lights up. If you change the variable mouse-highlight to nil, Emacs disables this highlighting. You can activate a button by moving point to it and typing RET, or by clicking either mouse-1 or mouse-2 on the button. For example, in a Dired buffer, each file name is a button; activating it causes Emacs to visit that file (Dired). In a *Compilation* buffer, each error message is a button, and activating it visits the source code for that error (Compilation). Although clicking mouse-1 on a button usually activates the button, if you hold the mouse button down for a period of time before releasing it (specifically, for more than 450 milliseconds), then Emacs moves point where you clicked, without activating the button. In this way, you can use the mouse to move point over a button without activating it. Dragging the mouse over or onto a button has its usual behavior of setting the region, and does not activate the button. You can change how mouse-1 applies to buttons by customizing the variable mouse-1-click-follows-link. If the value is a positive integer, that determines how long you need to hold the mouse button down for, in milliseconds, to cancel button activation; the default is 450, as described in the previous paragraph. If the value is nil, mouse-1 just sets point where you clicked, and does not activate buttons. If the value is double, double clicks activate buttons but single clicks just set point. Normally, mouse-1 on a button activates the button even if it is in a non-selected window. If you change the variable mouse-1-click-in-non-selected-windows to nil, mouse-1 on a button in an unselected window moves point to the clicked position and selects that window, without activating the button.
Mode Line Mouse Commands
You can use mouse clicks on window mode lines to select and manipulate windows. Some areas of the mode line, such as the buffer name, and major and minor mode names, have their own special mouse bindings. These areas are highlighted when you hold the mouse over them, and information about the special bindings will be displayed (Tooltips). This section's commands do not apply in those areas.
-
mouse-1 mouse-1on a mode line selects the window it belongs to. By draggingmouse-1on the mode line, you can move it, thus changing the height of the windows above and below. Changing heights with the mouse in this way never deletes windows, it just refuses to make any window smaller than the minimum height.-
mouse-2 mouse-2on a mode line expands that window to fill its frame.-
mouse-3 mouse-3on a mode line deletes the window it belongs to. If the frame has only one window, it does nothing.-
C-mouse-2 C-mouse-2on a mode line splits that window, producing two side-by-side windows with the boundary running through the click position (Split Window).
Furthermore, by clicking and dragging mouse-1 on the divider between two side-by-side mode lines, you can move the vertical boundary to the left or right. Note that resizing windows is affected by the value of window-resize-pixelwise, see Split Window.
Creating Frames
The prefix key C-x 5 is analogous to C-x 4. Whereas each C-x 4 command pops up a buffer in a different window in the selected frame (Pop Up Window), the C-x 5 commands use a different frame. If an existing visible or iconified (a.k.a. "minimized", Visibility of Frames) frame already displays the requested buffer, that frame is raised and deiconified ("un-minimized"); otherwise, a new frame is created on the current display terminal. 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 using the default frame parameters (
make-frame-command). -
C-x 5 c - Create a new frame using the window configuration and frame parameters of the current frame (
clone-frame). -
C-x 5 b bufname RET - Select buffer bufname in another frame. This runs
switch-to-buffer-other-frame. -
C-x 5 f filename RET - Visit file filename and select its buffer in another frame. This runs
find-file-other-frame. Visiting. -
C-x 5 d directory RET - Select a Dired buffer for directory directory in another frame. This runs
dired-other-frame. Dired. -
C-x 5 m - Start composing a mail message in another frame. This runs
compose-mail-other-frame. It is the other-frame variant ofC-x m. Sending Mail. -
C-x 5 . - Find the definition of an identifier in another frame. This runs
xref-find-definitions-other-frame, the multiple-frame variant ofM-.. Xref. -
C-x 5 r filename RET - Visit file filename read-only, and select its buffer in another frame. This runs
find-file-read-only-other-frame. Visiting. -
C-x 5 5 - A more general prefix command that affects the buffer displayed by a subsequent command invoked after this prefix command (
other-frame-prefix). It requests the buffer to be displayed by a subsequent command to be shown in another frame.
You can control the appearance and behavior of the newly-created frames by specifying frame parameters. Frame Parameters.
Frame Commands
The following commands are used to delete and operate on frames:
-
C-x 5 0 - Delete the selected frame (
delete-frame). This signals an error if there is only one frame. -
C-x 5 u - When
undelete-frame-modeis enabled, undelete one of the 16 most recently deleted frames. Without a prefix argument, undelete the most recently deleted frame. With a numerical prefix argument between 1 and 16, where 1 is the most recently deleted frame, undelete the corresponding deleted frame. -
C-z - Minimize (or iconify) the selected Emacs frame (
suspend-frame). Exiting. -
C-x 5 o - Select another frame, and raise it. If you repeat this command, it cycles through all the frames on your terminal.
-
C-x 5 1 - Delete all frames on the current terminal, except the selected one.
-
M-F10 - Toggle the maximization state of the current frame. When a frame is maximized, it fills the screen.
-
F11 - Toggle full-screen mode for the current frame. (The difference between full-screen and maximized is normally that the former hides window manager decorations, giving slightly more screen space to Emacs itself.) Note that whether resizing of full-screen frames is allowed and how Emacs handles that is controlled by the user option
alter-fullscreen-frames.
Note that with some window managers you may have to customize the variable frame-resize-pixelwise to a non-nil value in order to make a frame truly maximized or full-screen. This variable, when set to a non-nil value, in general allows resizing frames at pixel resolution, rather than in integral multiples of lines and columns. The C-x 5 0 (delete-frame) command deletes the selected frame. However, it will refuse to delete the last frame in an Emacs session, to prevent you from losing the ability to interact with the Emacs session. Note that when Emacs is run as a daemon (Emacs Server), there is always a virtual frame that remains after all the ordinary, interactive frames are deleted. In this case, C-x 5 0 can delete the last interactive frame; you can use emacsclient to reconnect to the Emacs session. The C-x 5 1 (delete-other-frames) command deletes all other frames on the current terminal (this terminal refers to either a graphical display, or a text terminal; Text Terminals). If the Emacs session has frames open on other graphical displays or text terminals, those are not deleted. The C-x 5 o (other-frame) command selects the next frame on the current terminal. If you are using Emacs on the X Window System with a window manager that selects (or gives focus to) whatever frame the mouse cursor is over, you have to change the variable focus-follows-mouse to t in order for this command to work properly. Then invoking C-x 5 o will also warp the mouse cursor to the chosen frame.
Fonts
By default, Emacs displays text on graphical displays using a 10-point monospace font, and the font size can be changed interactively (Text Scale). There are several different ways to specify a different font:
- Click on
Set Default Fontin theOptionsmenu. This makes the selected font the default on all existing graphical frames. To save this for future sessions, click onSave Optionsin theOptionsmenu. - Add a line to your init file, modifying the variable
default-frame-alistto specify thefontparameter (Frame Parameters), like this: (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10")) This makes the font the default on all graphical frames created after restarting Emacs with that init file. - Add an
emacs.fontX resource setting to your X resource file, like this: emacs.font: DejaVu Sans Mono-12 You must restart X, or use thexrdbcommand, for the X resources file to take effect. Resources. Do not quote font names in X resource files. - If you are running Emacs on the GNOME desktop or Haiku, you can tell Emacs to adjust the frame's default font along with changes to the default system font by setting the variable
font-use-system-fonttot(the default isnil). For this to work, Emacs must have been compiled with support for Gsettings (or the older Gconf). (To be specific, the Gsettings configuration names used areorg.gnome.desktop.interface monospace-font-nameandorg.gnome.desktop.interface font-name.) - Use the command line option
-fn(or--font). Font X.
To check what font you're currently using, the C-u C-x = command can be helpful. It describes the character at point, and names the font that it's rendered in. There are four different ways to express a font name. The first is to use a Fontconfig pattern. Fontconfig patterns have the following form:
@var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]...
Within this format, any of the elements in brackets may be omitted. Here, fontname is the family name of the font, such as Monospace or DejaVu Sans Mono; fontsize is the point size of the font (one printer's point is about 1/72 of an inch); and the /name/=/values/ entries specify settings such as the slant and weight of the font. Each values may be a single value, or a list of values separated by commas. In addition, some property values are valid with only one kind of property name, in which case the /name/= part may be omitted. Here is a list of common font properties:
-
slant - One of
italic,oblique, orroman. -
weight - One of
light,medium,demibold,boldorblack. -
style - Some fonts define special styles which are a combination of slant and weight. For instance,
Dejavu Sansdefines thebookstyle, which overrides the slant and weight properties. -
width - One of
condensed,normal, orexpanded. -
spacing - One of
monospace,proportional,dual-width, orcharcell.
Here are some examples of Fontconfig patterns:
Monospace Monospace-12 Monospace-12:bold DejaVu Sans Mono:bold:italic Monospace-12:weight=bold:slant=italic
For a more detailed description of Fontconfig patterns, see the Fontconfig manual, which is distributed with Fontconfig and available online at https://fontconfig.org/fontconfig-user.html. On MS-Windows, only the subset of the form fontname[-fontsize/] is supported for all fonts; the full Fontconfig pattern might not work for all of them. The second way to specify a font is to use a /GTK font pattern. These have the syntax
@var{fontname} [@var{properties}] [@var{fontsize}]
where fontname is the family name, properties is a list of property values separated by spaces, and fontsize is the point size. The properties that you may specify for GTK font patterns are as follows:
- Slant properties:
ItalicorOblique. If omitted, the default (roman) slant is implied. - Weight properties:
Bold,Book,Light,Medium,Semi-bold, orUltra-light. If omitted,Mediumweight is implied. - Width properties:
Semi-CondensedorCondensed. If omitted, a default width is used.
Here are some examples of GTK font patterns:
Monospace 12 Monospace Bold Italic 12
On MS-Windows, only the subset fontname is supported. The third way to specify a font is to use an XLFD (X Logical Font Description). This is the traditional method for specifying fonts under X, and is also supported on MS-Windows. Each XLFD consists of fourteen words or numbers, separated by dashes, like this:
-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
A wildcard character (*) in an XLFD matches any sequence of characters (including none), and ? matches any single character. However, matching is implementation-dependent, and can be inaccurate when wildcards match dashes in a long name. For reliable results, supply all 14 dashes and use wildcards only within a field. Case is insignificant in an XLFD. The syntax for an XLFD is as follows:
-@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
@dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{registry}-@var{encoding}
The entries have the following meanings:
- maker
- The name of the font manufacturer.
- family
- The name of the font family (e.g.,
courier). - weight
- The font weight—normally either
bold,mediumorlight. Some font names support other values. - slant
- The font slant—normally
r(roman),i(italic),o(oblique),ri(reverse italic), orot(other). Some font names support other values. - widthtype
- The font width—normally
normal,condensed,semicondensed, orextended. Some font names support other values. - style
- An optional additional style name. Usually it is empty—most XLFDs have two hyphens in a row at this point. The style name can also specify a two-letter ISO-639 language name, like
jaorko; some fonts that support CJK scripts have that spelled out in the style name part. - pixels
- The font height, in pixels.
- height
- The font height on the screen, measured in tenths of a printer's point. This is the point size of the font, times ten. For a given vertical resolution, height and pixels are proportional; therefore, it is common to specify just one of them and use
*for the other. - horiz
- The horizontal resolution, in pixels per inch, of the screen for which the font is intended.
- vert
- The vertical resolution, in pixels per inch, of the screen for which the font is intended. Normally the resolution of the fonts on your system is the right value for your screen; therefore, you normally specify
*for this and horiz. - spacing
- This is
m(monospace),p(proportional) orc(character cell). - width
- The average character width, in pixels, multiplied by ten.
- registry, encoding
- The X font character set that the font depicts. (X font character sets are not the same as Emacs character sets, but they are similar.) You can use the
xfontselprogram to check which choices you have. Normally you should useiso8859for registry and1for encoding.
The fourth and final method of specifying a font is to use a font nickname. Certain fonts have shorter nicknames, which you can use instead of a normal font specification. For instance, 6x13 is equivalent to
-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
This form is not supported on MS-Windows. On X, Emacs recognizes two types of fonts: client-side fonts, which are provided by the Xft and Fontconfig libraries, and server-side fonts, which are provided by the X server itself. Most client-side fonts support advanced font features such as antialiasing and subpixel hinting, while server-side fonts do not. Fontconfig and GTK patterns match only client-side fonts. You will probably want to use a fixed-width default font—that is, a font in which all characters have the same width. For Xft and Fontconfig fonts, you can use the fc-list command to list the available fixed-width fonts, like this:
fc-list :spacing=mono fc-list :spacing=charcell
For server-side X fonts, you can use the xlsfonts program to list the available fixed-width fonts, like this:
xlsfonts -fn '*x*' | grep -E '^[0-9]+x[0-9]+' xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*' xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
Any font with m or c in the spacing field of the XLFD is a fixed-width font. To see what a particular font looks like, use the xfd command. For example:
xfd -fn 6x13
displays the entire font 6x13. While running Emacs, you can also set the font of a specific kind of text (Faces), or a particular frame (Frame Parameters).
Speedbar Frames
The speedbar is a special frame for conveniently navigating in or operating on another frame. The speedbar, when it exists, is always associated with a specific frame, called its attached frame; all speedbar operations act on that frame. Type M-x speedbar to create the speedbar and associate it with the current frame. To dismiss the speedbar, type M-x speedbar again, or select the speedbar and type q. (You can also delete the speedbar frame like any other Emacs frame.) If you wish to associate the speedbar with a different frame, dismiss it and call M-x speedbar from that frame. The speedbar can operate in various modes. Its default mode is File Display mode, which shows the files in the current directory of the selected window of the attached frame, one file per line. Clicking on a non-directory visits that file in the selected window of the attached frame, and clicking on a directory shows that directory in the speedbar (Mouse References). Each line also has a box, [+] or <+>, that you can click on to expand the contents of that item. Expanding a directory adds the contents of that directory to the speedbar display, underneath the directory's own line. Expanding an ordinary file adds a list of the tags in that file to the speedbar display; you can click on a tag name to jump to that tag in the selected window of the attached frame. When a file or directory is expanded, the [+] changes to [-]; you can click on that box to contract the item, hiding its contents. You navigate through the speedbar using the keyboard, too. Typing RET while point is on a line in the speedbar is equivalent to clicking the item on the current line, and SPC expands or contracts the item. U displays the parent directory of the current directory. To copy, delete, or rename the file on the current line, type C, D, and R respectively. To create a new directory, type M. Another general-purpose speedbar mode is Buffer Display mode; in this mode, the speedbar displays a list of Emacs buffers. To switch to this mode, type b in the speedbar. To return to File Display mode, type f. You can also change the display mode by clicking mouse-3 anywhere in the speedbar window (or mouse-1 on the mode-line) and selecting Displays in the pop-up menu. Some major modes, including Rmail mode, Info, and GUD, have specialized ways of putting useful items into the speedbar for you to select. For example, in Rmail mode, the speedbar shows a list of Rmail files, and lets you move the current message to another Rmail file by clicking on its <M> box. The speedbar can optionally be displayed as a window rather than a separate frame, in both terminal and graphics mode. For more details on using and programming the speedbar, Speedbar.
Multiple Displays
A single Emacs can talk to more than one X display. Initially, Emacs uses just one display—the one specified with the DISPLAY environment variable or with the --display option (Initial Options). To connect to another display, use the command make-frame-on-display:
-
M-x make-frame-on-display RET display RET - Create a new frame on display display.
A single X server can handle more than one screen. When you open frames on two screens belonging to one server, Emacs knows they share a single keyboard, and it treats all the commands arriving from these screens as a single stream of input. When you open frames on different X servers, Emacs makes a separate input stream for each server. Each server also has its own selected frame. The commands you enter with a particular X server apply to that server's selected frame. On multi-monitor displays it is possible to use the command make-frame-on-monitor:
-
M-x make-frame-on-monitor RET monitor RET - Create a new frame on monitor monitor whose screen area is a part of the current display.
Single-keyboard mode
Each display has an associated keyboard. Normally, Emacs assumes that these keyboards are physically distinct, so that someone could be typing on one keyboard and someone else typing on another, into different frames on different terminals. In certain situations, however, Emacs enters single-keyboard mode, in which input from all but one keyboard is blocked. This prevents keys typed on one keyboard from interfering with an operation started on another keyboard. The main operation to which this applies is entering a recursive edit (Recursive Edit), which includes all minibuffer prompting (Basic Minibuffer). Single-keyboard mode can be inconvenient when there are distinct displays and so distinct keyboards, but only one user and one physical keyboard in control of Emacs. This can happen with X forwarding: with a remote Emacs daemon and multiple frames created with a command like ssh -X daemon-host emacsclient -c, then from the remote Emacs daemon's point of view there is one terminal and one keyboard per ssh -X daemon-host command invoked, but in fact a single local X server displays all frames, and there is just one physical keyboard. In this situation, you may prefer to have the different frames behave as though they had been created with C-x 5 2 (Creating Frames). In that case, starting a recursive edit in one frame does not mean that keyboard input into other frames is blocked. Customize the variable multiple-terminals-merge-keyboards to a non-nil value to achieve this.
Frame Parameters
You can control the default appearance and behavior of all frames by specifying a default list of frame parameters in the variable default-frame-alist. Its value should be a list of entries, each specifying a parameter name and a value for that parameter. These entries take effect whenever Emacs creates a new frame, including the initial frame. For example, you can add the following lines to your init file (Init File) to set the default frame width to 90 character columns, the default frame height to 40 character rows, and the default font to Monospace-10:
(add-to-list 'default-frame-alist '(width . 90)) (add-to-list 'default-frame-alist '(height . 40)) (add-to-list 'default-frame-alist '(font . "Monospace-10"))
For a list of frame parameters and their effects, see Frame Parameters. You can also specify a list of frame parameters which apply to just the initial frame, by customizing the variable initial-frame-alist. If Emacs is compiled to use an X toolkit, frame parameters that specify colors and fonts don't affect menus and the menu bar, since those are drawn by the toolkit and not directly by Emacs. Frame appearance and behavior can also be customized through X resources (X Resources); these override the parameters of the initial frame specified in your init file. Note that if you are using the desktop library to save and restore your sessions, the frames to be restored are recorded in the desktop file, together with their parameters. When these frames are restored, the recorded parameters take precedence over the frame parameters specified by default-frame-alist and initial-frame-alist in your init file. Saving Emacs Sessions, for how to avoid that.
Scroll Bars
On graphical displays, there is a vertical scroll bar on the side of each Emacs window. Clicking mouse-1 on the scroll bar's up and down buttons scrolls the window by one line at a time (but some toolkits allow you to customize the scroll bars to not have those buttons). Clicking mouse-1 above or below the scroll bar's inner box scrolls the window by nearly the entire height of the window, like M-v and C-v respectively (Moving Point). (This, too, can behave differently with some toolkits.) Dragging the inner box scrolls continuously. If Emacs is compiled on the X Window System without X toolkit support, the scroll bar behaves differently. Clicking mouse-1 anywhere on the scroll bar scrolls forward like C-v, while mouse-3 scrolls backward like M-v. Clicking mouse-2 in the scroll bar lets you drag the inner box up and down. To toggle the use of vertical scroll bars, type M-x scroll-bar-mode. This command applies to all frames, including frames yet to be created. To toggle vertical scroll bars for just the selected frame, use the command M-x toggle-scroll-bar. To control the use of vertical scroll bars at startup, customize the variable scroll-bar-mode (Customization). Its value should be either right (put scroll bars on the right side of windows), left (put them on the left), or nil (disable vertical scroll bars). By default, Emacs puts scroll bars on the right if it was compiled with GTK+ support on the X Window System, and on MS-Windows or macOS; Emacs puts scroll bars on the left if compiled on the X Window System without GTK+ support (following the old convention for X applications). You can also use the X resource verticalScrollBars to enable or disable the scroll bars (Resources). To control the scroll bar width, change the scroll-bar-width frame parameter (Frame Parameters). If you're using Emacs on X (with GTK+ or Motif), you can customize the variable scroll-bar-adjust-thumb-portion to control overscrolling of the scroll bar, i.e., dragging the thumb down even when the end of the buffer is visible. If its value is non-nil, the scroll bar can be dragged downwards even if the end of the buffer is shown; if nil, the thumb will be at the bottom when the end of the buffer is shown. You cannot over-scroll when the entire buffer is visible. The visual appearance of the scroll bars is controlled by the scroll-bar face. (Some toolkits, such as GTK+ and MS-Windows, ignore this face; the scroll-bar appearance there can only be customized system-wide, for GTK+ GTK resources). On graphical frames, vertical scroll bars implicitly serve to separate side-by-side windows visually. When vertical scroll bars are disabled, Emacs by default separates such windows with the help of a one-pixel wide vertical border. That border occupies the first pixel column of the window on the right and may thus overdraw the leftmost pixels of any glyph displayed there. If these pixels convey important information, you can make them visible by enabling window dividers, see Window Dividers. To replicate the look of vertical borders, set the right-divider-width parameter of frames to one and have the window-divider face inherit from that of vertical-border, Window Dividers. On graphical displays with toolkit support, Emacs may also supply a horizontal scroll bar on the bottom of each window. Clicking mouse-1 on that scroll bar's left and right buttons scrolls the window horizontally by one column at a time. (Note that some toolkits allow customizations of the scroll bar that cause these buttons not to be shown.) Clicking mouse-1 on the left or right of the scroll bar's inner box scrolls the window by four columns. Dragging the inner box scrolls the window continuously. Note that such horizontal scrolling can make the window's position of point disappear on the left or the right. Typing a character to insert text or moving point with a keyboard command will usually bring it back into view. To toggle the use of horizontal scroll bars, type M-x horizontal-scroll-bar-mode. This command applies to all frames, including frames yet to be created. To toggle horizontal scroll bars for just the selected frame, use the command M-x toggle-horizontal-scroll-bar. To control the use of horizontal scroll bars at startup, customize the variable horizontal-scroll-bar-mode. You can also use the X resource horizontalScrollBars to enable or disable horizontal scroll bars (Resources). To control the scroll bar height, change the scroll-bar-height frame parameter (Frame Parameters).
Window Dividers
On graphical displays, you can use window dividers in order to separate windows visually. Window dividers are bars that can be dragged with the mouse, thus allowing you to easily resize adjacent windows. To toggle the display of window dividers, use the command M-x window-divider-mode. To customize where dividers should appear, use the option window-divider-default-places. Its value should be either bottom-only (to show dividers only on the bottom of windows), right-only (to show dividers only on the right of windows), or t (to show them on the bottom and on the right). To adjust the width of window dividers displayed by this mode customize the options window-divider-default-bottom-width and window-divider-default-right-width. When vertical scroll bars are disabled, dividers can be also useful to make the first pixel column of a window visible, which would be otherwise covered by the vertical border used to separate side-by-side windows (Scroll Bars). For more details about window dividers see Window Dividers.
Drag and Drop
In most graphical desktop environments, Emacs has basic support for drag and drop operations. For instance, dropping text onto an Emacs frame inserts the text where it is dropped. Dropping a file onto an Emacs frame visits that file. As a special case, dropping the file on a Dired buffer moves or copies the file (according to the conventions of the application it came from) into the directory displayed in that buffer. Dropping a file normally visits it in the window you drop it on. If you prefer to visit the file in a new window in such cases, customize the variable dnd-open-file-other-window. The XDND and Motif drag and drop protocols, and the old KDE 1.x protocol, are currently supported. It can be difficult to scroll a window or determine where dropped text will be inserted while dragging text onto an Emacs window. Setting the option dnd-indicate-insertion-point to a non-nil value makes point move to the location any dropped text will be inserted when the mouse moves in a window during drag, and setting dnd-scroll-margin to an integer value causes a window to be scrolled if the mouse moves within that many lines of the top or bottom of the window during drag. Emacs can also optionally drag the region with the mouse into another portion of this or another buffer. To enable that, customize the variable mouse-drag-and-drop-region to a non-nil value. Normally, the text is moved, i.e. cut and pasted, when the destination is the same buffer as the origin; dropping the region on another buffer copies the text instead. If the value of this variable names a modifier key, such as shift, control or alt, then pressing that modifier key when dropping the text will copy it instead of cutting it, even if you drop on the same buffer as the one from which the text came. In order to cut text even when source and destination buffers differ, set the option mouse-drag-and-drop-region-cut-when-buffers-differ to a non-nil value. By default, on a graphic display the selected text is shown in a tooltip and point moves together with the mouse cursor during dragging. To suppress such behavior, set the options mouse-drag-and-drop-region-show-tooltip and/or mouse-drag-and-drop-region-show-cursor to nil. To drag text from Emacs to other programs, set the option mouse-drag-and-drop-region-cross-program to a non-nil value. On the X window system, some programs can drop files on Emacs, expecting Emacs to save them. Normally, Emacs will prompt for a file name under which the file will be saved, and then open the file, but that behavior can be changed by changing the variable x-dnd-direct-save-function. Drag and Drop.
Tool Bars
On graphical displays, Emacs puts a tool bar at the top of each frame, just below the menu bar. This is a row of buttons with icons which you can click on with the mouse to invoke various commands. Emacs can also optionally display a tool bar at the top of each window (Window Tool Bar). The global (default) tool bar contains general commands. Some major modes define their own tool bars; whenever a buffer with such a major mode is current, the mode's tool bar replaces the global tool bar. To prevent this replacement from happening, customize the variable tool-bar-always-show-default. To toggle the use of tool bars, type M-x tool-bar-mode. This command applies to all frames, including frames yet to be created. To control the use of tool bars at startup, customize the variable tool-bar-mode. When Emacs is compiled with GTK+ support, each tool bar item can consist of an image, or a text label, or both. By default, Emacs follows the Gnome desktop's tool bar style setting; if none is defined, it displays tool bar items as just images. To impose a specific tool bar style, customize the variable tool-bar-style. You can also control the placement of the tool bar for the GTK+ tool bar with the frame parameter tool-bar-position. Frame Parameters. NS builds consider the tool bar to be a window decoration, and therefore do not display it when a window is undecorated. Frame Parameters. On macOS the tool bar is hidden when the frame is put into fullscreen, but can be displayed by moving the mouse pointer to the top of the screen. Keyboards often lack one or more of the modifier keys (Modifier Keys) that Emacs users might want to use, making it difficult or impossible to input key sequences with these modifiers. For example, many keyboards lack the Hyper and Super modifiers, and smartphones usually also lack Ctrl and Alt modifiers. Emacs can optionally display a tool bar of buttons that can substitute the modifier keys; this additional tool bar is known as the modifier bar. Clicking a button within the modifier bar will cause the modifier key shown on the button to be applied to the next keyboard event that Emacs reads. The modifier bar is displayed when the global minor mode modifier-bar-mode is enabled; to do so, type M-x modifier-bar-mode.
Tab Bars
On graphical displays and on text terminals, Emacs can optionally display a Tab Bar at the top of each frame, just below the menu bar (Menu Bars) and above or below the tool bar (Tool Bars) depending on the variable tab-bar-position. The Tab Bar is a row of tabs—buttons that you can click to switch between window configurations. Each tab on the Tab Bar represents a named persistent window configuration of its frame, i.e., how that frame is partitioned into windows and which buffer is displayed in each window. The tab's name is composed from the list of names of buffers shown in windows of that window configuration. Clicking on the tab switches to the window configuration recorded by the tab; it is a configuration of windows and buffers which was previously used in the frame when that tab was the current tab. If you are using the desktop library to save and restore your sessions (Saving Emacs Sessions), the tabs from the Tab Bar are recorded in the desktop file, together with their associated window configurations, and will be available after restoring the session. Note that the Tab Bar is different from the Tab Line (Tab Line). Whereas tabs on the Tab Line at the top of each window are used to switch between buffers in the window, tabs on the Tab Bar at the top of each frame are used to switch between window configurations containing several windows showing one or more buffers. To toggle the use of Tab Bars, type M-x tab-bar-mode. This command applies to all frames, including frames yet to be created. To control the use of tab bars at startup, customize the variable tab-bar-mode and save your customization. The variable tab-bar-show controls whether the Tab Bar mode is turned on automatically. If the value is t, then tab-bar-mode is enabled when using the commands that create new tabs. The value 1 hides the tab bar when it has only one tab, and shows it again when more tabs are created. More generally, a value that is a non-negative integer causes the Tab Bar to be displayed only if the number of tabs is greater than that integer. The value nil always keeps the Tab Bar hidden; in this case it's still possible to switch between named window configurations without displaying the Tab Bar by using M-x tab-next, M-x tab-switcher, and other commands that provide completion on tab names. Also it's possible to create and close tabs without the Tab Bar by using commands M-x tab-new, M-x tab-close, etc. Note that a numerical value of tab-bar-show can cause the Tab Bar to be displayed on some frames, but not on others, depending on the number of tabs created on each frame. To toggle the use of the Tab Bar only on the selected frame, type M-x toggle-frame-tab-bar. This command facilitates selectively enabling the Tab Bar on some frames while keeping it disabled on others, irrespective of the values of tab-bar-mode and tab-bar-show. The prefix key C-x t is analogous to C-x 5. Whereas each C-x 5 command pops up a buffer in a different frame (Creating Frames), the C-x t commands use a different tab with a different window configuration in the selected frame. The various C-x t commands differ in how they find or create the buffer to select. The following commands can be used to select a buffer in a new tab:
-
C-x t 2 - Add a new tab (
tab-new). You can control the choice of the buffer displayed in a new tab by customizing the variabletab-bar-new-tab-choice. You can control the names given by default to new tabs by customizing the variabletab-bar-tab-name-function. -
C-x t b bufname RET - Select buffer bufname in another tab. This runs
switch-to-buffer-other-tab. -
C-x t f filename RET - Visit the file filename (Visiting) and select its buffer in another tab. This runs
find-file-other-tab. -
C-x t d directory RET - Edit the specified directory (Dired) in another tab. This runs
dired-other-tab. -
C-x t t - This is a prefix command (
other-tab-prefix) that affects the next command invoked immediately after this prefix command. It requests the buffer displayed by the next command to be shown in another tab.
By default, a new tab starts with the buffer that was current before calling the command that adds a new tab. To start a new tab with other buffers, customize the variable tab-bar-new-tab-choice. The variable tab-bar-new-tab-to defines where to place a new tab. By default, a new tab is added on the right side of the current tab. The following commands can be used to delete tabs:
-
C-x t 0 - Close the selected tab (
tab-close). This has no effect if there is only one tab, unless the variabletab-bar-close-last-tab-choiceis customized to a non-default value. -
C-x t 1 - Close all tabs, except the selected tab, on the selected frame.
The variable tab-bar-close-tab-select defines what tab to select after closing the current tab. By default, it selects a recently used tab. The command tab-undo restores the last closed tab. The following commands can be used to switch between tabs:
-
C-x t o,C-TAB - Switch to the next tab (
tab-next). If you repeat this command, it cycles through all the tabs on the selected frame. With a positive numeric argument n, it switches to the n/th next tab; with a negative argument -/n, it switches back to the /n/th previous tab. -
S-C-TAB - Switch to the previous tab (
tab-previous). With a positive numeric argument n, it switches to the n/th previous tab; with a negative argument -/n, it switches to the /n/th next tab. -
C-x t RET tabname RET - Switch to the tab by its name (
tab-switch), with completion on all tab names. The default value and the "future history" of tab names is sorted by recency, so you can useM-n(next-history-element) to get the name of the last visited tab, the second last, and so on. -
modifier-tab-number - Switch to the tab by its number tab-number (
tab-select). After customizing the variabletab-bar-select-tab-modifiersto specify one or more modifier keys, you can select a tab by its ordinal number using one of the specified modifiers in combination with the tab number to select. The number 9 can be used to select the last tab. You can select any modifiers supported by Emacs, Modifier Keys. To display the tab number alongside the tab name, you can customize another variabletab-bar-tab-hints. This will help you decide which numerical key to press to select the tab by its number. -
modifier-9 - Switch to the last tab (
tab-last). The key combination is the modifier key defined bytab-bar-select-tab-modifiersand the key9. With a numeric argument n, switch to the /n/th last tab. -
modifier-0 - Switch to the recent tab (
tab-recent). The key combination is the modifier key defined bytab-bar-select-tab-modifiersand the key0. With a numeric argument n, switch to the /n/th recent tab.
The following commands can be used to operate on tabs:
-
C-x t r tabname RET - Rename the current tab to tabname (
tab-rename). -
C-x t m - Move the current tab one position to the right (
tab-move). With a positive numeric argument n, move it that many positions to the right; with a negative argument -n, move it n positions to the left.
You can use the mouse to operate on tabs. Clicking mouse-2 closes the tab. Clicking mouse-3 pops up the context menu with the items that operate on the clicked tab. Dragging the tab with mouse-1 moves it to another position on the tab bar. Mouse wheel scrolling switches to the next or previous tab. Holding down the SHIFT key during scrolling moves the tab to the left or right. Touch screen input (Other Input) can also be used to operate on tabs. Long-pressing (Touchscreens) a tab will display a context menu with items that operate on the tab that was pressed, and long-pressing the tab bar itself will display a context menu which lets you create and remove tabs; tapping a tab itself will result in that tab's window configuration being selected, and tapping a button on the tab bar will behave as if it was clicked with mouse-1. You can enable tab-bar-history-mode to remember window configurations used in every tab, and later restore them.
-
M-x tab-bar-history-back - Restore a previous window configuration used in the current tab. This navigates back in the history of window configurations.
-
M-x tab-bar-history-forward - Cancel restoration of the previous window configuration. This moves forward in the history of window configurations.
It's possible to customize the items displayed on the tab bar by the user option tab-bar-format.
Using System GUI Taskbar Features
Emacs can use your GUI system taskbar to display a badge overlay on the Emacs taskbar icon, a progress bar report, and alert the user that an Emacs session needs attention. Note: The system taskbar might be called the dock, the launcher, or something similar. On GNU/Linux eligible GUI desktops, system taskbar effects will appear on the desktop destinations determined by your shell extension, most often the application launcher or dock panel, or the top panel. Effects are global for an Emacs instance. Note: The GNU/Linux implementation sends system taskbar messages to the GUI using D-Bus. You may need to install or configure shell extensions such as https://extensions.gnome.org/extension/307/dash-to-dock/ that implement Ubuntu's Unity D-Bus launcher spec which you can read more about here https://wiki.ubuntu.com/Unity/LauncherAPI. Top. On macOS/GNUstep 10.5+, system taskbar effects appear on the Dock and in the App Switcher. Effects are global for an Emacs instance. macOS/GNUstep need no special configuration. On MS-Windows 7+, taskbar effects appear on the Windows system taskbar. Effects are associated with the frame from which they are initiated. MS-Windows needs no special configuration. You must initialize system taskbar before using it. To do that, type M-x system-taskbar-mode. The user option system-taskbar-use-progress-reporter integrates system-taskbar-mode with Emacs progress report functions, which many longer-running functions use to indicate the progress of their work. Progress reports will appear in the echo area and on the system taskbar Emacs icon. This variable defaults to t. Customize this variable before enabling system-taskbar-mode. Progress The user option system-taskbar-clear-attention-on-frame-focus turns on a helper useful on GNU/Linux D-Bus platforms which automatically clears the system taskbar attention indicator when any Emacs frame is focused. This has no effect on macOS/GNUstep or MS-Windows. It defaults to t. Customize this variable before enabling system-taskbar-mode. The user option system-taskbar-dbus-desktop-file-name helps D-Bus on GNU/Linux identify launched instance of Emacs. It defaults to emacsclient and may need to be changed to emacs depending on your GNU/Linux configuration. The user option system-taskbar-dbus-timeout is a troubleshooting tool and it likely does not need to be customized. It defaults to nil which uses the D-Bus default timeout which is 25,000ms or 25s. System Taskbar
Using Dialog Boxes
A dialog box is a special kind of menu for asking you a yes-or-no question or some other special question. Many Emacs commands use a dialog box to ask a yes-or-no question, if you used the mouse to invoke the command that led to the question. To disable the use of dialog boxes, change the variable use-dialog-box to nil. In that case, Emacs always performs yes-or-no prompts using the echo area and keyboard input. This variable also controls whether to use file selection windows (but those are not supported on all platforms). A file selection window is a special kind of dialog box for asking for file names. You can customize the variable use-file-dialog to suppress the use of file selection windows, even if you still want other kinds of dialogs. This variable has no effect if you have suppressed all dialog boxes with the variable use-dialog-box. When Emacs is compiled with GTK+ support, it uses the GTK+ file chooser dialog. Emacs adds an additional toggle button to this dialog, which you can use to enable or disable the display of hidden files (files starting with a dot) in that dialog. If you want this toggle to be activated by default, change the variable x-gtk-show-hidden-files to t. In addition, Emacs adds help text to the GTK+ file chooser dialog; to disable this help text, change the variable x-gtk-file-dialog-help-text to nil.
Tooltips
Tooltips are small special frames that display text information at the current mouse position. They activate when there is a pause in mouse movement over some significant piece of text in a window, or the mode line, or some other part of the Emacs frame such as a tool bar button or menu item. You can toggle the use of tooltips with the command M-x tooltip-mode. When Tooltip mode is disabled, the help text is displayed in the echo area instead. To control the use of tooltips at startup, customize the variable tooltip-mode. The following variables provide customization options for tooltip display: @vtable @code - tooltip-delay This variable specifies how long Emacs should wait before displaying the first tooltip. The value is in seconds. - tooltip-short-delay This variable specifies how long Emacs should wait before displaying subsequent tooltips on different items, having already displayed the first tooltip. The value is in seconds. - tooltip-hide-delay The number of seconds since displaying a tooltip to hide it, if the mouse doesn't move. - tooltip-x-offset - tooltip-y-offset The X and Y offsets, in pixels, of the left top corner of the tooltip from the mouse pointer position. Note that these are ignored if tooltip-frame-parameters was customized to include, respectively, the left and top parameters. The values of the offsets should be chosen so that the tooltip doesn't cover the mouse pointer's hot spot, or it might interfere with clicking the mouse. - tooltip-frame-parameters The frame parameters used for displaying tooltips. Frame Parameters, and also Tooltips. @end vtable For additional customization options for displaying tooltips, use M-x customize-group RET tooltip RET. If Emacs is built with the GTK+ toolkit, Nextstep windowing, or Haiku windowing support, it displays tooltips via the toolkit, using the default appearance of the toolkit's tooltips.(The foreground and background colors of toolkit-created tooltips on Nextstep can also be customized by setting the foreground and background frame parameters that are part of tooltip-frame-parameters.) To disable this, change the variable use-system-tooltips to nil. If you do this, or if Emacs is built without the appropriate windowing support, most attributes of the tooltip text are specified by the tooltip face, and by X resources (X Resources). GUD tooltips are special tooltips that show the values of variables when debugging a program with GUD. Debugger Operation.
Mouse Avoidance
On graphical terminals, the mouse pointer may obscure the text in the Emacs frame. Emacs provides two methods to avoid this problem. Firstly, Emacs hides the mouse pointer each time you type a self-inserting character, if the pointer lies inside an Emacs frame; moving the mouse pointer makes it visible again. To disable this feature, set the variable make-pointer-invisible to nil. Display Custom. Secondly, you can use Mouse Avoidance mode, a minor mode, to keep the mouse pointer away from point. To use Mouse Avoidance mode, customize the variable mouse-avoidance-mode. You can set this to various values to move the mouse in several ways:
-
banish - Move the pointer to a corner of the frame on any key-press. You can customize the variable
mouse-avoidance-banish-positionto specify where the pointer goes when it is banished. -
exile - Banish the pointer only if the cursor gets too close, and allow it to return once the cursor is out of the way.
-
jump - If the cursor gets too close to the pointer, displace the pointer by a random distance and direction.
-
animate - As
jump, but shows steps along the way for illusion of motion. -
cat-and-mouse - The same as
animate. -
proteus - As
animate, but changes the shape of the mouse pointer too.
You can also use the command M-x mouse-avoidance-mode to enable the mode. Whenever Mouse Avoidance mode moves the mouse, it also raises the frame.
Text Terminals
On a text terminal, Emacs can display only one Emacs frame at a time. However, you can still create multiple Emacs frames, and switch between them. Switching frames on these terminals is much like switching between different window configurations. Use C-x 5 2 to create a new frame and switch to it; use C-x 5 o to cycle through the existing frames; use C-x 5 0 to delete the current frame. Each frame has a number to distinguish it. If your terminal can display only one frame at a time, the selected frame's number n appears near the beginning of the mode line, in the form F/n/. F/n/ is in fact the frame's initial name. You can give frames more meaningful names if you wish, and you can select a frame by its name. Use the command M-x set-frame-name =RET name RET= to specify a new name for the selected frame, and use M-x select-frame-by-name RET name RET to select a frame according to its name. The name you specify appears in the mode line when the frame is selected.
Using a Mouse in Text Terminals
Some text terminals support mouse clicks in the terminal window. In a terminal emulator which is compatible with xterm, you can use M-x xterm-mouse-mode to give Emacs control over simple uses of the mouse—basically, only non-modified single clicks are supported. Newer versions of xterm also support mouse-tracking. The normal xterm mouse functionality for such clicks is still available by holding down the SHIFT key when you press the mouse button. Xterm Mouse mode is a global minor mode (Minor Modes). Repeating the command turns the mode off again. In the console on GNU/Linux, you can use M-x gpm-mouse-mode to enable mouse support. You must have the gpm server installed and running on your system in order for this to work. Note that when this mode is enabled, you cannot use the mouse to transfer text between Emacs and other programs which use GPM. This is due to limitations in GPM and the Linux kernel. MS-DOS Mouse, for information about mouse support on MS-DOS.