diff options
| author | Alexander Gramiak | 2019-06-24 15:56:32 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-06-24 16:08:12 +0200 |
| commit | c32cc62779ea31200df21c7c02c83bcb33ce7d21 (patch) | |
| tree | 839764acd2658f7f0133335a4ae0bcc2731990e2 /lisp | |
| parent | f9afe8a97eb2b75adf53bb0d7cf2e4f12eb1b3d6 (diff) | |
| download | emacs-c32cc62779ea31200df21c7c02c83bcb33ce7d21.tar.gz emacs-c32cc62779ea31200df21c7c02c83bcb33ce7d21.zip | |
Add Zstandard compression support for dired
* lisp/dired-aux.el (dired-compress-file-suffixes): Add suffixes for
zstd compressed tarballs and other files.
(dired-compress-file): Treat options found in
`dired-compress-file-suffixes' as arguments instead of part of the
program name.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/dired-aux.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 2705c0ad2a3..5e4ec4d1ecb 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -999,6 +999,9 @@ command with a prefix argument (the value does not matter)." | |||
| 999 | ("\\.bz2\\'" "" "bunzip2") | 999 | ("\\.bz2\\'" "" "bunzip2") |
| 1000 | ("\\.xz\\'" "" "unxz") | 1000 | ("\\.xz\\'" "" "unxz") |
| 1001 | ("\\.zip\\'" "" "unzip -o -d %o %i") | 1001 | ("\\.zip\\'" "" "unzip -o -d %o %i") |
| 1002 | ("\\.tar\\.zst\\'" "" "unzstd -c %i | tar -xf -") | ||
| 1003 | ("\\.tzst\\'" "" "unzstd -c %i | tar -xf -") | ||
| 1004 | ("\\.zst\\'" "" "unzstd --rm") | ||
| 1002 | ("\\.7z\\'" "" "7z x -aoa -o%o %i") | 1005 | ("\\.7z\\'" "" "7z x -aoa -o%o %i") |
| 1003 | ;; This item controls naming for compression. | 1006 | ;; This item controls naming for compression. |
| 1004 | ("\\.tar\\'" ".tgz" nil) | 1007 | ("\\.tar\\'" ".tgz" nil) |
| @@ -1023,6 +1026,7 @@ ARGS are command switches passed to PROGRAM.") | |||
| 1023 | '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o") | 1026 | '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o") |
| 1024 | ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o") | 1027 | ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o") |
| 1025 | ("\\.tar\\.xz\\'" . "tar -cf - %i | xz -c9 > %o") | 1028 | ("\\.tar\\.xz\\'" . "tar -cf - %i | xz -c9 > %o") |
| 1029 | ("\\.tar\\.zst\\'" . "tar -cf - %i | zstd -19 -o %o") | ||
| 1026 | ("\\.zip\\'" . "zip %o -r --filesync %i")) | 1030 | ("\\.zip\\'" . "zip %o -r --filesync %i")) |
| 1027 | "Control the compression shell command for `dired-do-compress-to'. | 1031 | "Control the compression shell command for `dired-do-compress-to'. |
| 1028 | 1032 | ||
| @@ -1108,12 +1112,17 @@ Return nil if no change in files." | |||
| 1108 | nil t) | 1112 | nil t) |
| 1109 | nil t))) | 1113 | nil t))) |
| 1110 | ;; We found an uncompression rule. | 1114 | ;; We found an uncompression rule. |
| 1111 | (when (not | 1115 | (let ((match (string-match " " command)) |
| 1112 | (dired-check-process | 1116 | (msg (concat "Uncompressing " file))) |
| 1113 | (concat "Uncompressing " file) | 1117 | (unless (if match |
| 1114 | command | 1118 | (dired-check-process msg |
| 1115 | file)) | 1119 | (substring command 0 match) |
| 1116 | newname))) | 1120 | (substring command (1+ match)) |
| 1121 | file) | ||
| 1122 | (dired-check-process msg | ||
| 1123 | command | ||
| 1124 | file)) | ||
| 1125 | newname)))) | ||
| 1117 | (t | 1126 | (t |
| 1118 | ;; We don't recognize the file as compressed, so compress it. | 1127 | ;; We don't recognize the file as compressed, so compress it. |
| 1119 | ;; Try gzip; if we don't have that, use compress. | 1128 | ;; Try gzip; if we don't have that, use compress. |