diff options
| author | Michal Nazarewicz <mina86@mina86.com> | 2021-02-10 19:31:20 +0100 |
|---|---|---|
| committer | Vedang Manerikar <ved.manerikar@gmail.com> | 2021-02-20 11:00:58 +0530 |
| commit | 34a794d8bd402003458b19ebc0a76c90098161c6 (patch) | |
| tree | b48c6f8e298e169f54dc8f2d391b1d56c47f18ee /lisp/pdf-virtual.el | |
| parent | 101dc0ed44ead82b643b87c15b44336f718e42f8 (diff) | |
Don’t record temporary window selection changes
There are places with code similar to the following:
(save-selected-window
(select-window window)
…)
For the purposes of this commit, this is roughly equivalent to:
(let ((old-window (selected-window)))
(select-window window)
…
(select-window old-window 'norecord))
That is, when ‘save-selected-window’ restores the state, it passes
‘norecord’ argument to ‘select-window’ function. As a result, when
selected window is initially changed ‘buffer-list-update-hook’ is
called however it is not invoked when selected window is restored.
This confuses any code using that hook to track selected window.
To address this issue, change calls such as the above to use
‘norecord’ argument. This way, ‘buffer-list-update-hook’ is called
neither when the new window is temporarily selected nor when old
window is restored.
For reference, this is indeed what documentation of ‘select-window’
says should be done:
> Run ‘buffer-list-update-hook’ unless NORECORD is non-nil. Note that
> applications […] often select a window temporarily […] to simplify
> coding. As a rule, such selections should not be recorded and
> therefore will not pollute ‘buffer-list-update-hook’. Selections
> that "really count" are those causing a visible change in the next
> redisplay of WINDOW’s frame and should always be recorded.
Fixes: https://github.com/mina86/auto-dim-other-buffers.el/issues/26
Diffstat (limited to 'lisp/pdf-virtual.el')
| -rw-r--r-- | lisp/pdf-virtual.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/pdf-virtual.el b/lisp/pdf-virtual.el index 5d6458f..6f2cb85 100644 --- a/lisp/pdf-virtual.el +++ b/lisp/pdf-virtual.el @@ -567,7 +567,7 @@ PAGE should be a page-number." (defun pdf-virtual-view-window-p (&optional window) (save-selected-window - (when window (select-window window)) + (when window (select-window window 'norecord)) (derived-mode-p 'pdf-virtual-view-mode))) (defun pdf-virtual-filename-p (filename) |
