Subject: bug#43412: [FEATURE] autorevert-only-if-visible [PATCH]

From: Boruch Baum <[email-masked]>
Date: Tue, 29 Sep 2020 09:05:20 -0400

On 2020-09-18 09:49, martin rudalics wrote:
> If you have any further questions, please ask.

Thanks for the informative response. None of the symbols you mentioned
are available in the emacs version I normally use, so they were all new
to me. I do have two follow-up questions that could save me some time:

1) For function `window-buffer-change-functions' when set globally: the
docstring says that it takes an arg FRAME. During execution of those
functions, will that arg necessarily be `(selected-frame)'?

2) For function `window-buffer-change-functions' when set buffer-local:
Is there a straightforward way to ensure that the value will be set for
all buffers, current and future? This would be subtly different from the
description of what occurs when setting the value globally, because no
window-walk would be required, and it wouldn't be triggered by window
deletion events. All I see is `buffer-list-update-hook' which is run by
`get-buffer-create' (OK), but it's also run by ‘make-indirect-buffer’,
‘rename-buffer’, ‘kill-buffer’, ‘bury-buffer-internal’ and
‘select-window’ (all unnecessary for setting a buffer-local value in
`window-buffer-change-functions').

> When these added functions (probably it's one and the same function) are
> run, one can use 'window-old-buffer', 'frame-old-selected-window',
> 'old-selected-window' and 'old-selected-frame' to individually check
> what has changed since the last time.  For example, to find out whether
> a window on the frame reported by 'window-buffer-change-functions' has
> changed its buffer, 'walk-window-tree' for that frame with a function
> that checks whether 'window-buffer' for any such window differs from
> 'window-old-buffer'.  If it does differ, you probably want to check
> whether that buffer should be reverted.

> For 'window-selection-change-functions' you probably want to just check
> whether the buffer of the selected window of the reported frame should
> be reverted.  I would avoid using 'window-configuration-change-hook'
> because that hook also triggers when a window changed its size.  All
> hooks are described in detail in section "28.28 Hooks for Window
> Scrolling and Changes" of the Elisp manual.

Slightly off-topic: The 'describe-*' output for these symbols all have
an ambiguous statement "Probably introduced at or before Emacs version
27.1". What's that 'probably' all about? Shouldn't the statement be
unequivocal, at least for recently added symbols?

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0