summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-10-14 09:34:40 +0200
committerMichael Albinus <michael.albinus@gmx.de>2023-10-14 09:34:40 +0200
commitdc8b336d0254d751ffcb2466a20a650ca9c5f86a (patch)
treec2498f9aa881674609cecddd0b301791e9a4985b /lisp/files.el
parentc8ea14e7825d536f41a230fc1298341a2462635e (diff)
downloademacs-dc8b336d0254d751ffcb2466a20a650ca9c5f86a.tar.gz
emacs-dc8b336d0254d751ffcb2466a20a650ca9c5f86a.tar.bz2
emacs-dc8b336d0254d751ffcb2466a20a650ca9c5f86a.zip
* lisp/files.el (file-name-non-special): Handle quoted tilde.
(Bug#65685) * test/lisp/files-tests.el (files-tests-file-name-non-special-expand-file-name-tilde): New test.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..8b5cb4964cc 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -8185,13 +8185,12 @@ arguments as the running Emacs)."
;; Get a list of the indices of the args that are file names.
(file-arg-indices
(cdr (or (assq operation
- '(;; The first eight are special because they
+ '(;; The first seven are special because they
;; return a file name. We want to include
;; the /: in the return value. So just
;; avoid stripping it in the first place.
(abbreviate-file-name)
(directory-file-name)
- (expand-file-name)
(file-name-as-directory)
(file-name-directory)
(file-name-sans-versions)
@@ -8200,6 +8199,10 @@ arguments as the running Emacs)."
;; `identity' means just return the first
;; arg not stripped of its quoting.
(substitute-in-file-name identity)
+ ;; `expand-file-name' shall do special case
+ ;; for the first argument starting with
+ ;; "/:~". (Bug#65685)
+ (expand-file-name expand-file-name)
;; `add' means add "/:" to the result.
(file-truename add 0)
;;`insert-file-contents' needs special handling.
@@ -8255,6 +8258,10 @@ arguments as the running Emacs)."
(let ((tramp-mode (and tramp-mode (eq method 'local-copy))))
(pcase method
('identity (car arguments))
+ ('expand-file-name
+ (when (string-prefix-p "/:~" (car arguments))
+ (setcar arguments (file-name-unquote (car arguments) t)))
+ (apply operation arguments))
('add (file-name-quote (apply operation arguments) t))
('buffer-file-name
(let ((buffer-file-name (file-name-unquote buffer-file-name t)))