🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87172

jka-compr should support .tgz extension automatically

#87172
From: Jonathan I. Kamens
Date: Wed, 12 Oct 1994 15:55
88 lines
3598 bytes
In GNU Emacs 19.25.3 of Sun Aug 14 1994 on gza-client1 (sparc-sun-sunos4.1.3)

Since gzip now supports the .tgz extension automatically, so should
jka-compr.

I believe the patch below accomplishes this.  ChangeLog entry:

Wed Oct 12 15:49:36 1994  Jonathan I. Kamens  (jik@gza-client1)

	* jka-compr.el: Support .tgz extension automatically.

--- jka-compr.el	1994/10/12 15:19:00	1.1
+++ jka-compr.el	1994/10/12 15:49:29
@@ -63,28 +63,6 @@
 ;;;   compressed, but there is little point in trying to compress an encrypted
 ;;;   file.
 ;;;
-;;;
-;;; tar-mode
-;;;   Some people like to use extensions like .trz for compressed tar files.
-;;;   To handle these sorts of files, you have to add an entry to
-;;;   jka-compr-compression-info-list that looks something like this: 
-;;;
-;;;      ["\\.trz\\'" "\037\213"
-;;;       "zip"   "gzip"  nil  ("-q")
-;;;       "unzip" "gzip"  nil  ("-q" "-d")
-;;;       t
-;;;       nil]
-;;;
-;;;   The last nil in the vector (the "extension" field) prevents jka-compr
-;;;   from attempting to add .trz to an ordinary file name when it is looking
-;;;   for a compressed version of that file (i.e. don't look for things like
-;;;   foobar.c.trz).
-;;;
-;;;   Finally, to make tar-mode start up automatically, you have to add an
-;;;   entry to auto-mode-alist that looks like this
-;;;
-;;;       ("\\.trz\\'" . tar-mode)
-;;;
 
 
 ;;; ACKNOWLEDGMENTS
@@ -132,6 +110,10 @@
      "compressing"    "compress"     ("-c")
      "uncompressing"  "uncompress"   ("-c")
      nil t]
+    ["\\.tgz\\'"
+     "zipping"        "gzip"         ("-c" "-q")
+     "unzipping"      "gzip"         ("-c" "-q" "-d")
+     t nil]
     ["\\.gz~?\\'"
      "zipping"        "gzip"         ("-c" "-q")
      "unzipping"      "gzip"         ("-c" "-q" "-d")
@@ -171,6 +153,11 @@
 invoked.")
 
 
+(defvar jka-compr-mode-alist-additions
+  (list (cons "\\.tgz\\'"  'tar-mode))
+  "A list of pairs to add to auto-mode-alist when jka-compr is installed.")
+
+
 (defvar jka-compr-file-name-handler-entry
   nil
   "The entry in `file-name-handler-alist' used by the jka-compr I/O functions.")
@@ -777,7 +764,8 @@
 						  nil 'jka-compr)
 					    auto-mode-alist)))))
 
-   jka-compr-compression-info-list))
+   jka-compr-compression-info-list)
+  (setq auto-mode-alist (append auto-mode-alist jka-compr-mode-alist-additions)))
 
 
 (defun jka-compr-uninstall ()
@@ -801,8 +789,9 @@
 
     (while (cdr last)
       (setq entry (car (cdr last)))
-      (if (and (consp (cdr entry))
-	       (eq (nth 2 entry) 'jka-compr))
+      (if (or (member entry jka-compr-mode-alist-additions)
+	      (and (consp (cdr entry))
+		   (eq (nth 2 entry) 'jka-compr)))
 	  (setcdr last (cdr (cdr last)))
 	(setq last (cdr last))))
     
Jonathan Kamens  |  OpenVision Technologies, Inc.  |   jik@cam.ov.com
Technical Details
Message-ID: <199410121551.LAA24436@gza-client1.cam.ov.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!mhv.net!metro.atlanta.com!emory!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!cam.ov.COM!jik

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,30bc874632de3a34,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-10-12 10:19:45 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!mhv.net!metro.atlanta.com!emory!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!cam.ov.COM!jik
From: jik@cam.ov.COM (Jonathan I. Kamens)
Newsgroups: gnu.emacs.bug
Subject: jka-compr should support .tgz extension automatically
Date: 12 Oct 1994 11:55:25 -0400
Organization: GNUs Not Usenet
Lines: 88
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <199410121551.LAA24436@gza-client1.cam.ov.com>