aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2006-07-17 04:00:54 +0000
committerChong Yidong2006-07-17 04:00:54 +0000
commitc8068734a7e8201121bae138fa0a24bc8627e20f (patch)
tree46b1321e6b4fa0821e7145d057a6c74bcdc0af6d
parent4a76f78d18b3dae296b59ed632e0cca1fabba734 (diff)
downloademacs-c8068734a7e8201121bae138fa0a24bc8627e20f.tar.gz
emacs-c8068734a7e8201121bae138fa0a24bc8627e20f.zip
* dired-aux.el (dired-compress-file): Confirm again if gzipped
file already exists.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/dired-aux.el29
2 files changed, 21 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2aa9500a9ec..58ae4595c19 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12006-07-17 Chong Yidong <cyd@stupidchicken.com>
2
3 * dired-aux.el (dired-compress-file): Confirm again if gzipped
4 file already exists.
5
12006-07-16 Thien-Thi Nguyen <ttn@gnu.org> 62006-07-16 Thien-Thi Nguyen <ttn@gnu.org>
2 7
3 * find-file.el (ff-special-constructs): Doc fix. Also, for C/C++ 8 * find-file.el (ff-special-constructs): Doc fix. Also, for C/C++
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index b4cb8933194..0942c6d1dff 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -745,19 +745,22 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.")
745 ;;; We don't recognize the file as compressed, so compress it. 745 ;;; We don't recognize the file as compressed, so compress it.
746 ;;; Try gzip; if we don't have that, use compress. 746 ;;; Try gzip; if we don't have that, use compress.
747 (condition-case nil 747 (condition-case nil
748 (if (not (dired-check-process (concat "Compressing " file) 748 (let ((out-name (concat file ".gz")))
749 "gzip" "-f" file)) 749 (and (or (not (file-exists-p out-name))
750 (let ((out-name 750 (y-or-n-p
751 (if (file-exists-p (concat file ".gz")) 751 (format "File %s already exists. Really compress? "
752 (concat file ".gz") 752 out-name)))
753 (concat file ".z")))) 753 (not (dired-check-process (concat "Compressing " file)
754 ;; Rename the compressed file to NEWNAME 754 "gzip" "-f" file))
755 ;; if it hasn't got that name already. 755 (or (file-exists-p out-name)
756 (if (and newname (not (equal newname out-name))) 756 (setq out-name (concat file ".z")))
757 (progn 757 ;; Rename the compressed file to NEWNAME
758 (rename-file out-name newname t) 758 ;; if it hasn't got that name already.
759 newname) 759 (if (and newname (not (equal newname out-name)))
760 out-name))) 760 (progn
761 (rename-file out-name newname t)
762 newname)
763 out-name)))
761 (file-error 764 (file-error
762 (if (not (dired-check-process (concat "Compressing " file) 765 (if (not (dired-check-process (concat "Compressing " file)
763 "compress" "-f" file)) 766 "compress" "-f" file))