summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-02-03 14:21:23 +0100
committerMichael Albinus <michael.albinus@gmx.de>2022-02-03 14:21:23 +0100
commit895562a8b24fc637fb422d38ea64e7d445b3480d (patch)
treedde4c209104e3c100be362433278bd2bde74523d /lisp/net
parent3bd8a8bb91d5bf56216541f359c69c789c942b16 (diff)
downloademacs-895562a8b24fc637fb422d38ea64e7d445b3480d.tar.gz
emacs-895562a8b24fc637fb422d38ea64e7d445b3480d.tar.bz2
emacs-895562a8b24fc637fb422d38ea64e7d445b3480d.zip
Implement file modification check in Tramp
* lisp/net/tramp.el (tramp-handle-lock-file): Check, whether FILE is modified. * test/lisp/net/tramp-tests.el (tramp-test39-detect-external-change): New test.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c6e55ff6889..121ede42c43 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4008,6 +4008,14 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
;; was visited.
(catch 'dont-lock
(unless (eq (file-locked-p file) t) ;; Locked by me.
+ (when (and buffer-file-truename
+ (not (verify-visited-file-modtime))
+ (file-exists-p file))
+ ;; In filelock.c, `userlock--ask-user-about-supersession-threat'
+ ;; is called, which also checks file contents. This is unwise
+ ;; for remote files.
+ (ask-user-about-supersession-threat file))
+
(when-let ((info (tramp-get-lock-file file))
(match (string-match tramp-lock-file-info-regexp info)))
(unless (ask-user-about-lock