summaryrefslogtreecommitdiff
path: root/lisp/uncompress.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-03-26 07:36:48 +0000
committerRichard M. Stallman <rms@gnu.org>1997-03-26 07:36:48 +0000
commitfcd532ae8137bf4dbc42cd784aac4fad4d418a0d (patch)
treeb2568fa7943948fb6afdc22b7e6b1c1f44f758e4 /lisp/uncompress.el
parent7e60d5d365e8965fe3db60e08208a28bf567cd42 (diff)
downloademacs-fcd532ae8137bf4dbc42cd784aac4fad4d418a0d.tar.gz
(uncompress-while-visiting): Handle .tgz files.
Diffstat (limited to 'lisp/uncompress.el')
-rw-r--r--lisp/uncompress.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/uncompress.el b/lisp/uncompress.el
index cdfa1882d38..9da57a32d4d 100644
--- a/lisp/uncompress.el
+++ b/lisp/uncompress.el
@@ -24,10 +24,12 @@
;;; Commentary:
;; This package can be used to arrange for automatic uncompress of
-;; files packed with the UNIX compress(1) utility when they are visited.
+;; compressed files when they are visited.
;; All that's necessary is to load it. This can conveniently be done from
;; your .emacs file.
+;; M-x auto-compression-mode is a more modern replacement for this package.
+
;;; Code:
;; When we are about to make a backup file,
@@ -50,6 +52,9 @@
(or (assoc "\\.gz$" auto-mode-alist)
(setq auto-mode-alist
(cons '("\\.gz$" . uncompress-while-visiting) auto-mode-alist)))
+(or (assoc "\\.tgz$" auto-mode-alist)
+ (setq auto-mode-alist
+ (cons '("\\.tgz$" . uncompress-while-visiting) auto-mode-alist)))
(defun uncompress-while-visiting ()
"Temporary \"major mode\" used for .Z and .gz files, to uncompress them.
@@ -61,7 +66,11 @@ It then selects a major mode from the uncompressed file name and contents."
(if (and (not (null buffer-file-name))
(string-match "\\.gz$" buffer-file-name))
(set-visited-file-name
- (substring buffer-file-name 0 (match-beginning 0)))))
+ (substring buffer-file-name 0 (match-beginning 0)))
+ (if (and (not (null buffer-file-name))
+ (string-match "\\.tgz$" buffer-file-name))
+ (set-visited-file-name
+ (concat (substring buffer-file-name 0 (match-beginning 0)) ".tar")))))
(message "Uncompressing...")
(let ((buffer-read-only nil))
(shell-command-on-region (point-min) (point-max) uncompress-program t))