From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Titus von der Malsburg Newsgroups: gmane.emacs.help Subject: Re: Useful syntax highlighting (font lock) in a mixed xml lua file Date: Tue, 3 Jan 2012 18:11:49 +0100 Message-ID: References: <4EFE234E.8040807@taydin.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1325610770 26912 80.91.229.12 (3 Jan 2012 17:12:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 3 Jan 2012 17:12:50 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Timur Aydin Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 03 18:12:44 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 1Ri7uk-0003J0-8O for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Jan 2012 18:12:42 +0100 Original-Received: from localhost ([::1]:60095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri7uj-0005Ba-Nu for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Jan 2012 12:12:41 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:53915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri7uc-0004uz-Px for help-gnu-emacs@gnu.org; Tue, 03 Jan 2012 12:12:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ri7uY-0007Hr-H6 for help-gnu-emacs@gnu.org; Tue, 03 Jan 2012 12:12:34 -0500 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:65464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri7uY-0007Hg-Ei for help-gnu-emacs@gnu.org; Tue, 03 Jan 2012 12:12:30 -0500 Original-Received: by ggni2 with SMTP id i2so11743510ggn.0 for ; Tue, 03 Jan 2012 09:12:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=BxCNsa3XHGMDO7qyjIM8jF1TteoOcWFf6AGjNDbrRXs=; b=nctcQr2vH6ONFg1cktpgx2yGaJxgCLGEEcEuIS/SmXJ3VCDIQjUytdzKbw1FCkW/DP eFC+WzMrFaCEON/8SUVsq8dJ7xJVLBwXZCOI39M/lnQI+2rl2t3N3AJ2XCRA3kyRpmN4 om7DkyHoRBQwANApAcOaItTEuoyLAgu/yaEPk= Original-Received: by 10.50.15.161 with SMTP id y1mr74567306igc.4.1325610749090; Tue, 03 Jan 2012 09:12:29 -0800 (PST) Original-Received: by 10.42.4.149 with HTTP; Tue, 3 Jan 2012 09:11:49 -0800 (PST) In-Reply-To: <4EFE234E.8040807@taydin.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.169 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:83312 Archived-At: Perhaps you can use MuMaMo? http://www.emacswiki.org/emacs/MuMaMo "Mumamo is a library for cooperation of multiple major modes in a buffer. mumamo divides the buffer into chunks, each with its own major mode." Titus On Fri, Dec 30, 2011 at 9:47 PM, Timur Aydin wrote: > Hi, > > I am working on an xml file that has an embedded CDATA section which > contains lua source code. I am mostly working on the lua code and would like > that code to be syntax highlighted by emacs. When I activate lua-mode, it > understandably gets confused because of all the surrounding xml. When I > activate xml-mode, the xml stuff is properly syntax highlighted, but the lua > code in the CDATA section is uniformly colored plain text. > > Is there a way to utilize font-lock mode in a sensible manner? I attempted > to put the lua code in a separate file (script.lua) and then included it > into the xml using DOCTYPE and ENTITY tags, but this didn't help, because I > don't have any control over the software that parses this xml file. It isn't > able to deal with extra xml tags. > > So my only hope is to be able to tell emacs to font-lock a region bounded by > a CDATA tag using lua-mode and to font-lock the rest using xml-mode. Is > there a way to do this? > > -- > Timur Aydin > -- Titus von der Malsburg DFG Research Group 868: Mind and Brain Dynamics Dept. of Linguistics, University of Potsdam http://www.ling.uni-potsdam.de/~malsburg/