branch: elpa/magit
commit 4ccf2f658875325ae488173f6507be70263a2b35
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit--refresh-buffer*: Handle undisplayed buffer case more explicitly
---
lisp/magit-mode.el | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index c02fb3ea88d..ecd34033c5b 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1112,20 +1112,22 @@ Run hooks `magit-pre-refresh-hook' and
`magit-post-refresh-hook'."
(save-excursion (funcall fn)))))))
(defun magit--refresh-buffer-get-positions ()
- (let ((buffer (current-buffer)))
- (mapcan (lambda (window)
- (with-selected-window window
- (with-current-buffer buffer
- (and-let* ((section (magit-section-at)))
- `((,window
- ,section
- ,@(magit-section-get-relative-position section)))))))
- (or (get-buffer-window-list buffer nil t)
- (list (selected-window))))))
+ (or (let ((buffer (current-buffer)))
+ (mapcan
+ (lambda (window)
+ (with-selected-window window
+ (with-current-buffer buffer
+ (and-let* ((section (magit-section-at)))
+ `((,window
+ ,section
+ ,@(magit-section-get-relative-position section)))))))
+ (get-buffer-window-list buffer nil t)))
+ (and-let* ((section (magit-section-at)))
+ `((nil ,section ,@(magit-section-get-relative-position section))))))
(defun magit--refresh-buffer-set-positions (positions)
(pcase-dolist (`(,window ,section ,line ,char) positions)
- (if (eq (current-buffer) (window-buffer window))
+ (if window
(with-selected-window window
(magit-section-goto-successor section line char))
(magit-section-goto-successor section line char))))