emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 6d6bf46 2/2: Make dired-do-compress work for *.tar.


From: Oleh Krehel
Subject: [Emacs-diffs] master 6d6bf46 2/2: Make dired-do-compress work for *.tar.gz files
Date: Tue, 13 Oct 2015 13:53:55 +0000

branch: master
commit 6d6bf466477b004035a4314886e35214c6f8603b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Make dired-do-compress work for *.tar.gz files
    
    * lisp/dired-aux.el (dired-compress-file-suffixes): Associate
      "tar -zxvf" to *.tar.gz; update docstring.
    
    (dired-compress-file): Allow to specify switches after the command in
    `dired-compress-file-suffixes'.
---
 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 8e714c7..f1f9436 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -864,7 +864,8 @@ command with a prefix argument (the value does not matter)."
       from-file)))
 
 (defvar dired-compress-file-suffixes
-  '(("\\.gz\\'" "" "gunzip")
+  '(("\\.tar\\.gz" "" "tar" "-zxvf")
+    ("\\.gz\\'" "" "gunzip")
     ("\\.tgz\\'" ".tar" "gunzip")
     ("\\.Z\\'" "" "uncompress")
     ;; For .z, try gunzip.  It might be an old gzip file,
@@ -878,13 +879,14 @@ command with a prefix argument (the value does not 
matter)."
     ("\\.tar\\'" ".tgz" nil))
   "Control changes in file name suffixes for compression and uncompression.
 Each element specifies one transformation rule, and has the form:
-  (REGEXP NEW-SUFFIX PROGRAM)
+  (REGEXP NEW-SUFFIX PROGRAM &rest ARGS)
 The rule applies when the old file name matches REGEXP.
 The new file name is computed by deleting the part that matches REGEXP
  (as well as anything after that), then adding NEW-SUFFIX in its place.
 If PROGRAM is non-nil, the rule is an uncompression rule,
 and uncompression is done by running PROGRAM.
-Otherwise, the rule is a compression rule, and compression is done with gzip.")
+Otherwise, the rule is a compression rule, and compression is done with gzip.
+ARGS are command switches passed to PROGRAM.")
 
 ;;;###autoload
 (defun dired-compress-file (file)
@@ -910,9 +912,11 @@ Return nil if no change in files."
            nil)
           ((and suffix (nth 2 suffix))
            ;; We found an uncompression rule.
-           (if (not (dired-check-process (concat "Uncompressing " file)
-                                         (nth 2 suffix) file))
-               newname))
+           (when (not (apply 'dired-check-process
+                             `(,(concat "Uncompressing " file)
+                               ,@(cddr suffix)
+                               ,file)))
+             newname))
           (t
            ;; We don't recognize the file as compressed, so compress it.
            ;; Try gzip; if we don't have that, use compress.



reply via email to

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