From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Oleh Krehel <oleh@oremacs.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Latest commit to dired-aux; maybe add string-multi-replace?
Date: Mon, 29 Aug 2016 07:52:24 -0400 [thread overview]
Message-ID: <CAM-tV-9tM2ofFZydKsP0xamykJsUPJtpZAdpJWhicsVOMvtaoQ@mail.gmail.com> (raw)
In-Reply-To: <87poosj75w.fsf@oremacs.com>
On Mon, Aug 29, 2016 at 4:44 AM, Oleh Krehel <oleh@oremacs.com> 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))))))
next prev parent reply other threads:[~2016-08-29 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-29 8:44 Latest commit to dired-aux; maybe add string-multi-replace? Oleh Krehel
2016-08-29 11:52 ` Noam Postavsky [this message]
2016-08-29 12:04 ` Oleh Krehel
2016-08-29 12:16 ` Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAM-tV-9tM2ofFZydKsP0xamykJsUPJtpZAdpJWhicsVOMvtaoQ@mail.gmail.com \
--to=npostavs@users.sourceforge.net \
--cc=emacs-devel@gnu.org \
--cc=oleh@oremacs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).