branch: elpa/magit
commit 79adfbb22c398d7a273cc57c82037c2031216927
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-find-file-noselect: Check auto-revert-mode in correct buffer
In [1: efaf91d8af] we started checking whether `auto-revert-buffer'
is enabled in the current buffer, but that is likely Magit's status
buffer.
Also, to be on the safe side, cons onto the existing value of
`revert-without-query', instead of overriding it.
1: 2025-08-26 efaf91d8af17a99ec0c5d6ae8c151ba6319fa2f1
magit-find-file-noselect: Auto-revert worktree file
---
lisp/magit-files.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lisp/magit-files.el b/lisp/magit-files.el
index ec6648ea7e9..f1d3f63154e 100644
--- a/lisp/magit-files.el
+++ b/lisp/magit-files.el
@@ -117,8 +117,12 @@ A non-nil value for REVERT is ignored if REV is
\"{worktree}\"."
(defdir (file-name-directory file-abs))
(rev (magit--abbrev-if-hash rev)))
(if (equal rev "{worktree}")
- (let ((revert-without-query (and auto-revert-mode '("."))))
- (find-file-noselect file-abs))
+ (let ((revert-without-query
+ (if (and$ (find-buffer-visiting file-abs)
+ (buffer-local-value 'auto-revert-mode $))
+ (cons "." revert-without-query)
+ revert-without-query)))
+ (find-file-noselect file-abs))
(with-current-buffer (magit-get-revision-buffer-create rev file-rel)
(when (or (not magit-buffer-file-name)
(if (eq revert 'ask-revert)