Some Tramp cleanups, mainly in tramp-crypt.el

* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
Add `add-name-to-file', `make-directory-internal',
`make-nearby-temp-file', `temporary-file-directory' and
`unhandled-file-name-directory'.
(tramp-crypt-file-name-for-operation):
Use `tramp-compat-temporary-file-directory'.
(tramp-crypt-do-encrypt-or-decrypt-file-name)
(tramp-crypt-do-encrypt-or-decrypt-file): Fix syntax error in
`tramp-error'.

* lisp/net/tramp.el (tramp-autoload-file-name-handler):
* lisp/net/tramp-rclone.el (tramp-rclone-mounted-p)
(tramp-rclone-flush-directory-cache):
Use `tramp-compat-temporary-file-directory'.
This commit is contained in:
Michael Albinus 2020-06-18 20:00:26 +02:00
parent 363d981811
commit 7a37460f92
3 changed files with 13 additions and 12 deletions

View file

@ -146,7 +146,7 @@ If NAME doesn't belong to a crypted remote directory, retun nil."
;;;###tramp-autoload
(defconst tramp-crypt-file-name-handler-alist
'((access-file . tramp-crypt-handle-access-file)
;; (add-name-to-file . tramp-crypt-handle-not-implemented)
(add-name-to-file . tramp-handle-add-name-to-file)
;; `byte-compiler-base-file-name' performed by default handler.
(copy-directory . tramp-handle-copy-directory)
(copy-file . tramp-crypt-handle-copy-file)
@ -198,8 +198,8 @@ If NAME doesn't belong to a crypted remote directory, retun nil."
(load . tramp-handle-load)
(make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
(make-directory . tramp-crypt-handle-make-directory)
;; (make-directory-internal . tramp-crypt-handle-not-implemented)
;; (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-directory-internal . ignore)
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-handle-make-symbolic-link)
(process-file . ignore)
@ -212,11 +212,11 @@ If NAME doesn't belong to a crypted remote directory, retun nil."
(shell-command . ignore)
(start-file-process . ignore)
;; `substitute-in-file-name' performed by default handler.
;; (temporary-file-directory . tramp-crypt-handle-temporary-file-directory)
(temporary-file-directory . tramp-handle-temporary-file-directory)
;; `tramp-get-remote-gid' performed by default handler.
;; `tramp-get-remote-uid' performed by default handler.
(tramp-set-file-uid-gid . tramp-crypt-handle-set-file-uid-gid)
;; (unhandled-file-name-directory . ignore)
(unhandled-file-name-directory . ignore)
(vc-registered . ignore)
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
(write-region . tramp-handle-write-region))
@ -230,8 +230,8 @@ Operations not mentioned here will be handled by the default Emacs primitives.")
;; if it is remote. So we check a possible second argument.
(unless (tramp-crypt-file-name-p tfnfo)
(setq tfnfo (apply
#'tramp-file-name-for-operation
operation (cons temporary-file-directory (cdr args)))))
#'tramp-file-name-for-operation operation
(cons (tramp-compat-temporary-file-directory) (cdr args)))))
tfnfo))
(defun tramp-crypt-run-real-handler (operation args)
@ -413,7 +413,7 @@ Otherwise, return NAME."
crypt-vec (if (eq op 'encrypt) "encode" "decode")
(tramp-compat-temporary-file-directory) localname)
(tramp-error
crypt-vec "%s of file name %s failed."
crypt-vec 'file-error "%s of file name %s failed."
(if (eq op 'encrypt) "Encoding" "Decoding") name))
(with-current-buffer (tramp-get-connection-buffer crypt-vec)
(goto-char (point-min))
@ -448,7 +448,7 @@ Raise an error if this fails."
(file-name-directory infile)
(concat "/" (file-name-nondirectory infile)))
(tramp-error
crypt-vec "%s of file %s failed."
crypt-vec 'file-error "%s of file %s failed."
(if (eq op 'encrypt) "Encrypting" "Decrypting") infile))
(with-current-buffer (tramp-get-connection-buffer crypt-vec)
(write-region nil nil outfile)))))

View file

@ -459,7 +459,7 @@ file names."
;; to cache a nil result.
(or (tramp-get-connection-property
(tramp-get-connection-process vec) "mounted" nil)
(let* ((default-directory temporary-file-directory)
(let* ((default-directory (tramp-compat-temporary-file-directory))
(mount (shell-command-to-string "mount -t fuse.rclone")))
(tramp-message vec 6 "%s" "mount -t fuse.rclone")
(tramp-message vec 6 "\n%s" mount)
@ -485,7 +485,8 @@ file names."
;; crash Emacs for some processes. So we use
;; "pidof", which might not work everywhere.
(if (<= emacs-major-version 25)
(let ((default-directory temporary-file-directory))
(let ((default-directory
(tramp-compat-temporary-file-directory)))
(mapcar
#'string-to-number
(split-string

View file

@ -2450,7 +2450,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
"Load Tramp file name handler, and perform OPERATION."
(tramp-unload-file-name-handlers)
(when tramp-mode
(let ((default-directory temporary-file-directory))
(let ((default-directory (tramp-compat-temporary-file-directory)))
(load "tramp" 'noerror 'nomessage)))
(apply operation args)))