all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Rankin <hello@paulwrankin.com>
Cc: 28844@debbugs.gnu.org
Subject: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook
Date: Fri, 08 Dec 2017 17:22:35 +0200	[thread overview]
Message-ID: <837etxw8g4.fsf@gnu.org> (raw)
In-Reply-To: <1512699242.3658603.1198014544.7EB49FB0@webmail.messagingengine.com> (message from Paul Rankin on Fri, 08 Dec 2017 12:14:02 +1000)

> From: Paul Rankin <hello@paulwrankin.com>
> Cc: eliz@gnu.org
> Date: Fri, 08 Dec 2017 12:14:02 +1000
> 
> 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.

Nevertheless modes like tabulated-list-mode, the list-packages display
based on it, and others have been adapted to this new feature.  Which
means that doing so is not only possible, it is also relatively easy.

Your mode needs to do something similar.  I'm willing to help if you
answer a few questions, so I understand the expectations of your users
better than I do now.

> 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.

You are wrong here on both counts: the value of 2 is not a bug (see
how display-line-numbers.el uses this if you want to understand the
details); and the function is useful enough to be the basis for all
the adaptations I did in core Emacs features (some of them are
mentioned above).

I'm quite sure this function will also allow to adapt your package to
this feature.  A little cooperation from you is all that is required.
We could already have this solved, if we hadn't wasted time on these
futile arguments.

> 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.

I explained why this would be a bad idea in several related
discussions.  I invite you to read them, if you want to understand my
reasons better, and I'm willing to answer further questions regarding
those issues.

Of course, you don't _need_ to read those discussions and/or dig into
the related code and understand it, if you don't want to.  You could
instead simply trust me when I say, based on some years of hacking the
Emacs display code: THIS IS A BAD IDEA!  So bad that if someone wants
to implement it against my best judgment, they will need to do that
over my dead body.

> 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.

See above: you are talking out of lack of knowledge.  You don't know
and don't understand how this feature works, how it plugs into the
Emacs display code, and therefore cannot appreciate what havoc will be
caused by running any such hooks when line numbers are being rendered.
I do understand all that stuff, and that is why I'm opposed to doing
it.  And based on my experience of adapting several Emacs features to
the line-number display, I can be confident that such a hook is not
needed, that existing APIs, including line-number-display-width, are
enough.

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

The only thing that is not clear to me is why do you prefer to attack
me personally instead of trying to adapt your package to Emacs
development.  Don't you want your package to be used by many people
who like line numbers in their buffers?  Then please drop the
attitude, and let's instead work together to make those adaptations.





      reply	other threads:[~2017-12-08 15:22 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
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 [this message]

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

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

  git send-email \
    --in-reply-to=837etxw8g4.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=28844@debbugs.gnu.org \
    --cc=hello@paulwrankin.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.