File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1041,7 +1041,7 @@ Typing these will trigger reindentation of the current line.")
1041
1041
; ; modification time of the file on save and on buffer switch.
1042
1042
(defvar-local +auto-revert-buffer-time nil )
1043
1043
(defun +file-mtime (file)
1044
- (when-let* ((file-attr (and file (file-attributes file))))
1044
+ (when-let* ((file-attr (and file (file-exists-p file) ( file- attributes file))))
1045
1045
(file-attribute-modification-time file-attr)))
1046
1046
1047
1047
(defun +auto-revert--save-file-mtime (&rest _args)
@@ -1054,9 +1054,10 @@ Typing these will trigger reindentation of the current line.")
1054
1054
(defun +auto-revert--on-buffer-switch-h (_frame)
1055
1055
(unless +auto-revert-buffer-time
1056
1056
(setq +auto-revert-buffer-time (+file-mtime buffer-file-name)))
1057
- (unless (equal +auto-revert-buffer-time (+file-mtime buffer-file-name))
1058
- (+log! " File %S modified externally, reverting immediately!" buffer-file-name)
1059
- (revert-buffer t t )))
1057
+ (when-let* ((mtime (+file-mtime buffer-file-name)))
1058
+ (unless (equal mtime +auto-revert-buffer-time)
1059
+ (+log! " File %S modified externally, reverting immediately!" buffer-file-name)
1060
+ (revert-buffer t t ))))
1060
1061
1061
1062
(add-hook 'window-buffer-change-functions #'+auto-revert--on-buffer-switch-h ))
1062
1063
You can’t perform that action at this time.
0 commit comments