aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-03-26 07:36:48 +0000
committerRichard M. Stallman1997-03-26 07:36:48 +0000
commitfcd532ae8137bf4dbc42cd784aac4fad4d418a0d (patch)
treeb2568fa7943948fb6afdc22b7e6b1c1f44f758e4
parent7e60d5d365e8965fe3db60e08208a28bf567cd42 (diff)
downloademacs-fcd532ae8137bf4dbc42cd784aac4fad4d418a0d.tar.gz
emacs-fcd532ae8137bf4dbc42cd784aac4fad4d418a0d.zip
(uncompress-while-visiting): Handle .tgz files.
-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 @@
24;;; Commentary: 24;;; Commentary:
25 25
26;; This package can be used to arrange for automatic uncompress of 26;; This package can be used to arrange for automatic uncompress of
27;; files packed with the UNIX compress(1) utility when they are visited. 27;; compressed files when they are visited.
28;; All that's necessary is to load it. This can conveniently be done from 28;; All that's necessary is to load it. This can conveniently be done from
29;; your .emacs file. 29;; your .emacs file.
30 30
31;; M-x auto-compression-mode is a more modern replacement for this package.
32
31;;; Code: 33;;; Code:
32 34
33;; When we are about to make a backup file, 35;; When we are about to make a backup file,
@@ -50,6 +52,9 @@
50(or (assoc "\\.gz$" auto-mode-alist) 52(or (assoc "\\.gz$" auto-mode-alist)
51 (setq auto-mode-alist 53 (setq auto-mode-alist
52 (cons '("\\.gz$" . uncompress-while-visiting) auto-mode-alist))) 54 (cons '("\\.gz$" . uncompress-while-visiting) auto-mode-alist)))
55(or (assoc "\\.tgz$" auto-mode-alist)
56 (setq auto-mode-alist
57 (cons '("\\.tgz$" . uncompress-while-visiting) auto-mode-alist)))
53 58
54(defun uncompress-while-visiting () 59(defun uncompress-while-visiting ()
55 "Temporary \"major mode\" used for .Z and .gz files, to uncompress them. 60 "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."
61 (if (and (not (null buffer-file-name)) 66 (if (and (not (null buffer-file-name))
62 (string-match "\\.gz$" buffer-file-name)) 67 (string-match "\\.gz$" buffer-file-name))
63 (set-visited-file-name 68 (set-visited-file-name
64 (substring buffer-file-name 0 (match-beginning 0))))) 69 (substring buffer-file-name 0 (match-beginning 0)))
70 (if (and (not (null buffer-file-name))
71 (string-match "\\.tgz$" buffer-file-name))
72 (set-visited-file-name
73 (concat (substring buffer-file-name 0 (match-beginning 0)) ".tar")))))
65 (message "Uncompressing...") 74 (message "Uncompressing...")
66 (let ((buffer-read-only nil)) 75 (let ((buffer-read-only nil))
67 (shell-command-on-region (point-min) (point-max) uncompress-program t)) 76 (shell-command-on-region (point-min) (point-max) uncompress-program t))