emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7a37460 1/2: Some Tramp cleanups, mainly in tramp-crypt.el


From: Michael Albinus
Subject: master 7a37460 1/2: Some Tramp cleanups, mainly in tramp-crypt.el
Date: Thu, 18 Jun 2020 14:00:49 -0400 (EDT)

branch: master
commit 7a37460f929a5ea3c9ea7b7ca8d5cc1575dea686
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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'.
---
 lisp/net/tramp-crypt.el  | 18 +++++++++---------
 lisp/net/tramp-rclone.el |  5 +++--
 lisp/net/tramp.el        |  2 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 2eb3b9f..c859af8 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."
 ;;;###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)))))
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index f635d3c..3701bfc 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -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
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3a8a51f..7bb9e42 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."
   "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)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]