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

From: Paul Rankin <[email-masked]>
Date: Fri, 08 Dec 2017 12:14:02 +1000

Eli, I understand that your blindness to this bug is probably due to your own bias. I get it, you wrote the code, you enjoyed the previously mentioned reddit upvotes for it, I understand you don’t want to admit that your code has flaws. But you need to understand that your way of seeing things is subjective and not universal.

The bug is that when the user scrolls up or down, past a point where the width of the line numbers changes from e.g. 99 to the number width from 2 to 3 thus making the width of line number display change from 4 to 5, display-line-numbers-mode necessarily changes the window display configuration to accommodate this character.

However, display-line-numbers-mode doesn’t appear to tell the rest of Emacs about this change, so even if we all wanted to accommodate your display changes, as far as I can tell, we cannot.

It’s nice that you added the token function line-number-display-width, but aside from the bug with its return value being off by 2 (#29597), this function is not useful unless other lisp programs know *when* to call it.

The easiest solution, the one that baffles me why you haven’t just included already rather than continue to argue with me, is that when display-line-numbers-mode changes the window, you run window-configuration-change-hook.

If, for some Eli-reason, you don’t want to run window-configuration-change-hook, you can add a simple hook, which gets run whenever display-line-numbers-mode needs to change the window configuration. Then other lisp programs can call line-number-display-width, and provided its bug gets fixed and it returns the correct width, everyone is happy.

Is there anything about this that’s not clear to you?