diff options
| author | Oleh Krehel | 2016-08-29 10:35:34 +0200 |
|---|---|---|
| committer | Oleh Krehel | 2016-08-29 10:35:34 +0200 |
| commit | 67a01490934ba5a43b68b7141b20bc8e636ed7c5 (patch) | |
| tree | 6186534b619bef44c4b732a9ae174ab9953c3815 | |
| parent | 5214cc8e9d2a9cf461b8307daa2c15a5c9c69049 (diff) | |
| download | emacs-67a01490934ba5a43b68b7141b20bc8e636ed7c5.tar.gz emacs-67a01490934ba5a43b68b7141b20bc8e636ed7c5.zip | |
Make dired-do-compress understand files with spaces in them
* lisp/dired-aux.el (dired-compress-file): Add `shell-quote-argument'
and `literal' flag to `replace-regexp-in-string'.
| -rw-r--r-- | lisp/dired-aux.el | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 4bdded35fe5..9e0943ac7f0 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -1049,10 +1049,12 @@ Return nil if no change in files." | |||
| 1049 | (prog1 (setq newname (file-name-as-directory newname)) | 1049 | (prog1 (setq newname (file-name-as-directory newname)) |
| 1050 | (dired-shell-command | 1050 | (dired-shell-command |
| 1051 | (replace-regexp-in-string | 1051 | (replace-regexp-in-string |
| 1052 | "%o" newname | 1052 | "%o" (shell-quote-argument newname) |
| 1053 | (replace-regexp-in-string | 1053 | (replace-regexp-in-string |
| 1054 | "%i" file | 1054 | "%i" (shell-quote-argument file) |
| 1055 | command)))) | 1055 | command |
| 1056 | nil t) | ||
| 1057 | nil t))) | ||
| 1056 | ;; We found an uncompression rule. | 1058 | ;; We found an uncompression rule. |
| 1057 | (when (not | 1059 | (when (not |
| 1058 | (dired-check-process | 1060 | (dired-check-process |
| @@ -1072,10 +1074,12 @@ Return nil if no change in files." | |||
| 1072 | (default-directory (file-name-directory file))) | 1074 | (default-directory (file-name-directory file))) |
| 1073 | (dired-shell-command | 1075 | (dired-shell-command |
| 1074 | (replace-regexp-in-string | 1076 | (replace-regexp-in-string |
| 1075 | "%o" out-name | 1077 | "%o" (shell-quote-argument out-name) |
| 1076 | (replace-regexp-in-string | 1078 | (replace-regexp-in-string |
| 1077 | "%i" (file-name-nondirectory file) | 1079 | "%i" (shell-quote-argument (file-name-nondirectory file)) |
| 1078 | (cadr suffix)))) | 1080 | (cadr suffix) |
| 1081 | nil t) | ||
| 1082 | nil t)) | ||
| 1079 | out-name))) | 1083 | out-name))) |
| 1080 | (let ((out-name (concat file ".gz"))) | 1084 | (let ((out-name (concat file ".gz"))) |
| 1081 | (and (or (not (file-exists-p out-name)) | 1085 | (and (or (not (file-exists-p out-name)) |