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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 17 Oct 2017 08:44:06 +0300

On October 17, 2017 7:19:14 AM GMT+03:00, Paul Rankin <[email-masked]> wrote:
> On Tue, 17 Oct 2017, at 12:41 PM, Eli Zaretskii wrote:
> > > 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.
> > 
> > But if you always call line-number-display-width, you don't need to
> > know that, because that function will return the current value
> (which
> > will change to reflect the changes in the space taken by line
> > numbers).
> > 
> > So I don't think I understand the problem, and without that I cannot
> > think of a solution.  Can you clarify the problem, please?
> 
> Eli, you’re fundamentally misunderstanding something:
> 
> 1. Your mode updates the display.
> 
> 2. Another lisp program does not know your mode has updated the
> display.
> 
> 3. Therefore, the lisp program will not know to call
> line-number-display-width.
> 
> Your suggestion that other modes should “always” call
> line-number-display-width is what...  to run an infinite loop waiting
> for your mode to furtively update the display and catch it then?

First, let's be clear about something: it's not "my" mode.  I'll never use it, except
for testing and fixing bugs.  I implemented this feature because line numbers are
very popular among Emacs users, and existing solutions, like linum-mode, slow
down Emacs, sometimes to a crawl.  The excitement expressed by users on Reddit
when the feature landed, which surprised me, is a clear evidence that the results
are very satisfactory, as far as users are
concerned.  So this feature is here to
stay, and Lisp packages need to adapt (bundled packages already did, AFAIK).

Next, I *know* that I'm misunderstanding something, but repeating what you
already said, twice, won't help me understand it.  Please provide more
details about your application's needs regarding the window layout.

Given the little that you said until now, would checking the value returned by
line-number-display-width in a post-command-hook solve your problem?
If not, please tell why not, and let's take it from there.

Thanks.