From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: render *html - via lynx ? Date: Thu, 04 Sep 2008 19:08:52 +1000 Organization: Rapt Technologies Message-ID: <87k5dsth0b.fsf@lion.rapttech.com.au> References: <1220451375.291032@vasbyt.isdsl.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220521300 13213 80.91.229.12 (4 Sep 2008 09:41:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Sep 2008 09:41:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 04 11:42:34 2008 Return-path: 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 1KbBMH-0002p7-IH for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Sep 2008 11:42:33 +0200 Original-Received: from localhost ([127.0.0.1]:54848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KbBLI-0005NJ-6q for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Sep 2008 05:41:32 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!flpi089.ffdc.sbc.com!prodigy.net!news.astraweb.com!border2.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:WjuyCgJa7DjfQBjr74i/PbIoXTk= Original-Lines: 42 Original-NNTP-Posting-Host: f5557fe0.news.astraweb.com Original-X-Trace: DXC=jf[6hE2Q[k8l=bkA3Hk5C1L?0kYOcDh@:IGb]mONgOi:9jMSI8HST^>Y:LMn= List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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:57253 Archived-At: problems@gmail 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 ' 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