From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Newsgroups: gmane.emacs.help
Subject: Re: Trouble getting archives to load as archives
Date: Fri, 04 Jul 2008 07:38:25 +0200
Message-ID: <87hcb6b44u.fsf@tux.homenetwork>
References: <f1ce82e6-59be-4302-888e-c4e7a74cf9ff@f63g2000hsf.googlegroups.com>
NNTP-Posting-Host: lo.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: ger.gmane.org 1215150102 4467 80.91.229.12 (4 Jul 2008 05:41:42 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 4 Jul 2008 05:41:42 +0000 (UTC)
Cc: help-gnu-emacs@gnu.org
To: Davin Pearson <davin.pearson@gmail.com>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 04 07:42: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 1KEe3t-0003il-U6
	for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Jul 2008 07:42:26 +0200
Original-Received: from localhost ([127.0.0.1]:60720 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1KEe32-0000Ud-Uw
	for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Jul 2008 01:41:32 -0400
Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KEe2S-0000SU-Gq
	for help-gnu-emacs@gnu.org; Fri, 04 Jul 2008 01:40:56 -0400
Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KEe2Q-0000QX-2n
	for help-gnu-emacs@gnu.org; Fri, 04 Jul 2008 01:40:55 -0400
Original-Received: from [199.232.76.173] (port=40668 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KEe2P-0000QH-RB
	for help-gnu-emacs@gnu.org; Fri, 04 Jul 2008 01:40:53 -0400
Original-Received: from rv-out-0708.google.com ([209.85.198.249]:55752)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <thierry.volpiatto@gmail.com>) id 1KEe2P-00064E-7e
	for help-gnu-emacs@gnu.org; Fri, 04 Jul 2008 01:40:53 -0400
Original-Received: by rv-out-0708.google.com with SMTP id k29so1312871rvb.6
	for <help-gnu-emacs@gnu.org>; Thu, 03 Jul 2008 22:40:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:from:to:cc:subject:references
	:date:in-reply-to:message-id:user-agent:mime-version:content-type;
	bh=AOkasMYGc7tVguurRcTA1cgrK2TjUSUw2YeDhv1EocQ=;
	b=u8N6dQBW9Xtb0PP7qmJl/wq31Rfbn0jkHrmqaKKYi59fQhA48aucDx0O+hG6eXH+j6
	OYYX0ho0aXagCwwF7SJrBzpHf1nERj66zsedZub+F49PF/q4Z8KcPoCaC7aWe+NMj60+
	eRfTjNpGKsmT3CG4mhWEExkVkO9wQvtfKQYRM=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:to:cc:subject:references:date:in-reply-to:message-id
	:user-agent:mime-version:content-type;
	b=Avt8ctV3wYZDedfqW9+H5iHqYJBw10mWrksbgPHmszS1PEZJ7Gr0gIvzt7ivci70am
	JP/OcY93pF7pNKFj9jlrLCD0vuTR7wGPqE4EqYgfh4zqix3cC112HXcIqyUUPIjcWnVW
	0zJmvP19ZvsXPPncBHkuQWq/aE+k/873j3xr0=
Original-Received: by 10.114.66.2 with SMTP id o2mr2695207waa.124.1215150048290;
	Thu, 03 Jul 2008 22:40:48 -0700 (PDT)
Original-Received: from tux.homenetwork ( [86.200.84.5])
	by mx.google.com with ESMTPS id b30sm1595913ika.3.2008.07.03.22.40.15
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Thu, 03 Jul 2008 22:40:46 -0700 (PDT)
In-Reply-To: <f1ce82e6-59be-4302-888e-c4e7a74cf9ff@f63g2000hsf.googlegroups.com>
	(Davin Pearson's message of "Thu, 3 Jul 2008 15:59:09 -0700 (PDT)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)
X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2)
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:55239
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/55239>

Davin Pearson <davin.pearson@gmail.com> writes:

> 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?
>
Hi,
an other solution is to use avfs, with that you can open any archives on
read/write mode just as any directory in dired.
So just install avfs and set fuse in your kernel (and install fuse)
I use this code to use it in emacs:

,----[ avfs in dired ]
| (defun tv-dired-browse-archive ()
|   "This function use avfs and fuse, so be sure
| to have these programs and modules installed on your system"
|   (interactive)
|   (let ((file-at-point (dired-get-filename)))
|     (if (or (equal (file-name-extension file-at-point) "gz")
|             (equal (file-name-extension file-at-point) "bz2")
|             (equal (file-name-extension file-at-point) "zip"))
|         (progn
|           (when (not (cddr (directory-files "~/.avfs")))
|             (shell-command "mountavfs"))
|           (find-file (concat "~/.avfs" file-at-point "#")))
|       (find-file file-at-point))))
| (define-key dired-mode-map (kbd "z") 'tv-dired-browse-archive)
`----

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France