summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé L. Doménech <domenechjosel@gmail.com>2016-10-29 21:18:31 -0400
committerNoam Postavsky <npostavs@gmail.com>2016-10-29 21:32:11 -0400
commit27443df092bfb4ada559f8fc024e01f174a5bcb0 (patch)
tree265c70d278d6ac6d898a2ef502ad235a1fe711ef
parent966b73b3163416adf09bcff7418ecc9fa5a554c9 (diff)
downloademacs-27443df092bfb4ada559f8fc024e01f174a5bcb0.tar.gz
Quote file names in dired compression commands
* lisp/dired-aux.el (dired-do-compress-to): Change the string used as shell command for compression by quoting the filenames used for input and output (Bug #24620).
-rw-r--r--lisp/dired-aux.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d25352ec5bc..972b6b1ade0 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1012,11 +1012,13 @@ and `dired-compress-files-alist'."
(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)
+ `((?\o . ,(shell-quote-argument out-file))
+ (?\i . ,(mapconcat
+ (lambda (file-desc)
+ (shell-quote-argument (file-name-nondirectory
+ file-desc)))
+ in-files " "))))))
(message "Compressed %d file(s) to %s"
(length in-files)
(file-name-nondirectory out-file)))))))