If you want to display line numbers in a buffer, there are a couple of ways of doing this. You can use linum.el, kindly made available by Markus Triska. Download and dump it in your .el elisp directory.
Add the following to your .emacs config file:
To activate line numbers, do:
To de-activate line numbers, do:
This code displays line numbers to the left of the buffer. Its for display purposes only. The file remains unchanged.
Want to add line numbers to your buffer content? Try this:
M-x replace-regexp [Return]
\# tab \& [Return]
Move cursor to start of buffer before you enter code. Otherwise numbers will start from current line.
There are other functions available at EmacsWiki. Go take a look.
You can also display line numbers on the mode line. Add the following to your .emacs file.
; Enable line number on mode line
Might as well add the column while your there!
; Enable column number on mode line