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

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

Re: How to edit "mixed" (e.g. HTML/JavaScript) files?


From: Lennart Borgman (gmail)
Subject: Re: How to edit "mixed" (e.g. HTML/JavaScript) files?
Date: Thu, 08 Mar 2007 14:27:12 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

David Hansen wrote:
On Thu, 08 Mar 2007 10:48:27 +0100 Hadron wrote:

"Lennart Borgman (gmail)" <address@hidden> writes:

kj wrote:
It often happens that a single file must contain code corresponding
to two different syntaxes.  For example, an HTML file with embedded
JavaScript or CSS.

Is there a way to *locally* override the mode of a file and replace
it with a different mode?

If not, is there a good way to deal with such situations (other
than avoiding them altogether)?

Thanks!

kj
It depends on whom you ask ;-)

You may try nxhtml-part-mode in nXhtml (you need Emacs 22 beta):

  http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html

Or you may try this

  http://www.emacswiki.org/cgi-bin/wiki/MultipleModes


Has anyone recently got this multiplemodes working? The wiki reads like
a slaughter house!

Just my experience:  you won't get it to work.  Everything available
are more or less dirty hacks.

The most promising approach (IMHO) is multi-mode.el (but it's a more
general solution, you have to do some hacking yourself to get it
work for your special mode).

Don't spend to much time fiddling with the different modes.  Emacs
isn't ready yet to deal with this.

David


Did you try nXhtml above? It should work OTB. Drawbacks is that it requires the Emacs 22 beta. Maybe also in the beginning that it uses nxhtml-mode for XHTML.

nXhtml takes another approach to multiple modes. Since Emacs actually have no way to restrict a mode to only handle part of a buffer (not even in Emacs 22) it instead switches mode. See the home page for more info.




reply via email to

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