Emacs: What is Mode Line (status bar)

By Xah Lee. Date: . Last updated: .

mode line is a line at the bottom of a window pane that shows info about the current buffer, such as • Emacs: File Encoding used • buffer name (file name) • current Major Mode

emacs mode line 2023-08-29
emacs mode line 2023-08-29

The mode line show some info about the current buffer.

Mode Line Display Meaning

File Encoding and Newline Convention

The first character indicates encoding. U means Unicode. Alt+x list-coding-systems to see a full list and explanation.

emacs mode line 2023-08-30 X5Zxr
emacs mode line 2023-08-30 X5Zxr

Sample:

  • U(Unix) → Unicode encoding with unix newline
  • U(Dos) → Unicode encoding with Microsoft Windows newline
  • U\ → Unicode encoding with Microsoft Windows newline when on Windows.
  • U(Mac) → Unicode encoding with Classic Mac OS newline (1990s)
Modified Status

This is 3 characters.

Sample:

  • --- → file not changed
  • **- → file is modified
  • %%- → read only
  • %*- → read only and modified

If the last character is @, the file is on a remote machine.

emacs mode line 2023-08-30 h7w4
emacs mode line 2023-08-30 h7w4
Buffer Name

If the buffer is a file, it usually is the file name

Clicking on it switches buffer.

Position

Sample:

  • ALL → all content are shown.
  • Top → cursor is at the top of buffer
  • nn% → cursor is at nn percent of buffer
  • Bot → cursor is at the bottom of buffer
  • L27 → at line 27

If you have column-number-mode on:

  • (27,4) → at line 27, column 4
emacs mode line click 2023-08-29
emacs mode line click 2023-08-29
(major minor)

shows the current Major Mode and few Minor Mode and or possibly some other info.

Sample:

emacs mode line abbrev 2023-08-29
emacs mode line with Abbrev Mode on.
emacs mode line narrow 2023-08-29
emacs mode line showing Narrow to Region in effect.
emacs mode line key macro 2023-08-29
keyboard macro recording in effect. [see Emacs: Keyboard Macro]
in recursive edit
emacs 29 mode line recursive edit 2023-08-31
emacs 29 mode line recursive edit 2023-08-31

if the (major minor) part is bracketed by square brackets, example:

[(major minor)]

It means you are in recursive edit.

Recursive Edit means you are calling a command before another command has finished. This often happens when you are coding elisp and there are errors and debugger is entered. Recursive Edit can be nested many times. Each level of recursive edit adds a square bracket.

To exit Recursive Edit:

  • Ctrl+Meta+Ctrlexit-recursive-edit → exit the current level.
  • Ctrl+]abort-recursive-edit → exit all.

Reference

Major Mode, Minor Mode, Minibuffer, Hook