[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extview.el --- open files with external viewer

From: Ted Zlatanov
Subject: Re: extview.el --- open files with external viewer
Date: Mon, 03 Apr 2006 13:48:10 -0400
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On 28 Mar 2006, address@hidden wrote:

> The code below advises find-file and launches an external viewer if the
> file name matches any of the prefedefined patterns. This way any file
> can be opened in the traditional way or via dired or globalff, etc. and
> it is passed to an external application if Emacs cannot handle the
> content.
> At the moment only pdf files are handled, but it is trivial to add
> others.
> (defvar extview-application-associations
> '(("\\.pdf$" . "acroread"))
> "List of (REGEXP . APPLICATION) descriptors which are tested for the
> file name to be opened. The first matching application is used to open
> the file. If no application matches then normal `find-file' is
> executed.")

Just a suggestion: look at the ~/.mailcap, /etc/mailcap, and
/etc/mime.types files (on my Fedora Core 5 and Debian systems, at
least).  They are a pretty good way of associating file viewers with
file extensions.  You could at least populate
extview-application-associations from those files on startup, even if
you don't consult them every time the user asks to open a file (I
would advise the latter).

The Gnus code has a mailcap.el file, in which the function
mailcap-parse-mailcaps parses the appropriate files.  I would suggest
looking at it to see how your idea can be done correctly.  mailcap.el
is in the Emacs Lisp tree as well, if you don't want to depend on Gnus
itself but still want to use this functionality.

All the best

reply via email to

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