Source code at Lisp:lineno.el.

Last year I wrote lineno.el, which works on any size files. Rather than making line numbers for the whole buffer, it just displays them for the lines visible in the selected window, updating them as the buffer is edited or the location changed. That way the actual size of the file does not matter. I don't use it much, but it seems to work well.

russell young

On a larger buffer with line numbers, when I do C-x 2 to split the window and then scroll one of them, the numbers in the other window vanish.

Yes, that is the way it works - it draws in the current window. It would not be too hard to make it work in multiple windows, but it didn't really seem necessary to how I wanted to use it. (you would have to use buffer-window-count to find how many and what windows it is showed in, and replace the local variables with lists)

If I had time to go in and fix something, the highest priority would be to make it work with ediff. It has essentially the same problem there, the numbers are updated from inside post-command-hook, if the buffer is changed in some way that is not a command the update function is not called.

ry

I find that the redraw operation to put in the line numbers makes the text "jitter" uncomfortably to the right as I page up and down the buffer.  First the text is drawn by Emacs, then the line number routine redraws it shifted right to put the line numbers it.  It would be nice to hook into the first rendering, instead of hooking in after the first rendering is already done.  But it does put the line numbers in nicely.

I tried [tt]linum[/tt], [tt]nlinim[/tt] and [tt]lineno[/tt] on the sqlite-amalgamation file sqlite3.c (5MB, 148784 lines).
[tt]lineno[/tt] is the only one to be usable on my machine (3.5 GHz Intel Core 7).

--  [http://www.emacswiki.org/emacs/priyadarshan priyadarshan] 2014-08-07 13:56 UTC


----
CategoryDisplay
