Go to the first, previous, next, last section, table of contents.

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

To find out what line of the buffer you are on right now, do "M-x what-line". Use "M-x goto-line" to go to a specific line. To find the current column number, type "M-ESC (current-column)".

Typing "C-x l" will also tell you what line you are on, provided the buffer isn't separated into "pages" with C-l characters. In that case, it will only tell you what line of the current "page" you are on. WARNING: "C-x l" gives the wrong value when point is at the beginning of a line.

There is no "correct" way to constantly display the current (or total) line (or column) number on the mode line in Emacs 18, or to display the line numbers next to the lines like vi can. Emacs is not a line-oriented editor, and really has no idea what "lines" of the buffer are displayed in the window. It would require a lot of work at the C code level to make Emacs keep track of this. It would not be that hard to get the column number, but it would still require changes at the C code level.

None of the vi emulation modes provide the `set number' capability of vi (as far as I know).

Emacs 19 will probably be able to show the line number on the mode-line, but probably very inefficiently.

People have written various kludges to display line numbers. One is `display-line-numbers' by Wayne Mesard <wmesard@tofu.oracle.com, Mesard@bbn.com>. Look in the Lisp Code Directory. (See question 88.)


Go to the first, previous, next, last section, table of contents.