diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2019-08-12 16:18:59 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2019-08-12 16:18:59 +0200 |
commit | 88006cf542ed99ca8236c9b61c6b19b732353d6c (patch) | |
tree | b5fb0de0d700d7fa47476fab1be7f79644d9bbd4 /lisp/net/tramp-compat.el | |
parent | f7b5e7d72d1648831fca3fc79cb134eab3407aa1 (diff) | |
download | emacs-88006cf542ed99ca8236c9b61c6b19b732353d6c.tar.gz |
Quote file names properly in Tramp
* lisp/net/tramp.el (tramp-handle-file-truename)
(tramp-handle-insert-directory):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-truename):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-truename)
(tramp-sh-handle-insert-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-truename):
Use `tramp-compat-directory-name-p'.
* lisp/net/tramp.el (tramp-drop-volume-letter)
(tramp-handle-file-truename):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-truename):
* lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link)
(tramp-sh-handle-file-truename):
* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-truename):
(tramp-sudoedit-handle-make-symbolic-link): Quote properly.
* lisp/net/tramp-compat.el (tramp-compat-file-name-quote)
(tramp-compat-file-name-unquote): Add optional argument TOP.
Diffstat (limited to 'lisp/net/tramp-compat.el')
-rw-r--r-- | lisp/net/tramp-compat.el | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index fca2654bee7..e83c1a1500b 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -227,24 +227,31 @@ If NAME is a remote file name and TOP is nil, check the local part of NAME." (string-prefix-p "/:" (tramp-compat-file-local-name name)))))) (defalias 'tramp-compat-file-name-quote - (if (fboundp 'file-name-quote) + (if (and + (fboundp 'file-name-quote) + (equal (tramp-compat-funcall 'func-arity #'file-name-quote) '(1 . 2))) #'file-name-quote - (lambda (name) + (lambda (name &optional top) "Add the quotation prefix \"/:\" to file NAME. -If NAME is a remote file name, the local part of NAME is quoted." - (if (tramp-compat-file-name-quoted-p name) - name - (concat - (file-remote-p name) "/:" (tramp-compat-file-local-name name)))))) +If NAME is a remote file name and TOP is nil, the local part of NAME is quoted." + (let ((file-name-handler-alist (unless top file-name-handler-alist))) + (if (tramp-compat-file-name-quoted-p name top) + name + (concat + (file-remote-p name) "/:" (tramp-compat-file-local-name name))))))) (defalias 'tramp-compat-file-name-unquote - (if (fboundp 'file-name-unquote) + (if (and + (fboundp 'file-name-unquote) + (equal (tramp-compat-funcall 'func-arity #'file-name-unquote) '(1 . 2))) #'file-name-unquote - (lambda (name) + (lambda (name &optional top) "Remove quotation prefix \"/:\" from file NAME. -If NAME is a remote file name, the local part of NAME is unquoted." - (let ((localname (tramp-compat-file-local-name name))) - (when (tramp-compat-file-name-quoted-p localname) +If NAME is a remote file name and TOP is nil, the local part of +NAME is unquoted." + (let* ((file-name-handler-alist (unless top file-name-handler-alist)) + (localname (tramp-compat-file-local-name name))) + (when (tramp-compat-file-name-quoted-p localname top) (setq localname (if (= (length localname) 2) "/" (substring localname 2)))) (concat (file-remote-p name) localname))))) |