ARCHIVED: In Emacs, how do I display the current line or column, or move to a specific line or column?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Note: The Emacs keystroke designations differ from the ones used in the rest of the Knowledge Base. For clarifications, see How keystrokes are denoted in Emacs

These commands are useful for moving to and/or displaying lines and columns:

Go to a specific line: M-x goto-line
Display the current line: M-x what-line
Count the lines on the current page and display the current line*:
C-x l
Display line number in the mode line:
M-x line-number-mode
Display column number in the mode line**:
M-x column-number-mode

*In Emacs, a page is defined as the space between C-l characters. Emacs will return the wrong value if you enter this command at the beginning of a line.

**Requires Emacs 20 or higher. Emacs 21 is available on all UITS central systems at Indiana University.

To enable line-number-mode by default in Emacs, enter the following into your .emacs file:

  (setq line-number-mode t)

Likewise, if you are using Emacs 20 or higher, you can also enable column-number-mode by default by entering into your .emacs file:

  (setq column-number-mode t)

For more information, see the Emacs FAQ.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

Related documents

This is document abuf in the Knowledge Base.
Last modified on 2018-01-18 09:14:43.