From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Davin Pearson <davin.pearson@gmail.com>
Newsgroups: gmane.emacs.help
Subject: Trouble getting archives to load as archives
Date: Thu, 3 Jul 2008 15:59:09 -0700 (PDT)
Organization: http://groups.google.com
Message-ID: <f1ce82e6-59be-4302-888e-c4e7a74cf9ff@f63g2000hsf.googlegroups.com>
NNTP-Posting-Host: lo.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: ger.gmane.org 1215128442 22474 80.91.229.12 (3 Jul 2008 23:40:42 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 3 Jul 2008 23:40:42 +0000 (UTC)
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 04 01:41:29 2008
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
	by lo.gmane.org with esmtp (Exim 4.50)
	id 1KEYQZ-0000L2-W9
	for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Jul 2008 01:41:28 +0200
Original-Received: from localhost ([127.0.0.1]:58438 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1KEYPj-00027d-7Z
	for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jul 2008 19:40:35 -0400
Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f63g2000hsf.googlegroups.com!not-for-mail
Original-Newsgroups: gnu.emacs.help
Original-Lines: 19
Original-NNTP-Posting-Host: 60.234.164.158
Original-X-Trace: posting.google.com 1215125949 21333 127.0.0.1 (3 Jul 2008 22:59:09
	GMT)
Original-X-Complaints-To: groups-abuse@google.com
Original-NNTP-Posting-Date: Thu, 3 Jul 2008 22:59:09 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f63g2000hsf.googlegroups.com; posting-host=60.234.164.158; 
	posting-account=SVVH0AoAAABplEQzMkIR3gU7a0gK8IuF
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.15) 
	Gecko/20080623 Firefox/2.0.0.15,gzip(gfe),gzip(gfe)
Original-Xref: news.stanford.edu gnu.emacs.help:159885
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.help:55237
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/55237>

The following code works for Emacs Version 20.7 and 21.3
to load archive files as archives:

(setq auto-mode-alist
      (cons '("\\.\\(arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode)
            auto-mode-alist))

I tried the following code but it only works on ZIP files:

(add-hook 'find-file-hooks 'my-archive-hook)
(defun my-archive-hook ()
  (when (or (string-match "\\.zip$" (buffer-name))
            (string-match "\\.tar$" (buffer-name))
            (string-match "\\.gz$"  (buffer-name)))
    (archive-mode 1)
    ))

So my question is this: how do I get archive-mode to display archives
correctly for TAR and GZ files?