branch: elpa/magit
commit 429ae02da4e4d9793bb586fe8c855dd8793efe60
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit-auto-revert-mode--disable: Handle unbound magit-auto-revert-mode
    
    Since `magit-auto-revert-mode' is initialized using
    `magit-custom-initialize-after-init' and that initially just uses
    `internal--define-uninitialized-variable', the mode variable is
    undefined until after `after-init-hook' has run.
    
    Closes https://github.com/magit/magit/issues/5476#issuecomment-3498563123.
---
 lisp/magit-autorevert.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-autorevert.el b/lisp/magit-autorevert.el
index 100b0dba997..ff54bb32337 100644
--- a/lisp/magit-autorevert.el
+++ b/lisp/magit-autorevert.el
@@ -151,7 +151,8 @@ seconds of user inactivity.  That is not desirable."
 
 (defun magit-auto-revert-mode--disable ()
   "When enabling `global-auto-revert-mode', disable `magit-auto-revert-mode'."
-  (when (and global-auto-revert-mode magit-auto-revert-mode)
+  (when (and global-auto-revert-mode
+             (bound-and-true-p magit-auto-revert-mode))
     (magit-auto-revert-mode -1)))
 
 (add-hook 'global-auto-revert-mode-hook #'magit-auto-revert-mode--disable)

Reply via email to