ReallyRussell · 2022-05-25 19:22
When I narrow a file down to a region containing a single function, the line numbers restart at one, and I would like to be able to make references based on the actual line number in the file.
natarey · 2022-05-25 22:24
There's a StackExchange answer that may help:
https://emacs.stackexchange.com/questions/48581/how-to-display-absolute-line-numbers-of-a-full-widened-buffer-when-narrowing-to
jumpUpHigh · 2022-05-26 03:38
Wow, the Emacs developer community thought of this early enough to introduce it directly in the underlying C code.
b3n · 2022-05-26 08:44
(setq-default display-line-numbers-widen t)
b3n · 2022-05-26 08:47
I'm not sure what you mean by "early enough"; the C code is not fixed in time. This was added to `src/xdisp.c` in 2017.
jumpUpHigh · 2022-05-26 15:11
It was not sarcastic. Someone designed the display-line-numbers with the narrow/widen in mind, which is awesome.
ReallyRussell · 2022-05-27 00:58
>(setq-default display-line-numbers-widen t)
Thank you.
This is exactly what I need.
It modifies the number from \`display-line-numbers\`
I normally use \`global-linum-mode\` which puts the numbers in the gutter/fringe.
Is there something similar for that?