unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Rankin <hello@paulwrankin.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 28844@debbugs.gnu.org
Subject: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook
Date: Sun, 15 Oct 2017 23:27:53 +1000	[thread overview]
Message-ID: <1508074073.3557079.1139314312.4BFE5BC2@webmail.messagingengine.com> (raw)
In-Reply-To: <59E350AE.3060005@gmx.at>

On Sun, 15 Oct 2017, at 10:12 PM, martin rudalics wrote:
>  > Thanks for pointing me to display-line-numbers-mode-hook, but I’ve
>  > found that it’s not enough to just check when the mode is enabled. We
>  > need to alert other concerned modes whenever display-line-numbers-mode
>  > changes the margins, e.g. due to scrolling from line 99 to 100 (which
>  > will increase the width from 2 to 3).
> 
> That's what I meant when I said that
> 
>    "if you need such a hook, wouldn't you also need it when line numbers
>    occupy more or less columns, for example, during scrolling?”

Ah sorry Maritn. While trying the mode hook solution I forgot about your initial response!
 
> You could use ‘window-scroll-functions’ (remembering the old line number
> widths) for scrolling but this would not handle simple point movements.

window-scroll-functions doesn’t quite cut it.... 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))

> Eli will decide what to do.  If an existing hook must be chosen, I'd
> rather (mis-)use ‘window-size-change-functions’ - strictly spoken,
> display of line numbers never affects the size of windows (something
> which is not true vice-versa IIUC).  But better, provide a separate hook
> like ‘line-number-width-changed-functions’ with the corresponding window
> as argument (and maybe the old line number width as second).

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.

Think we can get this fixed before 26.1? I assume this might effect #28248 too...





  reply	other threads:[~2017-10-15 13:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-15  7:56 bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook Paul Rankin
2017-10-15  9:41 ` martin rudalics
2017-10-15 11:08   ` Paul Rankin
2017-10-15 12:12     ` martin rudalics
2017-10-15 13:27       ` Paul Rankin [this message]
2017-10-15 14:59         ` Eli Zaretskii
2017-10-16  3:22           ` Paul Rankin
2017-10-16  4:59             ` Alex
2017-10-16  5:14               ` Paul Rankin
2017-10-16 14:48                 ` Eli Zaretskii
2017-10-17  0:35                   ` Paul Rankin
2017-10-17  2:41                     ` Eli Zaretskii
2017-10-17  4:19                       ` Paul Rankin
2017-10-17  5:44                         ` Eli Zaretskii
2017-10-17  7:13                           ` Paul Rankin
2017-10-17  8:33                             ` Eli Zaretskii
2017-10-20  9:42                               ` Eli Zaretskii
2017-12-08  2:43                             ` Noam Postavsky
2017-12-08 14:48                               ` Eli Zaretskii
2017-12-09 15:30                               ` Paul Rankin
2017-12-09 16:01                                 ` Eli Zaretskii
2017-10-15 14:47       ` Eli Zaretskii
2017-10-16  7:41         ` martin rudalics
2017-10-22  7:20 ` Paul Rankin
2017-10-22 14:27   ` Eli Zaretskii
2017-12-08  2:14 ` Paul Rankin
2017-12-08 15:22   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508074073.3557079.1139314312.4BFE5BC2@webmail.messagingengine.com \
    --to=hello@paulwrankin.com \
    --cc=28844@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).