bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28844: 26.0.90; display-line-numbers-mode should call window-configu


From: Eli Zaretskii
Subject: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook
Date: Sun, 15 Oct 2017 17:59:04 +0300

> From: Paul Rankin <hello@paulwrankin.com>
> Date: Sun, 15 Oct 2017 23:27:53 +1000
> Cc: 28844@debbugs.gnu.org
> 
> This is all I should have to do, where WINDOW is the selected window and 
> MARGIN is an integer:
> 
> -      (set-window-margins window margin margin))
> +      (set-window-margins window (if (featurep 'display-line-numbers)
> +                                     (- margin (line-number-display-width))
> +                                   margin)
> +                          margin))

Exactly.  So why do you need a hook?  Just call this every time you
need the value, and you will have the up-to-date one.

> Cool. As long as there is a hook. I appreciate inclusion of the function 
> line-number-display-width, but introducing compatibility-breaking code then 
> putting the onus on others to work around it is kinda rude. If there is a 
> proper hook it eases the pain a bit.

If that's the problem, then you could provide a wrapper around
line-number-display-width for older versions of Emacs, which would
always return zero for those versions.  Or even explicitly check for
display-line-numbers being nil, which it always will be in older
versions, and return zero even without calling
line-number-display-width.  I believe this is the standard way of
dealing with these problems.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]