Determining the current line number in Emacs
The default version of Emacs on Athena has line numbering automatically. If you are using an earlier version, you may have to turn it on.
The line number is displayed in the "mode line" at the bottom of the screen. If you look down at the bottom of the screen, you should see a section that has "--L#--" where the "#" is the line number your text cursor is currently on.
- If line numbering currently isn't on in your emacs window, just type:
Meta-x line-number-mode
- If you wish to turn on line numbering always, you can put the line:
(setq line-number-mode t)
in your .emacs file.
- If you wish to have it always be off, put in:
(setq line-number-mode nil)
Similarly, there is a column-number-mode that works the same way.
Related Commands
There are several other related commands you can also use to determine the line number and perform line number functions.
- If you want to find out the number of the line where the cursor is, type this:
M-x what-line
- If you want to move the cursor to a particular line, type this:
M-x goto-line
followed by the line number.
- If you want to know how many lines are in a region of text, use:
M-x count-lines-region
or
M-=