1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-29 11:02:01 +00:00

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.
This commit is contained in:
Michael Albinus 2019-04-26 12:31:50 +02:00
parent 83cdf7bf15
commit cc70501a3a
2 changed files with 11 additions and 7 deletions

View File

@ -318,10 +318,11 @@ pass to the OPERATION."
operation args))
(archive (tramp-archive-file-name-archive filename)))
;; The file archive could be a directory, see Bug#30293.
(if (and archive
(tramp-archive-run-real-handler
#'file-directory-p (list archive)))
;; `filename' could be a quoted file name. Or the file
;; archive could be a directory, see Bug#30293.
(if (or (null archive)
(tramp-archive-run-real-handler
#'file-directory-p (list archive)))
(tramp-archive-run-real-handler operation args)
;; Now run the handler.
(let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods))
@ -384,6 +385,8 @@ pass to the OPERATION."
(defun tramp-archive-file-name-p (name)
"Return t if NAME is a string with archive file name syntax."
(and (stringp name)
;; `tramp-archive-file-name-regexp' does not suppress quoted file names.
(not (tramp-compat-file-name-quoted-p name t))
;; We cannot use `string-match-p', the matches are used.
(string-match tramp-archive-file-name-regexp name)
t))

View File

@ -198,10 +198,11 @@ It returns a file name which can be used directly as argument of
(if (fboundp 'file-name-quoted-p)
(defalias 'tramp-compat-file-name-quoted-p #'file-name-quoted-p)
(defsubst tramp-compat-file-name-quoted-p (name)
(defsubst tramp-compat-file-name-quoted-p (name &optional top)
"Whether NAME is quoted with prefix \"/:\".
If NAME is a remote file name, check the local part of NAME."
(string-prefix-p "/:" (tramp-compat-file-local-name name))))
If NAME is a remote file name and TOP is nil, check the local part of NAME."
(let ((file-name-handler-alist (unless top file-name-handler-alist)))
(string-prefix-p "/:" (tramp-compat-file-local-name name)))))
(if (fboundp 'file-name-quote)
(defalias 'tramp-compat-file-name-quote #'file-name-quote)