GNU bug report logs -
#32672
27.0.50; image resize on window resizing
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Sun, 9 Sep 2018 16:11:02 UTC
Severity: wishlist
Tags: fixed
Fixed in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> But when I tried
>
> (advice-add 'select-window :before
> (lambda (window &optional norecord)
> (message "select-window %S" window)))
>
> it's clear it's unsuitable either. It's not called when needed,
> e.g. when a window displays a new buffer after navigating to it
> with 'C-x <C-left>' (previous-buffer).
Because the selected window does not change, obviously.
> However, I get exactly what is needed with
>
> (advice-add 'set-window-buffer :before
> (lambda (window buffer-or-name &optional keep-margins)
> (message "set-window-buffer %S %S" window buffer-or-name)))
>
> It's called every time when a buffer is displayed in a window.
>
> But unfortunately it has no hook, and (info "(elisp) Buffers and Windows") says
> that set-window-buffer runs window-configuration-change-hook (too general
> for this task since called too often)
Because we run it also whenever a window changes size which is silly.
What else do we have 'window-size-change-functions' for? I wanted to
change that but apparently ducked out.
> and window-scroll-functions
> (also called too often).
> Regarding window-scroll-functions, it would be too strange to use
> it to catch set-window-buffer calls.
>
> (info "(elisp) Window Hooks") says:
>
> There are three actions that can change this: scrolling the window,
> switching buffers in the window, and changing the size of the window.
> The first two actions run ‘window-scroll-functions’; the last runs
> ‘window-size-change-functions’.
>
> Shouldn't the first two actions run separate hooks?
>
> Moreover, it seems window-scroll-functions doesn't work even
> for its purpose: it's not called after scrolling, e.g. not called
> after 'C-l' (recenter-top-bottom) - tried with different prefix args.
Maybe because the buffer of the scrolled window is not current when
you call it.
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.
martin
This bug report was last modified 5 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.