[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature Request: Function to quote filenames
From: |
Eli Zaretskii |
Subject: |
Re: Feature Request: Function to quote filenames |
Date: |
Wed, 24 Jun 2015 18:53:27 +0300 |
> From: raman <address@hidden>
> Date: Wed, 24 Jun 2015 08:26:52 -0700
>
> Motivated by the increasing number of filenames that show up with spc,
> "'" and other punctuation characters in their name.
>
> The only helper function Emacs provides today is shell-quote-argument --
> which often doesn't do the trick.
>
> As an example: Given the filename:
>
> Alice's Adventures in Wonderland
>
> (setq f (shell-quote-argument "Alice's Adventures in Wonderland"))
> returns
> "Alice\\'s\\ Adventures\\ in\\ Wonderland"
>
> But invocations like
> (shell-command (format "ls %s" f))
>
> throw an error
It does? What error? I see no error, just a return value meaning
there's no such file.
> it's never obvious what quoting magic to use to get all the cases
> right.
>
> Would be nice if we had a shell-quote-filename elisp function that did
> all of the magic quoting.
The magic, if there is one, depends on the application, because only
the application knows the semantics of the file-name argument for the
program to be invoked. So I don't see how a general-purpose utility
function could solve the problem. Unless I misunderstand the problem
you have.