bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24620: Forward: Re: bug#24620: 26.0.50; In dired: 'dired-do-compress


From: José L . Doménech
Subject: bug#24620: Forward: Re: bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
Date: Fri, 28 Oct 2016 11:22:41 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (Gojō) APEL/10.8 EasyPG/1.0.0 Emacs/26.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

On Fri, 28 Oct 2016 01:14:49 +0200,
address@hidden wrote:
> 
> 
> That looks pretty good.  I think it would be even nicer to use the
> `format-spec' function instead of calling `replace-regexp-in-string'
> twice.
> 
> 
Here are the changes:

--- dired-aux.orig.el   2016-10-27 15:50:50.428634418 +0200
+++ dired-aux.el        2016-10-28 09:01:08.413024427 +0200
@@ -1012,11 +1012,15 @@
           (t
            (when (zerop
                   (dired-shell-command
-                   (replace-regexp-in-string
-                    "%o" out-file
-                    (replace-regexp-in-string
-                     "%i" (mapconcat #'file-name-nondirectory in-files " ")
-                     (cdr rule)))))
+                   (format-spec
+                    (cdr rule)
+                    (list (cons ?o (shell-quote-argument out-file))
+                          (cons ?i
+                                (mapconcat
+                                 (lambda (filename)
+                                   (shell-quote-argument
+                                    (file-name-nondirectory filename)))
+                                 in-files " "))))))
              (message "Compressed %d file(s) to %s"
                       (length in-files)
                       (file-name-nondirectory out-file)))))))

Diff finished.  Fri Oct 28 09:01:25 2016





reply via email to

[Prev in Thread] Current Thread [Next in Thread]