unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: James Cherti <contact@jamescherti.com>
Cc: emacs-devel@gnu.org
Subject: Re: Should text-scale trigger hooks?
Date: Thu, 07 Nov 2024 08:55:51 +0200	[thread overview]
Message-ID: <86r07nr0qw.fsf@gnu.org> (raw)
In-Reply-To: <9cf01065-4f23-435b-b895-d02beef860a8@jamescherti.com> (message from James Cherti on Wed, 6 Nov 2024 20:17:50 -0500)

> Date: Wed, 6 Nov 2024 20:17:50 -0500
> From: James Cherti <contact@jamescherti.com>
> 
> I've identified an issue that affects Emacs packages like eat (terminal) 
> and visual-fill-column.
> 
> The core problem is that functions such as text-scale-increase, 
> text-scale-decrease, and text-scale-set do not trigger hooks such as 
> window-configuration-change-hook. Because of that, eat does not 
> instantly update the window when the text scale is changed and 
> visual-fill-column does not update the margin until we resize the window.

There's a huge gape between invocation of text-scale-increase and our
need that window-configuration-change-hook should be run.  I cannot
cross that gap, so please explain the relation between these two, and
in particular why you need that hook to run and not some other
mechanism.

The functions which manipulate face-remapping-alist force redisplay of
the buffer in which the alist was changed, and from Emacs display POV
this is the only thing that should happen to make sure the affected
buffer's display is redrawn.  Please explain why buffer's redisplay is
not enough for the packages you mention to do their job.

OTOH, window-configuration-change-hook is for specific events,
documented thusly:

 -- Variable: window-configuration-change-hook
     This variable specifies functions called during redisplay when
     either the buffer or the size of a window has changed.

text-scale-increase/decrease don't fit this description, so expecting
that hook to be called in those cases is wrong, and asking Emacs to
run that hook is against the documented behavior of the hook.  So if
redisplaying a buffer somehow cannot allow these packages to do their
job (but please explain in detail why), we will have to think about
some different mechanism of doing that;
window-configuration-change-hook doesn't sound like the right tool for
this.

> While these workarounds work, I believe a more robust solution would be 
> to have text-scale functions automatically trigger hooks such as 
> window-configuration-change-hook, or perhaps introduce a dedicated hook 
> for text scale that other plugins could utilize.

As you have discovered, there's already such a hook.  Does it mean
that your problems are solved?



  parent reply	other threads:[~2024-11-07  6:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07  1:17 Should text-scale trigger hooks? James Cherti
2024-11-07  1:52 ` James Cherti
2024-11-07  6:55 ` Eli Zaretskii [this message]
2024-11-07  8:21   ` Joost Kremers
2024-11-07  8:58     ` Eli Zaretskii
2024-11-07  9:42       ` Joost Kremers
2024-11-07 14:16         ` James Cherti
2024-11-08 17:47           ` [External] : " Drew Adams
2024-11-07  8:10 ` Joost Kremers

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=86r07nr0qw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=contact@jamescherti.com \
    --cc=emacs-devel@gnu.org \
    /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).