Subject: [PATCH] Reset mtime of a reverted buffer

From: Konstantin Kharlamov <[email-masked]>
Date: Thu, 05 Aug 2021 18:28:28 +0300

Patch is attached. This resolves the problem reported at https://github.com/emacs-evil/evil/issues/1504

From 99266c4ba2d0391572a9b06149a0f50031bb44a2 Mon Sep 17 00:00:00 2001
From: Konstantin Kharlamov <[email-masked]>
Date: Thu, 5 Aug 2021 18:25:56 +0300
Subject: [PATCH] Reset mtime of a reverted buffer

* lisp/files.el (revert-buffer-insert-file-contents-delicately):
Once buffer is reverted, reset its mtime to that of the file.
---
 lisp/files.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index 2b13d04bcbe..c2607956915 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6533,7 +6533,8 @@ revert-buffer-insert-file-contents-delicately
       ;; See comments in revert-buffer-with-fine-grain for an explanation.
       (defun revert-buffer-with-fine-grain-success-p ()
         success))
-    (set-buffer-modified-p nil))))
+    (set-buffer-modified-p nil)
+    (set-visited-file-modtime))))
 
 (defun revert-buffer-with-fine-grain (&optional ignore-auto noconfirm)
   "Revert buffer preserving markers, overlays, etc.
-- 
2.32.0