]> git.eshelyaron.com Git - emacs.git/commitdiff
* dired-aux.el (dired-compress-file): Confirm again if gzipped
authorChong Yidong <cyd@stupidchicken.com>
Mon, 17 Jul 2006 04:00:54 +0000 (04:00 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Mon, 17 Jul 2006 04:00:54 +0000 (04:00 +0000)
file already exists.

lisp/ChangeLog
lisp/dired-aux.el

index 2aa9500a9ec192900888bbef55c2bff52ff542ce..58ae4595c1952173ca1432eaeb1abebf6486baea 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * dired-aux.el (dired-compress-file): Confirm again if gzipped
+       file already exists.
+
 2006-07-16  Thien-Thi Nguyen  <ttn@gnu.org>
 
        * find-file.el (ff-special-constructs): Doc fix.  Also, for C/C++
index b4cb8933194b634375b097a7ea75e68c33ca0045..0942c6d1dffc8bb9ee90b4bdd24dc2715e40d5f6 100644 (file)
@@ -745,19 +745,22 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.")
           ;;; We don't recognize the file as compressed, so compress it.
           ;;; Try gzip; if we don't have that, use compress.
           (condition-case nil
-              (if (not (dired-check-process (concat "Compressing " file)
-                                            "gzip" "-f" file))
-                  (let ((out-name
-                         (if (file-exists-p (concat file ".gz"))
-                             (concat file ".gz")
-                           (concat file ".z"))))
-                    ;; Rename the compressed file to NEWNAME
-                    ;; if it hasn't got that name already.
-                    (if (and newname (not (equal newname out-name)))
-                        (progn
-                          (rename-file out-name newname t)
-                          newname)
-                      out-name)))
+              (let ((out-name (concat file ".gz")))
+                (and (or (not (file-exists-p out-name))
+                         (y-or-n-p
+                          (format "File %s already exists.  Really compress? "
+                                  out-name)))
+                     (not (dired-check-process (concat "Compressing " file)
+                                               "gzip" "-f" file))
+                     (or (file-exists-p out-name)
+                         (setq out-name (concat file ".z")))
+                     ;; Rename the compressed file to NEWNAME
+                     ;; if it hasn't got that name already.
+                     (if (and newname (not (equal newname out-name)))
+                         (progn
+                           (rename-file out-name newname t)
+                           newname)
+                       out-name)))
             (file-error
              (if (not (dired-check-process (concat "Compressing " file)
                                            "compress" "-f" file))