summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-02-28 15:33:52 +0100
committerMichael Albinus <michael.albinus@gmx.de>2023-02-28 15:33:52 +0100
commit316ba78a737f0cc775b60775554591fb67722554 (patch)
tree0df49444b3ae29c076fde835e1973c8c1b079c03
parentc5d319af475337beba9a0720a185e4ea3d375e07 (diff)
downloademacs-316ba78a737f0cc775b60775554591fb67722554.tar.gz
Improve warning in tramp-handle-unlock-file
* lisp/net/tramp.el (tramp-connectable-p): Simplify. (tramp-handle-unlock-file): Improve warning.
-rw-r--r--lisp/net/tramp.el25
1 files 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."