Subject: bug#56682: locked narrowing

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 Aug 2022 21:29:29 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Wed, 17 Aug 2022 13:58:21 -0400
> 
> > Why can't you simply use the same code maybe_produce_line_number uses
> > for that?
> 
> Because I can't find that code.

What do you mean? it's in maybe_produce_line_number, obviously...

> Apparently `maybe_produce_line_number`
> just uses `w->base_line_number` whenever it's not 0, so apparently it's
> set to 0 elsewhere.

It's set to zero in several places in xdisp.c.

But again, if you don't want to trust the cached values, just use
display_count_lines starting from BOB.

> > Why does it matter which line numbers you compute if they are never
> > displayed?
> 
> They may be displayed at some other time: nlinum-mode won't be invoked
> if that same portion of the buffer becomes visible later on (it's just
> like font-lock: the highlighting applied stays until something like the
> after-change-function causes it to be refreshed).

Then invalidate the information on that portion when the buffer
becomes displayed, and let the code count again.