[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Latest commit to dired-aux; maybe add string-multi-replace?
From: |
Noam Postavsky |
Subject: |
Re: Latest commit to dired-aux; maybe add string-multi-replace? |
Date: |
Mon, 29 Aug 2016 07:52:24 -0400 |
On Mon, Aug 29, 2016 at 4:44 AM, Oleh Krehel <address@hidden> wrote:
> Hi all,
>
> I just fixed the `dired-do-compress' command to work with files and
> directories that have spaces in them.
>
> After the fix, I saw this pattern repeat:
>
> (dired-shell-command
> (replace-regexp-in-string
> "%o" (shell-quote-argument out-name)
> (replace-regexp-in-string
> "%i" (shell-quote-argument (file-name-nondirectory file))
> (cadr suffix)
> nil t)
> nil t))
>
> I've seen the pattern of nested `replace-regexp-in-string' quite a few
> times before. It doesn't look great.
What about using `format-spec'? I think that would be:
(dired-shell-command
(format-spec (cadr suffix)
`((?o . ,(shell-quote-argument out-name))
(?i . ,(shell-quote-argument
(file-name-nondirectory file))))))