Finding What Line You Are On


Emacs does not have a line-number-mode by default. However, you can get emacs to display the current line number by inserting the following lines into your .emacs file:

    (autoload 'display-current-line-number
    	  "/mit/consult/lib/elisp/current-line"
    	  "Display the current line number on the status line."
	  t)
If you do not have an .emacs file, you can create a new one. Note that the above approach requires that you have the consult locker attached before you can display the current line number. To do that, you just need to type at the athena% prompt:
attach consult
One you have the right code in your .emacs file, restart your emacs. (You will only need to do this once -- each next time you start your emacs it should work just fine.)

Then to enable displaying the line number, type in emacs:

M-x display-current-line-number
To turn off the displaying, type:
M-x undisplay-current-line-number
The current line number will be displayed on the status line. However, it will only update when the cursor is moved line by line; using C-v or M-v to move the cursor page by page will not update the indicator until the cursor is moved one line up or down.

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-=