emacs-diffs
[Top][All Lists]
Advanced

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

master 316ba78a737: Improve warning in tramp-handle-unlock-file


From: Michael Albinus
Subject: master 316ba78a737: Improve warning in tramp-handle-unlock-file
Date: Tue, 28 Feb 2023 09:34:12 -0500 (EST)

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

    Improve warning in tramp-handle-unlock-file
    
    * lisp/net/tramp.el (tramp-connectable-p): Simplify.
    (tramp-handle-unlock-file): Improve warning.
---
 lisp/net/tramp.el | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 2110d815c95..633086fc822 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2947,7 +2947,7 @@ not in completion mode."
     (or ;; We check this for the process related to
        ;; `tramp-buffer-name'; otherwise `start-file-process'
        ;; wouldn't run ever when `non-essential' is non-nil.
-        (and vec (process-live-p (get-process (tramp-buffer-name vec))))
+        (process-live-p (tramp-get-process vec))
        (not non-essential))))
 
 (defun tramp-completion-handle-expand-file-name (filename &optional directory)
@@ -4778,17 +4778,18 @@ Do not set it manually, it is used buffer-local in 
`tramp-get-lock-pid'.")
 
 (defun tramp-handle-unlock-file (file)
   "Like `unlock-file' for Tramp files."
-  ;; When there is no connection, we don't do it.  Otherwise,
-  ;; functions like `kill-buffer' would try to reestablish the
-  ;; connection.  See Bug#61663.
-  (when-let ((v (tramp-dissect-file-name file))
-            (p (tramp-get-process v))
-            ((process-live-p p))
-            (lockname (tramp-compat-make-lock-file-name file)))
-    (condition-case err
-        (delete-file lockname)
-      ;; `userlock--handle-unlock-error' exists since Emacs 28.1.
-      (error (tramp-compat-funcall 'userlock--handle-unlock-error err)))))
+  (condition-case err
+      ;; When there is no connection, we don't do it.  Otherwise,
+      ;; functions like `kill-buffer' would try to reestablish the
+      ;; connection.  See Bug#61663.
+      (if-let ((v (tramp-dissect-file-name file))
+              ((process-live-p (tramp-get-process v)))
+              (lockname (tramp-compat-make-lock-file-name file)))
+          (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 (tramp-compat-funcall 'userlock--handle-unlock-error err))))
 
 (defun tramp-handle-load (file &optional noerror nomessage nosuffix 
must-suffix)
   "Like `load' for Tramp files."



reply via email to

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