Function: tramp-handle-unlock-file

tramp-handle-unlock-file is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-handle-unlock-file FILE)

Documentation

Like unlock-file for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-handle-unlock-file (file)
  "Like `unlock-file' for Tramp files."
  (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.  Be quiet if user isn't
	;; interested in lock files.  See Bug#70900.
	(unless (or (not create-lockfiles)
		    (bound-and-true-p remote-file-name-inhibit-locks))
	  (signal 'file-error `("Cannot remove lock file for" ,file))))
    ;; `userlock--handle-unlock-error' exists since Emacs 28.1.  It
    ;; checks for `create-lockfiles' since Emacs 30.1, we don't need
    ;; this check 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)))))