diff options
| author | Michael Albinus | 2019-04-26 12:31:50 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-04-26 12:31:50 +0200 |
| commit | cc70501a3a77e2cb8649eee0f0c03689e8232a68 (patch) | |
| tree | cb06da7d7601245cb381b13de7339d4563926580 | |
| parent | 83cdf7bf15d8f80fdc94e2de2ba96323f1d30101 (diff) | |
| download | emacs-cc70501a3a77e2cb8649eee0f0c03689e8232a68.tar.gz emacs-cc70501a3a77e2cb8649eee0f0c03689e8232a68.zip | |
Handle quoted file names in tramp-archive.el
* lisp/net/tramp-archive.el (tramp-archive-file-name-p):
Suppress quoted file names.
(tramp-archive-file-name-handler): Handle quoted file names.
* lisp/net/tramp-compat.el (tramp-compat-file-name-quoted-p):
Add optional TOP argument.
| -rw-r--r-- | lisp/net/tramp-archive.el | 11 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 7 |
2 files changed, 11 insertions, 7 deletions
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index ba4c26cdf2f..b096edc4b36 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el | |||
| @@ -318,10 +318,11 @@ pass to the OPERATION." | |||
| 318 | operation args)) | 318 | operation args)) |
| 319 | (archive (tramp-archive-file-name-archive filename))) | 319 | (archive (tramp-archive-file-name-archive filename))) |
| 320 | 320 | ||
| 321 | ;; The file archive could be a directory, see Bug#30293. | 321 | ;; `filename' could be a quoted file name. Or the file |
| 322 | (if (and archive | 322 | ;; archive could be a directory, see Bug#30293. |
| 323 | (tramp-archive-run-real-handler | 323 | (if (or (null archive) |
| 324 | #'file-directory-p (list archive))) | 324 | (tramp-archive-run-real-handler |
| 325 | #'file-directory-p (list archive))) | ||
| 325 | (tramp-archive-run-real-handler operation args) | 326 | (tramp-archive-run-real-handler operation args) |
| 326 | ;; Now run the handler. | 327 | ;; Now run the handler. |
| 327 | (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) | 328 | (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) |
| @@ -384,6 +385,8 @@ pass to the OPERATION." | |||
| 384 | (defun tramp-archive-file-name-p (name) | 385 | (defun tramp-archive-file-name-p (name) |
| 385 | "Return t if NAME is a string with archive file name syntax." | 386 | "Return t if NAME is a string with archive file name syntax." |
| 386 | (and (stringp name) | 387 | (and (stringp name) |
| 388 | ;; `tramp-archive-file-name-regexp' does not suppress quoted file names. | ||
| 389 | (not (tramp-compat-file-name-quoted-p name t)) | ||
| 387 | ;; We cannot use `string-match-p', the matches are used. | 390 | ;; We cannot use `string-match-p', the matches are used. |
| 388 | (string-match tramp-archive-file-name-regexp name) | 391 | (string-match tramp-archive-file-name-regexp name) |
| 389 | t)) | 392 | t)) |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index e3d03435691..ae743b2507c 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -198,10 +198,11 @@ It returns a file name which can be used directly as argument of | |||
| 198 | 198 | ||
| 199 | (if (fboundp 'file-name-quoted-p) | 199 | (if (fboundp 'file-name-quoted-p) |
| 200 | (defalias 'tramp-compat-file-name-quoted-p #'file-name-quoted-p) | 200 | (defalias 'tramp-compat-file-name-quoted-p #'file-name-quoted-p) |
| 201 | (defsubst tramp-compat-file-name-quoted-p (name) | 201 | (defsubst tramp-compat-file-name-quoted-p (name &optional top) |
| 202 | "Whether NAME is quoted with prefix \"/:\". | 202 | "Whether NAME is quoted with prefix \"/:\". |
| 203 | If NAME is a remote file name, check the local part of NAME." | 203 | If NAME is a remote file name and TOP is nil, check the local part of NAME." |
| 204 | (string-prefix-p "/:" (tramp-compat-file-local-name name)))) | 204 | (let ((file-name-handler-alist (unless top file-name-handler-alist))) |
| 205 | (string-prefix-p "/:" (tramp-compat-file-local-name name))))) | ||
| 205 | 206 | ||
| 206 | (if (fboundp 'file-name-quote) | 207 | (if (fboundp 'file-name-quote) |
| 207 | (defalias 'tramp-compat-file-name-quote #'file-name-quote) | 208 | (defalias 'tramp-compat-file-name-quote #'file-name-quote) |