Subject: bug#32672: 27.0.50; image resize on window resizing

From: Juri Linkov <[email-masked]>
Date: Mon, 24 Sep 2018 21:38:59 +0300

>> I don't know what to do.  We run hooks too often and do not provide
>> sufficient information when running them.  Sometimes we even hide
>> information when running a hook.  The problem is that changing the
>> current situation will have us either run even more hooks or cause
>> protests when a hook is no more run where it was run before.
>
> I agree.  I think Lisp programs that use hooks provided by
> display-related code should generally expect to be called in many
> unrelated situations, and do whatever it takes by themselves to detect
> when it's "their" use case.  Expectations or requests for more focused
> hooks are impractical or even not feasible to implement, because core
> code knows very little about the Lisp application which uses the hook.

I think window hook calls should be consistent at least with own inner logic,
e.g. as the semantics of the window-size-change-functions hook name suggests
it should be called when the window size is not the same as was before,
window-configuration-change-hook is called when the result of window-state-get
is not the same as it was before, etc.

This poses a question what a programmer is supposed to do when a hook is
more general, how to filter out the wanted notifications when the hook
is fired more often than needed.  We already have a working solution
in form of window-pixel-width-before-size-change, that could be extended
to other hooks, thus they could report the reason of their calls
exposing more their meta information, e.g. window-configuration-change-hook
to report that only one buffer in one particular window was switched.

So either we need more specific hooks, or allow general hooks report
the details inscluding the reasons of their calls.