Improve warning in tramp-handle-unlock-file
* lisp/net/tramp.el (tramp-connectable-p): Simplify. (tramp-handle-unlock-file): Improve warning.
This commit is contained in:
parent
c5d319af47
commit
316ba78a73
1 changed files with 13 additions and 12 deletions
|
@ -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."
|
||||
|
|
Loading…
Add table
Reference in a new issue