Next: , Previous: Debugging a customization file, Up: Common requests

5.5 How do I make Emacs display the current line (or column) number?

By default, Emacs displays the current line number of the point in the mode line. You can toggle this feature off or on with the command M-x line-number-mode, or by setting the variable line-number-mode. Note that Emacs will not display the line number if the buffer's size in bytes is larger than the value of the variable line-number-display-limit.

You can similarly display the current column with M-x column-number-mode, or by putting the form

     (setq column-number-mode t)

in your .emacs file. This feature is off by default.

The "%c" format specifier in the variable mode-line-format will insert the current column's value into the mode line. See the documentation for mode-line-format (using C-h v mode-line-format <RET>) for more information on how to set and use this variable.

The ‘linum’ package (distributed with Emacs since version 23.1) displays line numbers in the left margin, like the “set number” capability of vi. The packages ‘setnu’ and ‘wb-line-number’ (not distributed with Emacs) also implement this feature.