Subject: bug#34138: 27.0.50; Delayed display of PDF file images

From: Eli Zaretskii <[email-masked]>
Date: Wed, 23 Jan 2019 20:39:06 +0200

> Date: Wed, 23 Jan 2019 19:27:24 +0100
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked], [email-masked]
> 
>    (add-hook 'window-configuration-change-hook
> 	    #'image-mode-reapply-winprops nil t))
> 
> Strictly spoken, all of these abuse the concept of hooks.  Making a
> new window, putting an overlay there, setting some properties are
> deterministic actions.  Why do we have to do them from the hook?

I don't know the answer, perhaps Andreas could explain his perspective
on this.

> Running the hooks at late as possible will catch most size changes
> (calculating the mode line height or minibuffer heights) done by
> redisplay so you have the final layout of a frame available when
> running the hooks.

Maybe this means what is now run_window_configuration_change_hook
should be divided into 2 parts: one that only reacts to changes in
dimensions, the other that reacts to new windows and changes in
window-buffer?  The former will want to run at the end of redisplay,
the latter at the beginning, I think.

> Also, I'm still not sure whether running hooks earlier will handle
> 'pdf-view-new-window-function' and 'image-mode-reapply-winprops'
> running the deterministic emacs 26 way.  After all, the idea seems to
> be
> 
> (1) Make the window.
> 
> (2) Run 'image-mode-reapply-winprops'.
> 
> (3) Run 'pdf-view-new-window-function'.
> 
> (4) Continue with overlays and properties set up.
> 
> (5) Redisplay, eventually.
> 
> If anything in (4) needs anything done in (2) and (3), running the
> hooks earlier in redisplay won't help.

I'm not sure I understand why, perhaps because I don't have a clear
idea what you mean by "continuing with overlays".  Please tell more.

> Note: We can always restore the emacs 26 (better emacs 25) way
> 'window-configuration-change-hook' is run.  That won't affect the
> remaining hooks and prevent scenarios as the one found here.

What are the disadvantages of doing that?