diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2006-07-17 04:00:54 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2006-07-17 04:00:54 +0000 |
commit | c8068734a7e8201121bae138fa0a24bc8627e20f (patch) | |
tree | 46b1321e6b4fa0821e7145d057a6c74bcdc0af6d /lisp/dired-aux.el | |
parent | 4a76f78d18b3dae296b59ed632e0cca1fabba734 (diff) | |
download | emacs-c8068734a7e8201121bae138fa0a24bc8627e20f.tar.gz |
* dired-aux.el (dired-compress-file): Confirm again if gzipped
file already exists.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r-- | lisp/dired-aux.el | 29 |
1 files changed, 16 insertions, 13 deletions
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.") ;;; 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)) |