From 46304c474c433a98ad55198e1fbdb0b1136645c1 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 8 Jun 2020 10:18:35 +0200 Subject: [PATCH] Add autoload problem in tramp-crypt.el. * lisp/net/tramp-crypt.el (tramp-crypt-encfs-config): Add ;;;###tramp-autoload cookie. (tramp-crypt-directories): Move it up. (tramp-crypt-file-name-p): Move it up. Add ;;;###tramp-autoload cookie. Make it a defsubst. * test/lisp/net/tramp-tests.el (tramp-crypt): Do not require. --- lisp/net/tramp-crypt.el | 36 ++++++++++++++++++++---------------- test/lisp/net/tramp-tests.el | 2 -- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index 1df38c3121b..220a4add91f 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -114,6 +114,7 @@ initializing a new crypted remote directory." "Non-nil when encryption support is available.") (setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) +;;;###tramp-autoload (defconst tramp-crypt-encfs-config ".encfs6.xml" "Encfs configuration file name.") @@ -123,6 +124,25 @@ initializing a new crypted remote directory." :version "28.1" :type 'booleanp) +;;;###tramp-autoload +(defvar tramp-crypt-directories nil + "List of crypted remote directories.") + +;; It must be a `defsubst' in order to push the whole code into +;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading. +;;;###tramp-autoload +(defsubst tramp-crypt-file-name-p (name) + "Return the crypted remote directory NAME belongs to. +If NAME doesn't belong to a crypted remote directory, retun nil." + (catch 'crypt-file-name-p + (and tramp-crypt-enabled (stringp name) + (not (tramp-compat-file-name-quoted-p name)) + (not (string-suffix-p tramp-crypt-encfs-config name)) + (dolist (dir tramp-crypt-directories) + (and (string-prefix-p + dir (file-name-as-directory (expand-file-name name))) + (throw 'crypt-file-name-p dir)))))) + ;; New handlers should be added here. ;;;###tramp-autoload @@ -249,22 +269,6 @@ arguments to pass to the OPERATION." ;; File name conversions. -;;;###tramp-autoload -(defvar tramp-crypt-directories nil - "List of crypted remote directories.") - -(defun tramp-crypt-file-name-p (name) - "Return the crypted remote directory NAME belongs to. -If NAME doesn't belong to a crypted remote directory, retun nil." - (catch 'crypt-file-name-p - (and tramp-crypt-enabled (stringp name) - (not (tramp-compat-file-name-quoted-p name)) - (not (string-suffix-p tramp-crypt-encfs-config name)) - (dolist (dir tramp-crypt-directories) - (and (string-prefix-p - dir (file-name-as-directory (expand-file-name name))) - (throw 'crypt-file-name-p dir)))))) - (defun tramp-crypt-config-file-name (vec) "Return the encfs config file name for VEC." (expand-file-name diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 25faf4e0fba..7faa409f2f0 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5595,8 +5595,6 @@ This does not support some special file names." (string-equal "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) -(require 'tramp-crypt) - (defun tramp--test-crypt-p () "Check, whether the remote directory is crypted" (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) -- 2.39.2