diff options
| author | Michael Albinus | 2020-06-08 10:18:35 +0200 |
|---|---|---|
| committer | Michael Albinus | 2020-06-08 10:18:35 +0200 |
| commit | 46304c474c433a98ad55198e1fbdb0b1136645c1 (patch) | |
| tree | c79325025ad5c790dc3d2bce74ae0f99583c980c | |
| parent | 80abaea1d9c6f1e53fe88befe16de3b219cdd919 (diff) | |
| download | emacs-46304c474c433a98ad55198e1fbdb0b1136645c1.tar.gz emacs-46304c474c433a98ad55198e1fbdb0b1136645c1.zip | |
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.
| -rw-r--r-- | lisp/net/tramp-crypt.el | 36 | ||||
| -rw-r--r-- | 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." | |||
| 114 | "Non-nil when encryption support is available.") | 114 | "Non-nil when encryption support is available.") |
| 115 | (setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) | 115 | (setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) |
| 116 | 116 | ||
| 117 | ;;;###tramp-autoload | ||
| 117 | (defconst tramp-crypt-encfs-config ".encfs6.xml" | 118 | (defconst tramp-crypt-encfs-config ".encfs6.xml" |
| 118 | "Encfs configuration file name.") | 119 | "Encfs configuration file name.") |
| 119 | 120 | ||
| @@ -123,6 +124,25 @@ initializing a new crypted remote directory." | |||
| 123 | :version "28.1" | 124 | :version "28.1" |
| 124 | :type 'booleanp) | 125 | :type 'booleanp) |
| 125 | 126 | ||
| 127 | ;;;###tramp-autoload | ||
| 128 | (defvar tramp-crypt-directories nil | ||
| 129 | "List of crypted remote directories.") | ||
| 130 | |||
| 131 | ;; It must be a `defsubst' in order to push the whole code into | ||
| 132 | ;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading. | ||
| 133 | ;;;###tramp-autoload | ||
| 134 | (defsubst tramp-crypt-file-name-p (name) | ||
| 135 | "Return the crypted remote directory NAME belongs to. | ||
| 136 | If NAME doesn't belong to a crypted remote directory, retun nil." | ||
| 137 | (catch 'crypt-file-name-p | ||
| 138 | (and tramp-crypt-enabled (stringp name) | ||
| 139 | (not (tramp-compat-file-name-quoted-p name)) | ||
| 140 | (not (string-suffix-p tramp-crypt-encfs-config name)) | ||
| 141 | (dolist (dir tramp-crypt-directories) | ||
| 142 | (and (string-prefix-p | ||
| 143 | dir (file-name-as-directory (expand-file-name name))) | ||
| 144 | (throw 'crypt-file-name-p dir)))))) | ||
| 145 | |||
| 126 | 146 | ||
| 127 | ;; New handlers should be added here. | 147 | ;; New handlers should be added here. |
| 128 | ;;;###tramp-autoload | 148 | ;;;###tramp-autoload |
| @@ -249,22 +269,6 @@ arguments to pass to the OPERATION." | |||
| 249 | 269 | ||
| 250 | ;; File name conversions. | 270 | ;; File name conversions. |
| 251 | 271 | ||
| 252 | ;;;###tramp-autoload | ||
| 253 | (defvar tramp-crypt-directories nil | ||
| 254 | "List of crypted remote directories.") | ||
| 255 | |||
| 256 | (defun tramp-crypt-file-name-p (name) | ||
| 257 | "Return the crypted remote directory NAME belongs to. | ||
| 258 | If NAME doesn't belong to a crypted remote directory, retun nil." | ||
| 259 | (catch 'crypt-file-name-p | ||
| 260 | (and tramp-crypt-enabled (stringp name) | ||
| 261 | (not (tramp-compat-file-name-quoted-p name)) | ||
| 262 | (not (string-suffix-p tramp-crypt-encfs-config name)) | ||
| 263 | (dolist (dir tramp-crypt-directories) | ||
| 264 | (and (string-prefix-p | ||
| 265 | dir (file-name-as-directory (expand-file-name name))) | ||
| 266 | (throw 'crypt-file-name-p dir)))))) | ||
| 267 | |||
| 268 | (defun tramp-crypt-config-file-name (vec) | 272 | (defun tramp-crypt-config-file-name (vec) |
| 269 | "Return the encfs config file name for VEC." | 273 | "Return the encfs config file name for VEC." |
| 270 | (expand-file-name | 274 | (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." | |||
| 5595 | (string-equal | 5595 | (string-equal |
| 5596 | "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) | 5596 | "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) |
| 5597 | 5597 | ||
| 5598 | (require 'tramp-crypt) | ||
| 5599 | |||
| 5600 | (defun tramp--test-crypt-p () | 5598 | (defun tramp--test-crypt-p () |
| 5601 | "Check, whether the remote directory is crypted" | 5599 | "Check, whether the remote directory is crypted" |
| 5602 | (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) | 5600 | (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) |