aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2020-06-18 20:00:26 +0200
committerMichael Albinus2020-06-18 20:00:26 +0200
commit7a37460f929a5ea3c9ea7b7ca8d5cc1575dea686 (patch)
treef4f488b06e3353b1bc833d47d34f764ef6e34ac7
parent363d981811ef828606c0344a9d525b444551c7de (diff)
downloademacs-7a37460f929a5ea3c9ea7b7ca8d5cc1575dea686.tar.gz
emacs-7a37460f929a5ea3c9ea7b7ca8d5cc1575dea686.zip
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'.
-rw-r--r--lisp/net/tramp-crypt.el18
-rw-r--r--lisp/net/tramp-rclone.el5
-rw-r--r--lisp/net/tramp.el2
3 files changed, 13 insertions, 12 deletions
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 2eb3b9f8b7d..c859af83cd6 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -146,7 +146,7 @@ If NAME doesn't belong to a crypted remote directory, retun nil."
146;;;###tramp-autoload 146;;;###tramp-autoload
147(defconst tramp-crypt-file-name-handler-alist 147(defconst tramp-crypt-file-name-handler-alist
148 '((access-file . tramp-crypt-handle-access-file) 148 '((access-file . tramp-crypt-handle-access-file)
149 ;; (add-name-to-file . tramp-crypt-handle-not-implemented) 149 (add-name-to-file . tramp-handle-add-name-to-file)
150 ;; `byte-compiler-base-file-name' performed by default handler. 150 ;; `byte-compiler-base-file-name' performed by default handler.
151 (copy-directory . tramp-handle-copy-directory) 151 (copy-directory . tramp-handle-copy-directory)
152 (copy-file . tramp-crypt-handle-copy-file) 152 (copy-file . tramp-crypt-handle-copy-file)
@@ -198,8 +198,8 @@ If NAME doesn't belong to a crypted remote directory, retun nil."
198 (load . tramp-handle-load) 198 (load . tramp-handle-load)
199 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) 199 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
200 (make-directory . tramp-crypt-handle-make-directory) 200 (make-directory . tramp-crypt-handle-make-directory)
201 ;; (make-directory-internal . tramp-crypt-handle-not-implemented) 201 (make-directory-internal . ignore)
202 ;; (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) 202 (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
203 (make-process . ignore) 203 (make-process . ignore)
204 (make-symbolic-link . tramp-handle-make-symbolic-link) 204 (make-symbolic-link . tramp-handle-make-symbolic-link)
205 (process-file . ignore) 205 (process-file . ignore)
@@ -212,11 +212,11 @@ If NAME doesn't belong to a crypted remote directory, retun nil."
212 (shell-command . ignore) 212 (shell-command . ignore)
213 (start-file-process . ignore) 213 (start-file-process . ignore)
214 ;; `substitute-in-file-name' performed by default handler. 214 ;; `substitute-in-file-name' performed by default handler.
215 ;; (temporary-file-directory . tramp-crypt-handle-temporary-file-directory) 215 (temporary-file-directory . tramp-handle-temporary-file-directory)
216 ;; `tramp-get-remote-gid' performed by default handler. 216 ;; `tramp-get-remote-gid' performed by default handler.
217 ;; `tramp-get-remote-uid' performed by default handler. 217 ;; `tramp-get-remote-uid' performed by default handler.
218 (tramp-set-file-uid-gid . tramp-crypt-handle-set-file-uid-gid) 218 (tramp-set-file-uid-gid . tramp-crypt-handle-set-file-uid-gid)
219 ;; (unhandled-file-name-directory . ignore) 219 (unhandled-file-name-directory . ignore)
220 (vc-registered . ignore) 220 (vc-registered . ignore)
221 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime) 221 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
222 (write-region . tramp-handle-write-region)) 222 (write-region . tramp-handle-write-region))
@@ -230,8 +230,8 @@ Operations not mentioned here will be handled by the default Emacs primitives.")
230 ;; if it is remote. So we check a possible second argument. 230 ;; if it is remote. So we check a possible second argument.
231 (unless (tramp-crypt-file-name-p tfnfo) 231 (unless (tramp-crypt-file-name-p tfnfo)
232 (setq tfnfo (apply 232 (setq tfnfo (apply
233 #'tramp-file-name-for-operation 233 #'tramp-file-name-for-operation operation
234 operation (cons temporary-file-directory (cdr args))))) 234 (cons (tramp-compat-temporary-file-directory) (cdr args)))))
235 tfnfo)) 235 tfnfo))
236 236
237(defun tramp-crypt-run-real-handler (operation args) 237(defun tramp-crypt-run-real-handler (operation args)
@@ -413,7 +413,7 @@ Otherwise, return NAME."
413 crypt-vec (if (eq op 'encrypt) "encode" "decode") 413 crypt-vec (if (eq op 'encrypt) "encode" "decode")
414 (tramp-compat-temporary-file-directory) localname) 414 (tramp-compat-temporary-file-directory) localname)
415 (tramp-error 415 (tramp-error
416 crypt-vec "%s of file name %s failed." 416 crypt-vec 'file-error "%s of file name %s failed."
417 (if (eq op 'encrypt) "Encoding" "Decoding") name)) 417 (if (eq op 'encrypt) "Encoding" "Decoding") name))
418 (with-current-buffer (tramp-get-connection-buffer crypt-vec) 418 (with-current-buffer (tramp-get-connection-buffer crypt-vec)
419 (goto-char (point-min)) 419 (goto-char (point-min))
@@ -448,7 +448,7 @@ Raise an error if this fails."
448 (file-name-directory infile) 448 (file-name-directory infile)
449 (concat "/" (file-name-nondirectory infile))) 449 (concat "/" (file-name-nondirectory infile)))
450 (tramp-error 450 (tramp-error
451 crypt-vec "%s of file %s failed." 451 crypt-vec 'file-error "%s of file %s failed."
452 (if (eq op 'encrypt) "Encrypting" "Decrypting") infile)) 452 (if (eq op 'encrypt) "Encrypting" "Decrypting") infile))
453 (with-current-buffer (tramp-get-connection-buffer crypt-vec) 453 (with-current-buffer (tramp-get-connection-buffer crypt-vec)
454 (write-region nil nil outfile))))) 454 (write-region nil nil outfile)))))
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index f635d3cbb68..3701bfc22c9 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -459,7 +459,7 @@ file names."
459 ;; to cache a nil result. 459 ;; to cache a nil result.
460 (or (tramp-get-connection-property 460 (or (tramp-get-connection-property
461 (tramp-get-connection-process vec) "mounted" nil) 461 (tramp-get-connection-process vec) "mounted" nil)
462 (let* ((default-directory temporary-file-directory) 462 (let* ((default-directory (tramp-compat-temporary-file-directory))
463 (mount (shell-command-to-string "mount -t fuse.rclone"))) 463 (mount (shell-command-to-string "mount -t fuse.rclone")))
464 (tramp-message vec 6 "%s" "mount -t fuse.rclone") 464 (tramp-message vec 6 "%s" "mount -t fuse.rclone")
465 (tramp-message vec 6 "\n%s" mount) 465 (tramp-message vec 6 "\n%s" mount)
@@ -485,7 +485,8 @@ file names."
485 ;; crash Emacs for some processes. So we use 485 ;; crash Emacs for some processes. So we use
486 ;; "pidof", which might not work everywhere. 486 ;; "pidof", which might not work everywhere.
487 (if (<= emacs-major-version 25) 487 (if (<= emacs-major-version 25)
488 (let ((default-directory temporary-file-directory)) 488 (let ((default-directory
489 (tramp-compat-temporary-file-directory)))
489 (mapcar 490 (mapcar
490 #'string-to-number 491 #'string-to-number
491 (split-string 492 (split-string
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3a8a51fd4ad..7bb9e422a50 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2450,7 +2450,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2450 "Load Tramp file name handler, and perform OPERATION." 2450 "Load Tramp file name handler, and perform OPERATION."
2451 (tramp-unload-file-name-handlers) 2451 (tramp-unload-file-name-handlers)
2452 (when tramp-mode 2452 (when tramp-mode
2453 (let ((default-directory temporary-file-directory)) 2453 (let ((default-directory (tramp-compat-temporary-file-directory)))
2454 (load "tramp" 'noerror 'nomessage))) 2454 (load "tramp" 'noerror 'nomessage)))
2455 (apply operation args))) 2455 (apply operation args)))
2456 2456