branch: elpa/magit
commit 94fcebd26787bdfc1d10bf3d4d7c0477cf07f36c
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-autorevert.el: No longer depend on other parts of Magit
Fixes #5484.
---
lisp/magit-autorevert.el | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/lisp/magit-autorevert.el b/lisp/magit-autorevert.el
index 9a2a580e000..26f141d2683 100644
--- a/lisp/magit-autorevert.el
+++ b/lisp/magit-autorevert.el
@@ -29,10 +29,12 @@
;;; Code:
-(require 'magit-process)
-
(require 'autorevert)
+(declare-function magit-file-tracked-p "magit-git" (file))
+(declare-function magit-toplevel "magit-git" (&optional directory))
+(declare-function magit-git-executable "magit-git" ())
+
;;; Options
(defgroup magit-auto-revert nil
@@ -132,15 +134,17 @@ seconds of user inactivity. That is not desirable."
(defun magit-turn-on-auto-revert-mode-if-desired (&optional file)
(cond (file
- (when-let ((buffer (find-buffer-visiting file)))
- (with-current-buffer buffer
- (magit-turn-on-auto-revert-mode-if-desired))))
+ (let ((buffer (find-buffer-visiting file)))
+ (when buffer
+ (with-current-buffer buffer
+ (magit-turn-on-auto-revert-mode-if-desired)))))
((and (not auto-revert-mode) ; see #3014
(not global-auto-revert-mode) ; see #3460
buffer-file-name
(or auto-revert-remote-files ; see #5422
(not (file-remote-p buffer-file-name)))
(file-readable-p buffer-file-name)
+ (require 'magit-process)
(executable-find (magit-git-executable) t)
(magit-toplevel)
(or (not magit-auto-revert-tracked-only)
@@ -236,6 +240,7 @@ defaults to nil) for any BUFFER."
(unless (and magit-auto-revert-toplevel
(= (cdr magit-auto-revert-toplevel)
magit-auto-revert-counter))
+ (require 'magit-process)
(setq magit-auto-revert-toplevel
(cons (or (magit-toplevel) 'no-repo)
magit-auto-revert-counter)))
@@ -263,15 +268,5 @@ defaults to nil) for any BUFFER."
;;; _
(provide 'magit-autorevert)
-;; Local Variables:
-;; read-symbol-shorthands: (
-;; ("and$" . "cond-let--and$")
-;; ("and>" . "cond-let--and>")
-;; ("and-let" . "cond-let--and-let")
-;; ("if-let" . "cond-let--if-let")
-;; ("when-let" . "cond-let--when-let")
-;; ("while-let" . "cond-let--while-let")
-;; ("match-string" . "match-string")
-;; ("match-str" . "match-string-no-properties"))
-;; End:
+;; `cond-let' intentionally not used.
;;; magit-autorevert.el ends here