(setup-8-bit-environment):
[bpt/emacs.git] / lisp / uncompress.el
index 3844c0c..9da57a3 100644 (file)
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; 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,
@@ -49,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.
@@ -60,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))