From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.help Subject: Re: How to edit "mixed" (e.g. HTML/JavaScript) files? Date: Thu, 08 Mar 2007 14:27:12 +0100 Message-ID: <45F00F30.60707@gmail.com> References: <87hcsw2hhw.fsf@gmail.com> <87wt1sgdjs.fsf@localhorst.mine.nu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1173360530 10778 80.91.229.12 (8 Mar 2007 13:28:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Mar 2007 13:28:50 +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 Mar 08 14:28:43 2007 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 1HPIfh-0005EH-Sa for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2007 14:28:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HPIfu-0001Qm-D9 for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2007 08:28:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HPIec-0007ei-38 for help-gnu-emacs@gnu.org; Thu, 08 Mar 2007 08:27:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HPIea-0007ao-43 for help-gnu-emacs@gnu.org; Thu, 08 Mar 2007 08:27:33 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HPIeZ-0007ad-Oc for help-gnu-emacs@gnu.org; Thu, 08 Mar 2007 08:27:31 -0500 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HPIeM-0006g0-4d for help-gnu-emacs@gnu.org; Thu, 08 Mar 2007 08:27:18 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:65425 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1HPIeJ-0005VY-7y for help-gnu-emacs@gnu.org; Thu, 08 Mar 2007 14:27:16 +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 In-Reply-To: <87wt1sgdjs.fsf@localhorst.mine.nu> X-Antivirus: avast! (VPS 000722-2, 2007-03-07), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1HPIeJ-0005VY-7y. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1HPIeJ-0005VY-7y 4c9e990ef2f293197a581df666f9ba1f X-detected-kernel: Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor 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:41795 Archived-At: David Hansen wrote: > On Thu, 08 Mar 2007 10:48:27 +0100 Hadron wrote: > >> "Lennart Borgman (gmail)" 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.