summaryrefslogtreecommitdiff
path: root/lisp/dired-aux.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-08-08 05:00:25 +0000
committerRichard M. Stallman <rms@gnu.org>1993-08-08 05:00:25 +0000
commit91ecc645ddc1023de84fe5d3fb4f2f6adef5dad1 (patch)
tree990ed74cfbbfd61f118bb3b732faad312040280c /lisp/dired-aux.el
parent6013de2d51b4a559b29cffcc19a0aa00c85f1e7b (diff)
downloademacs-91ecc645ddc1023de84fe5d3fb4f2f6adef5dad1.tar.gz
(dired-compress-file): For .z file, run gunzip.
When running gzip, see if it made .gz or .z. (dired-compress): Delete old entry for new-file, if any.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r--lisp/dired-aux.el21
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 6af1984dc2f..dd266ce8ae1 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -480,7 +480,14 @@ and use this command with a prefix argument (the value does not matter)."
(from-file (dired-get-filename))
(new-file (dired-compress-file from-file)))
(if new-file
- (progn (dired-update-file-line new-file) nil)
+ (let ((start (point)))
+ ;; Remove any preexisting entry for the name NEW-FILE.
+ (condition-case nil
+ (dired-remove-entry new-file)
+ (error nil))
+ (goto-char start)
+ ;; Now replace the current line with an entry for NEW-FILE.
+ (dired-update-file-line new-file) nil)
(dired-log (concat "Failed to compress" from-file))
from-file)))
@@ -503,12 +510,22 @@ and use this command with a prefix argument (the value does not matter)."
(if (not (dired-check-process (concat "Uncompressing " file)
"gunzip" file))
(substring file 0 -3)))
+ ;; For .z, try gunzip. It might be an old gzip file,
+ ;; or it might be from compact? pack? (which?) but gunzip handles
+ ;; both.
+ ((let (case-fold-search)
+ (string-match "\\.z$" file))
+ (if (not (dired-check-process (concat "Uncompressing " file)
+ "gunzip" file))
+ (substring file 0 -3)))
(t
;;; Try gzip; if we don't have that, use compress.
(condition-case nil
(if (not (dired-check-process (concat "Compressing " file)
"gzip" "-f" file))
- (concat file ".gz"))
+ (cond ((file-exists-p (concat file ".gz"))
+ (concat file ".gz"))
+ (t (concat file ".z"))))
(file-error
(if (not (dired-check-process (concat "Compressing " file)
"compress" "-f" file))