[Top][All Lists]

[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 <address@hidden> 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?
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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]