[Top][All Lists]

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

Re: how can I tell emacs to treat a text file as html?

From: Pascal Bourguignon
Subject: Re: how can I tell emacs to treat a text file as html?
Date: 09 Apr 2005 20:11:49 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Angelina Carlton <address@hidden> writes:

> Hello
> I use a bash based blogging software called nanoblogger. It lets you
> use the editor of your choice and I had set this to be emacsclient.
> The blog script then sends /tmp/nb_entry1078.html to my already
> running emacs and I can edit using html syntax hilighting as emacs
> recognizes the file type.
> This worked fine until the latest version of the software now sends
> a txt file instead. /tmp/nb_entry1078.txt  
> Emacs of course thinks this is plain text which is right, but I would
> like to treat it as html, actually XHTML, but either would do. 
> The blog conf file has:
> EDITOR="emacslient";
> I cant find in my documentation a way to set EDITOR to 
> "emacsclient --"treat this as html"
> Is this possible from the command line? Or is there a way to turn on
> html font locking from inside emacs even if the file is txt? This
> would be acceptable if I could bind it to like F8 or something.

emacsclient -e "(progn (find-file \"$file\") (html-mode))"

Also, it might be possible to append:

Local Variables:
mode: html

or to prepend: <!-- -*- mode: html -*- -->

if not already present in the file, and then use merely: emacsclient $file

For example:

tail -10 $file \
| grep -q -s 'mode: html' \
|| cat >> $file <<EOF
Local Variables:
mode: html
emacsclient $file

__Pascal Bourguignon__           

In a World without Walls and Fences, 
who needs Windows and Gates?

reply via email to

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