[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trouble getting archives to load as archives
From: |
Thierry Volpiatto |
Subject: |
Re: Trouble getting archives to load as archives |
Date: |
Fri, 04 Jul 2008 07:38:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
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
- Trouble getting archives to load as archives, Davin Pearson, 2008/07/03
- Re: Trouble getting archives to load as archives,
Thierry Volpiatto <=
- Re: Trouble getting archives to load as archives, Peter Dyballa, 2008/07/04
- Message not available
- Re: Trouble getting archives to load as archives, Davin Pearson, 2008/07/04
- Re: Trouble getting archives to load as archives, Bernardo Bacic, 2008/07/04
- Re: Trouble getting archives to load as archives, Davin Pearson, 2008/07/04
- Re: Trouble getting archives to load as archives, Peter Dyballa, 2008/07/05
- Re: Trouble getting archives to load as archives, Davin Pearson, 2008/07/06
- Re: Trouble getting archives to load as archives, Kevin Rodgers, 2008/07/08
- Re: Trouble getting archives to load as archives, Peter Dyballa, 2008/07/08