From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Useful syntax highlighting (font lock) in a mixed xml lua file Date: Sun, 1 Jan 2012 21:32:30 +0100 Message-ID: References: <4EFE234E.8040807@taydin.org> <4F00BF98.2010306@taydin.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1325449988 15417 80.91.229.12 (1 Jan 2012 20:33:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 Jan 2012 20:33:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Timur Aydin Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 01 21:33:04 2012 Return-path: Envelope-to: ged-emacs-devel@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 1RhS5Y-0005n5-4M for ged-emacs-devel@m.gmane.org; Sun, 01 Jan 2012 21:33:04 +0100 Original-Received: from localhost ([::1]:33728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhS5S-0004Yy-9b for ged-emacs-devel@m.gmane.org; Sun, 01 Jan 2012 15:32:58 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:40840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhS5O-0004Yt-EJ for emacs-devel@gnu.org; Sun, 01 Jan 2012 15:32:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhS5N-0006fU-A8 for emacs-devel@gnu.org; Sun, 01 Jan 2012 15:32:54 -0500 Original-Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:60767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhS5N-0006fF-4I for emacs-devel@gnu.org; Sun, 01 Jan 2012 15:32:53 -0500 Original-Received: by lagv3 with SMTP id v3so4550706lag.0 for ; Sun, 01 Jan 2012 12:32:51 -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=nnUqOcjVRk0cwJtIRzQEJovAguwx43NBnE2mTP+Gqig=; b=XfkxzWd1wdFS1jizWDT/+HK9RAPjYlQm6QMOn7hF5FN+LZ+6U+QbRLGROVBPwn+irm H6/c1ZzjysZKY4CZp5C6dEelTpnPlqA07awPPI9ciD5QhbIhSf08g8bnSq9jsHWk4cnI O6QHaJN55sL/8ILS+oyEJWdrQ8XWucxZ3MPsM= Original-Received: by 10.152.103.71 with SMTP id fu7mr36857124lab.31.1325449971135; Sun, 01 Jan 2012 12:32:51 -0800 (PST) Original-Received: by 10.152.124.44 with HTTP; Sun, 1 Jan 2012 12:32:30 -0800 (PST) In-Reply-To: <4F00BF98.2010306@taydin.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.215.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:147135 Archived-At: On Sun, Jan 1, 2012 at 21:18, Timur Aydin wrote: > Hello and a happy new year to everyone! > > I had sent the following post to the help-gnu-emacs group, but thinking > that it might require some special lisp programming, wanted to post the > same question here as well... In principle this can be done by defining a multi major mode with mumamo (which is part of nXhtml). There are several examples in nXhtml for how to define multi major modes. (See all the .el files that have "mumamo" in their names.) > -------- Original Message -------- > Subject: Useful syntax highlighting (font lock) in a mixed xml lua file > Date: Fri, 30 Dec 2011 22:47:10 +0200 > From: Timur Aydin > To: help-gnu-emacs@gnu.org > > 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 >