Subject: Re: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook

From: Paul Rankin <[email-masked]>
Date: Tue, 17 Oct 2017 10:35:57 +1000

On Tue, 17 Oct 2017, at 12:48 AM, Eli Zaretskii wrote:
> > From: Paul Rankin <[email-masked]>
> > Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> > Date: Mon, 16 Oct 2017 15:14:10 +1000
> > 
> > > To see if line numbers are present in a buffer (and to make it
> > > compatible with older Emacsen), you should use something like:
> > > 
> > > (bound-and-true-p display-line-numbers)
> 
> Indeed, if the problem is with determining whether
> line-number-display-width should be called, then bound-and-true-p is
> the way.  Sorry I didn't realize this was the issue.
> 
> > Sweet, thanks! I’ve encountered another bug with this mode #28855, so I think until it gets its house in order, the best thing to go with is:
> > (if (bound-and-true-p display-line-numbers) (display-line-numbers-mode 0))
> 
> So does this mean the issue in this bug report (which AFAIU was how to
> set the window's display margins in a way that is sensitive to
> display-line-numbers-mode) is resolved for you?  Or is there anything
> else to be done about this?  (Bug#28855 is a separate issue, I will
> respond to that there.)

Your mode updates the display on its own without notifying Emacs. The basic conceptual problem is that “every time you need the value” is predicated on when display-line-numbers-mode changes the value. There’s no way for another lisp program to know when that is.