Like most terminals, Emacs' term
has a scrollback limit -- which will naturally mess with the consistency of linum's counting, as lines will be deleted from the beginning of the buffer.
The term-buffer-maximum-size
variable controls this, and sure enough it has a default value of 2048.
So linum was telling you the truth: the terminal buffer was never more than 2049 lines long at any time.
If you customize this variable1 and set the default value to zero, Emacs will not delete lines in this way, so linum will remain accurate. Of course without this protection, a runaway -- or intentional -- process outputting vast amounts of data into the terminal may cause Emacs to eat up large amounts of memory.
Failing that, I'd say don't use linum and term together.
1 Start here: C-hv term-buffer-maximum-size
C-x 3
to split the window and then I openedterm
withM-x term
. When compiling the numbers stop increasing in 2049 meaning that all lines would have sometimes the number 2048 and sometimes 2049. Never less never more. At the end of the compilation procedure there would always be 2049.