This is another note to myself. Recently I was examining the internal structure of the decimal expansion of a number. In order to do this, I put the decimal representation of the number in a buffer and did a
query-replace-regexp substituting <digit><space> for each <digit>. Then I set the fill column to 2 and did a refill. That gave me the number with each digit on a single line. I wanted to know the position of each digit. It’s easy to find that out by moving the point to the relevant line and, given that
line-number-mode is on, just reading the line number from the mode line. But I wanted to see the positions for all the lines at once.
I knew there was a command to put each line’s number in the left fringe and had even used it but I couldn’t remember what it was. Furthermore, I couldn’t find it in the documentation. I tried things like
apropos line and
apropos number and other similar constructions but couldn’t find it. Eventually I gave up and started thinking about where I had first seen the command. It seemed to me that it was in an old Emacs-Fu post so I went to DJCB’s blog and did a search on “line number” and the correct post popped right up.
The right answer is
linum-mode. The command name is suggestive of its function but it’s still hard to go from the functionality to the command’s name so I am documenting it here. It’s not a command that I use very often so it’s hard to remember its name but when you need it, nothing else will do.