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

From: martin rudalics <[email-masked]>
Date: Tue, 25 Sep 2018 19:56:09 +0200

>> I'm not sure what you mean with "Those functions".
 >
 > I mean window-state-change-functions, what else?

That would be a hook and would indeed have to do the work.  But why
the plural?

 > We are talking about hypothetical function(s), so it may well be that
 > there's some misunderstanding.  My point is that accurate recording of
 > window-size changes is hard, because the various variables used for
 > that might be outdated (e.g., due top a redisplay cycle that didn't
 > complete).  Also, redisplay_internal, which calls those functions,
 > will sometimes call them more than once in a redisplay cycle (see the
 > 'retry' label and code that jumps back to it).
 >
 > Bottom line is what I said up-thread: Lisp programs cannot expect
 > those hook calls to be too accurate and focused, they need to be
 > prepared to handle many irrelevant calls, and they had better have
 > their own bookkeeping regarding window dimensions etc.

'window-size-change-functions' is not hypothetical and guards itself
against running twice for unchanged window sizes.  I don't really
understand what you doubt here - I rewrote it in its current form
because you once said (when discussing Bug#21333) that

 > I believe window-size-change-functions is meant for taking notice of
 > resizes done by the user or some Lisp code, not for automated resizes
 > whose sole purpose is to allow some message be read in its entirety.
 > If you agree, then the current behavior will make sense to you.
 >
 > If anything, IMO we should _reduce_ the number of unrelated events
 > that trigger a call to these functions.  For example, currently any
 > command that reads from the minibuffer will trigger it, because when
 > read-from-minibuffer exits, it restores the window configuration by
 > calling set-window-configuration, which is documented to trigger these
 > functions.  That just doesn't make any sense to me, since most reads
 > from the minibuffer don't resize any windows!

and in a later post you said

 > I'd say, don't set the "size changed" flag unless the size really
 > changed.

and now it seems that you think that a similar argument does not apply
when running 'window-configuration-change-hook'.

I'd still need to see a hypothetical example where the same redisplay
cycle would run 'window-size-change-functions' functions twice when no
sizes actually changed.

martin