On May 2, 2021, at 10:25 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:


We really should simply speed up `line-number-at-pos`.
It shouldn't be hard.  See below what I do in nlinum.el.

Thanks.  I saw your interesting cached approach mentioned on S.E., but didn’t test it.  It may in fact be good enough for the actual usage case I was having issues with (scrolling in large files).  I don’t love the after-change function, but using one would also permit long-term caching of the “final” line at (point-max), assuming narrow/widen triggers it.