Skip to main content

1.3 The Mode Line

At the bottom of each window is a mode line, which describes what is going on in the current buffer. When there is only one window, the mode line appears right above the echo area; it is the next-to-last line in the frame. On a graphical display, the mode line is drawn with a 3D box appearance. Emacs also usually draws the mode line of the selected window with a different color from that of unselected windows, in order to make it stand out.

The text displayed in the mode line has the following format:

 cs:ch-fr  buf      pos line   (major minor)

On a text terminal, this text is followed by a series of dashes extending to the right edge of the window. These dashes are omitted on a graphical display.

The cs string and the colon character after it describe the character set and newline convention used for the current buffer. Normally, Emacs automatically handles these settings for you, but it is sometimes useful to have this information.

cs describes the character set of the text in the buffer (see Coding Systems). If it is a dash (β€˜-’), that indicates no special character set handling (with the possible exception of end-of-line conventions, described in the next paragraph). β€˜=’ means no conversion whatsoever, and is usually used for files containing non-textual data. Other characters represent various coding systemsβ€”for example, β€˜1’ represents ISO Latin-1.

On a text terminal, cs is preceded by two additional characters that describe the coding systems for keyboard input and terminal output. Furthermore, if you are using an input method, cs is preceded by a string that identifies the input method (see Input Methods).

The character after cs is usually a colon. If a different string is displayed, that indicates a nontrivial end-of-line convention for encoding a file. Usually, lines of text are separated by newline characters in a file, but two other conventions are sometimes used. The MS-DOS convention uses a carriage return character followed by a linefeed character; when editing such files, the colon changes to either a backslash (β€˜\’) or β€˜(DOS)’, depending on the operating system. Another convention, employed by older Macintosh systems, uses a carriage return character instead of a newline; when editing such files, the colon changes to either a forward slash (β€˜/’) or β€˜(Mac)’. On some systems, Emacs displays β€˜(Unix)’ instead of the colon for files that use newline as the line separator.

On frames created for emacsclient (see Invoking emacsclient), the next character is β€˜@’. This indication is typical for frames of an Emacs process running as a daemon (see Emacs Server).

The next element on the mode line is the string indicated by ch. This shows two dashes (β€˜--’) if the buffer displayed in the window has the same contents as the corresponding file on the disk; i.e., if the buffer is unmodified. If the buffer is modified, it shows two stars (β€˜**’). For a read-only buffer, it shows β€˜%*’ if the buffer is modified, and β€˜%%’ otherwise.

The character after ch is normally a dash (β€˜-’). However, if default-directory (see File Names) for the current buffer is on a remote machine, β€˜@’ is displayed instead.

fr gives the selected frame name (see Frames). It appears only on text terminals. The initial frame’s name is β€˜F1’.

buf is the name of the buffer displayed in the window. Usually, this is the same as the name of a file you are editing. See Buffers.

pos tells you whether there is additional text above the top of the window, or below the bottom. If your buffer is small and all of it is visible in the window, pos is β€˜All’. Otherwise, it is β€˜Top’ if you are looking at the beginning of the buffer, β€˜Bot’ if you are looking at the end of the buffer, or β€˜nn%’, where nn is the percentage of the buffer above the top of the window. With Size Indication mode, you can display the size of the buffer as well. See Optional Mode Line.

line is the character β€˜L’ followed by the line number at point. (You can display the current column number too, by turning on Column Number mode. See Optional Mode Line.)

major is the name of the major mode used in the buffer. A major mode is a principal editing mode for the buffer, such as Text mode, Lisp mode, C mode, and so forth. See Major Modes. Some major modes display additional information after the major mode name. For example, Compilation buffers and Shell buffers display the status of the subprocess.

minor is a list of some of the enabled minor modes, which are optional editing modes that provide additional features on top of the major mode. See Minor Modes.

Some features are listed together with the minor modes whenever they are turned on, even though they are not really minor modes. β€˜Narrow’ means that the buffer being displayed has editing restricted to only a portion of its text (see Narrowing). β€˜Def’ means that a keyboard macro is currently being defined (see Keyboard Macros).

In addition, if Emacs is inside a recursive editing level, square brackets (β€˜[…]’) appear around the parentheses that surround the modes. If Emacs is in one recursive editing level within another, double square brackets appear, and so on. Since recursive editing levels affect Emacs globally, such square brackets appear in the mode line of every window. See Recursive Edit.

You can change the appearance of the mode line as well as the format of its contents. See Optional Mode Line. In addition, the mode line is mouse-sensitive; clicking on different parts of the mode line performs various commands. See Mode Line Mouse. Also, hovering the mouse pointer above mouse-sensitive portions of the mode line shows tooltips (see Tooltips) with information about commands you can invoke by clicking on the mode line.