From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Edmondson Newsgroups: gmane.emacs.help Subject: Re: Useful syntax highlighting (font lock) in a mixed xml lua file Date: Tue, 03 Jan 2012 11:03:40 +0000 Message-ID: References: <4EFE234E.8040807@taydin.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: dough.gmane.org 1325610479 24685 80.91.229.12 (3 Jan 2012 17:07:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 3 Jan 2012 17:07:59 +0000 (UTC) To: Timur Aydin , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 03 18:07:55 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ri7q6-0001FT-Lp for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Jan 2012 18:07:54 +0100 Original-Received: from localhost ([::1]:43139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri7q6-0002zl-6G for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Jan 2012 12:07:54 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:57512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri29k-0000RV-16 for help-gnu-emacs@gnu.org; Tue, 03 Jan 2012 06:03:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ri29g-0006DJ-Sp for help-gnu-emacs@gnu.org; Tue, 03 Jan 2012 06:03:48 -0500 Original-Received: from mail-wi0-f169.google.com ([209.85.212.169]:39161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri29g-0006D6-Li for help-gnu-emacs@gnu.org; Tue, 03 Jan 2012 06:03:44 -0500 Original-Received: by wibhq12 with SMTP id hq12so12099799wib.0 for ; Tue, 03 Jan 2012 03:03:43 -0800 (PST) Original-Received: by 10.180.75.7 with SMTP id y7mr15483129wiv.2.1325588623576; Tue, 03 Jan 2012 03:03:43 -0800 (PST) Original-Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id di5sm126057854wib.3.2012.01.03.03.03.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jan 2012 03:03:42 -0800 (PST) Original-Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 67190A05D6; Tue, 3 Jan 2012 11:03:40 +0000 (GMT) In-Reply-To: <4EFE234E.8040807@taydin.org> User-Agent: Notmuch/0.10.2+151~gbf1dc2b (http://notmuchmail.org) Emacs/24.0.92.1 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.169 X-Mailman-Approved-At: Tue, 03 Jan 2012 12:07:47 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83311 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 30 Dec 2011 22:47:10 +0200, Timur Aydin wrote: > I am working on an xml file that has an embedded CDATA section which=20 > contains lua source code. I am mostly working on the lua code and would=20 > like that code to be syntax highlighted by emacs. When I activate=20 > lua-mode, it understandably gets confused because of all the surrounding= =20 > xml. When I activate xml-mode, the xml stuff is properly syntax=20 > highlighted, but the lua code in the CDATA section is uniformly colored=20 > plain text. >=20 > Is there a way to utilize font-lock mode in a sensible manner? I=20 > attempted to put the lua code in a separate file (script.lua) and then=20 > included it into the xml using DOCTYPE and ENTITY tags, but this didn't=20 > help, because I don't have any control over the software that parses=20 > this xml file. It isn't able to deal with extra xml tags. >=20 > So my only hope is to be able to tell emacs to font-lock a region=20 > bounded by a CDATA tag using lua-mode and to font-lock the rest using=20 > xml-mode. Is there a way to do this? I don't know how to do that. Did you consider using an indirect buffer? If you have the indirect buffer narrowed to the Lua code and with the correct major-mode, font-lock should work there. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8C4IwACgkQaezQq/BJZRYdYACdEPRa/ON8HqpBH+4i2GYI2Sxc khQAn2yJSAUCv/YKI0c+j2Oa8AvW8UjZ =2LUd -----END PGP SIGNATURE----- --=-=-=--