As this answer explains, the Dired function dired-copy-filename-as-kill
(0 w
) lets one add the path of the file at point to the kill ring. However, I would like to use this path on Eshell, where characters such as SPC need to be escaped. Is there a way to copy the path to the kill ring with the relevant characters escaped, or to transform a previous kill so as to escape these characters?
Asked
Active
Viewed 153 times
0

Pablo
- 3
- 2
-
If the filepath contains space, you could use quote to surround it like `cd "a folder with space"`. – Ynjxsjmh Mar 12 '21 at 14:07
-
Does `shell-quote-argument` help? – Drew Mar 12 '21 at 17:12
-
So far, I've only needed to escape spaces, so enclosing the path in quotes solves my problem. Thank you! – Pablo Mar 12 '21 at 18:52
1 Answers
0
You're probably looking for C-hf eshell-quote-argument
.

phils
- 71,335
- 11
- 153
- 198
-
Thanks, this expands on @Ynjxsjmh's comment above. I see that one can customize the variable ```eshell-special-chars-outside-quoting``` to set the characters that need escaping. – Pablo Mar 13 '21 at 13:09
-
`(mapcar #'char-to-string eshell-special-chars-outside-quoting)` if you want to see that list in a friendlier format. – phils Mar 13 '21 at 13:19