help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: render *html - via lynx ?


From: Tim X
Subject: Re: render *html - via lynx ?
Date: Thu, 04 Sep 2008 19:08:52 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

address@hidden writes:

> When I've got a dir-listing showing in an emacs window,
> I can 'mid-mouse-it' to open the text.  
> [how] Can I open it in a window depending on its type ?
> Eg. for a *.html, can I indirectly use lynx, which via:
> 'lynx -dump <filePathName>' will render it ?
>
> TIA.
>

Yep, you sure can. I've done this using defadvice. I just put a
defadvice around view-file which checks to see if the file name ends
with htm/html and if so, view it with w3m, otherwise, it just opens it
normally. Then, in dired, if I hit 'v' to view the file and its an html
file, its rendered, otherwise it is displayed as normal. 

However, there are simpler alternatives. have a look at the browse-url
package that comes wtih emacs. It has functions for browsing the file at
point, browsing the current buffer as html, browsing a file etc
etc. From memory, the source file ahs some suggestions on key bindings
that would achieve what you like. I use the more complicated solution
because I get so use to hitting v to view a file, I found I kept
forgetting to hit another key when it was an HTML file. 

the nice thing about using browse-url is taht it can be configured to
use various different browsers, including stand-alone ones like firefox
or w3m or emacs-w3m or emacs w3 or ...

You can even configure it to use different browsers depending on the
URL. So, for example, you could configure it to use a text based browser
like w3m or lynx for local files that are probably documentation and
fairly simple and use something like firefox for urls that are external
and may need javascript or a more feature rich browser. doing this gives
you fast rendering of local text oriented HTML files and the ability to
use an external browser for more complex files - all called from within emacs.

Tim


-- 
tcross (at) rapttech dot com dot au


reply via email to

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