emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b3046c6c1f2: Display unlock-file warning only when file locks are


From: Michael Albinus
Subject: master b3046c6c1f2: Display unlock-file warning only when file locks are enabled
Date: Tue, 4 Apr 2023 03:43:23 -0400 (EDT)

branch: master
commit b3046c6c1f29281e7437d5b6685e230c1cef631c
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Display unlock-file warning only when file locks are enabled
    
    * lisp/files.el (remote-file-name-inhibit-locks): Fix docstring.
    
    * lisp/userlock.el (userlock--handle-unlock-error):
    Display warning only when `create-lockfiles' is non-nil.  (Bug#62614)
    
    * lisp/net/tramp.el (tramp-handle-unlock-file): Raise a warning
    only when `create-lockfiles' is non-nil or
    `remote-file-name-inhibit-locks' is nil.
---
 lisp/files.el     |  2 +-
 lisp/net/tramp.el | 10 ++++++----
 lisp/userlock.el  | 13 +++++++------
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 6f02aac33d3..c6f53e5eaf8 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -555,7 +555,7 @@ using a transform that puts the lock files on a local file 
system."
   :version "28.1")
 
 (defcustom remote-file-name-inhibit-locks nil
-  "Whether to use file locks for remote files."
+  "Whether to create file locks for remote files."
   :group 'files
   :version "28.1"
   :type 'boolean)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b1bd93410bc..eb4cb9ce082 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4791,10 +4791,12 @@ Do not set it manually, it is used buffer-local in 
`tramp-get-lock-pid'.")
           (delete-file lockname)
        ;; Trigger the unlock error.
        (signal 'file-error `("Cannot remove lock file for" ,file)))
-    ;; `userlock--handle-unlock-error' exists since Emacs 28.1.
-    (error
-     (when create-lockfiles
-       (tramp-compat-funcall 'userlock--handle-unlock-error err)))))
+    ;; `userlock--handle-unlock-error' exists since Emacs 28.1.  It
+    ;; checks for `create-lockfiles' since Emacs 30.1, we don't need
+    ;; this chweck here, then.
+    (error (unless (or (not create-lockfiles)
+                       (bound-and-true-p remote-file-name-inhibit-locks))
+             (tramp-compat-funcall 'userlock--handle-unlock-error err)))))
 
 (defun tramp-handle-load (file &optional noerror nomessage nosuffix 
must-suffix)
   "Like `load' for Tramp files."
diff --git a/lisp/userlock.el b/lisp/userlock.el
index 61f061d3e54..562bc0a0a9f 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -206,11 +206,12 @@ file, then make the change again."))
 ;;;###autoload
 (defun userlock--handle-unlock-error (error)
   "Report an ERROR that occurred while unlocking a file."
-  (display-warning
-   '(unlock-file)
-   ;; There is no need to explain that this is an unlock error because
-   ;; ERROR is a `file-error' condition, which explains this.
-   (message "%s, ignored" (error-message-string error))
-   :warning))
+  (when create-lockfiles
+    (display-warning
+     '(unlock-file)
+     ;; There is no need to explain that this is an unlock error because
+     ;; ERROR is a `file-error' condition, which explains this.
+     (message "%s, ignored" (error-message-string error))
+     :warning)))
 
 ;;; userlock.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]