From: "José L. Doménech" <domenechjosel@gmail.com>
To: "José L. Doménech" <domenechjosel@gmail.com>
Cc: 24620@debbugs.gnu.org, Michael Albinus <michael.albinus@gmx.de>
Subject: bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
Date: Thu, 27 Oct 2016 21:29:30 +0200 [thread overview]
Message-ID: <87insdpp45.wl-domenechjosel@gmail.com> (raw)
In-Reply-To: <CAM-tV-9Xbw97n0ChuhnhaLsbE8MX8wpdf0JQed-j9nFG1rbWKg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 788 bytes --]
On Thu, 27 Oct 2016 20:51:15 +0200,
Noam Postavsky wrote:
>
> On Thu, Oct 27, 2016 at 2:39 PM, José L. Doménech
> <domenechjosel@gmail.com> wrote:
> > I am getting a "replace-regexp-in-string: Invalid use of ‘\’ in replacement text"
> > error using 'shell-quote-argument' on this case.
> >
> > It seems that 'shell-quoted-argument' is adding double '\', that is,
> > '\\', in front of the spaces instead of surrounding the argument with quotes.
> >
> > And 'replace-match' which is called by 'replace-regexp-in-string' for the parameter
> > substitution ("%i", "%o") in the function 'dired-do-compress-to' doesn't like it.
>
> Does passing non-nil for the LITERAL parameter to replace-regexp-in-string help?
>
Yes indeed!
So the patch becomes something like:
[-- Attachment #2: dired-aux.el.patch --]
[-- Type: text/plain, Size: 1181 bytes --]
diff -u /usr/local/share/emacs/26.0.50/lisp/dired-aux.orig.el /usr/local/share/emacs/26.0.50/lisp/dired-aux.el
--- /usr/local/share/emacs/26.0.50/lisp/dired-aux.orig.el 2016-10-27 15:50:50.428634418 +0200
+++ /usr/local/share/emacs/26.0.50/lisp/dired-aux.el 2016-10-27 21:24:29.022566630 +0200
@@ -1013,10 +1013,13 @@
(when (zerop
(dired-shell-command
(replace-regexp-in-string
- "%o" out-file
+ "%o" (shell-quote-argument out-file)
(replace-regexp-in-string
- "%i" (mapconcat #'file-name-nondirectory in-files " ")
- (cdr rule)))))
+ "%i" (mapconcat (lambda (file-desc)
+ (shell-quote-argument
+ (file-name-nondirectory file-desc)))
+ in-files " ")
+ (cdr rule) nil t) nil t)))
(message "Compressed %d file(s) to %s"
(length in-files)
(file-name-nondirectory out-file)))))))
Diff finished. Thu Oct 27 21:24:43 2016
next prev parent reply other threads:[~2016-10-27 19:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-05 7:06 bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters José L. Doménech
2016-10-27 14:03 ` José L. Doménech
2016-10-27 17:19 ` Eli Zaretskii
2016-10-27 17:34 ` Michael Albinus
2016-10-27 18:39 ` José L. Doménech
2016-10-27 18:51 ` Noam Postavsky
2016-10-27 19:29 ` José L. Doménech [this message]
2016-10-27 23:14 ` npostavs
2016-10-28 7:06 ` José L. Doménech
2016-10-29 2:06 ` npostavs
2016-10-29 9:17 ` José L. Doménech
2016-10-29 12:06 ` npostavs
2016-10-29 18:40 ` José L. Doménech
2016-10-29 19:42 ` José L. Doménech
2016-10-30 1:39 ` npostavs
2016-10-30 8:33 ` José L. Doménech
2016-10-29 18:41 ` José L. Doménech
2016-10-28 9:22 ` bug#24620: Forward: " José L. Doménech
2016-10-27 19:31 ` José L. Doménech
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=87insdpp45.wl-domenechjosel@gmail.com \
--to=domenechjosel@gmail.com \
--cc=24620@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
/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).