diff options
| author | Richard M. Stallman | 1993-08-08 05:00:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-08 05:00:25 +0000 |
| commit | 53a051941ff1079a1d59639785e2c79705170002 (patch) | |
| tree | 701f93683ccb6426227958f6c3e47ee3fcd2b490 | |
| parent | 064726ac89628fe46e57e20cbeb2f20074e43a36 (diff) | |
| download | emacs-53a051941ff1079a1d59639785e2c79705170002.tar.gz emacs-53a051941ff1079a1d59639785e2c79705170002.zip | |
(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.
| -rw-r--r-- | lisp/dired-aux.el | 21 |
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)." | |||
| 480 | (from-file (dired-get-filename)) | 480 | (from-file (dired-get-filename)) |
| 481 | (new-file (dired-compress-file from-file))) | 481 | (new-file (dired-compress-file from-file))) |
| 482 | (if new-file | 482 | (if new-file |
| 483 | (progn (dired-update-file-line new-file) nil) | 483 | (let ((start (point))) |
| 484 | ;; Remove any preexisting entry for the name NEW-FILE. | ||
| 485 | (condition-case nil | ||
| 486 | (dired-remove-entry new-file) | ||
| 487 | (error nil)) | ||
| 488 | (goto-char start) | ||
| 489 | ;; Now replace the current line with an entry for NEW-FILE. | ||
| 490 | (dired-update-file-line new-file) nil) | ||
| 484 | (dired-log (concat "Failed to compress" from-file)) | 491 | (dired-log (concat "Failed to compress" from-file)) |
| 485 | from-file))) | 492 | from-file))) |
| 486 | 493 | ||
| @@ -503,12 +510,22 @@ and use this command with a prefix argument (the value does not matter)." | |||
| 503 | (if (not (dired-check-process (concat "Uncompressing " file) | 510 | (if (not (dired-check-process (concat "Uncompressing " file) |
| 504 | "gunzip" file)) | 511 | "gunzip" file)) |
| 505 | (substring file 0 -3))) | 512 | (substring file 0 -3))) |
| 513 | ;; For .z, try gunzip. It might be an old gzip file, | ||
| 514 | ;; or it might be from compact? pack? (which?) but gunzip handles | ||
| 515 | ;; both. | ||
| 516 | ((let (case-fold-search) | ||
| 517 | (string-match "\\.z$" file)) | ||
| 518 | (if (not (dired-check-process (concat "Uncompressing " file) | ||
| 519 | "gunzip" file)) | ||
| 520 | (substring file 0 -3))) | ||
| 506 | (t | 521 | (t |
| 507 | ;;; Try gzip; if we don't have that, use compress. | 522 | ;;; Try gzip; if we don't have that, use compress. |
| 508 | (condition-case nil | 523 | (condition-case nil |
| 509 | (if (not (dired-check-process (concat "Compressing " file) | 524 | (if (not (dired-check-process (concat "Compressing " file) |
| 510 | "gzip" "-f" file)) | 525 | "gzip" "-f" file)) |
| 511 | (concat file ".gz")) | 526 | (cond ((file-exists-p (concat file ".gz")) |
| 527 | (concat file ".gz")) | ||
| 528 | (t (concat file ".z")))) | ||
| 512 | (file-error | 529 | (file-error |
| 513 | (if (not (dired-check-process (concat "Compressing " file) | 530 | (if (not (dired-check-process (concat "Compressing " file) |
| 514 | "compress" "-f" file)) | 531 | "compress" "-f" file)) |