* Useful syntax highlighting (font lock) in a mixed xml lua file
@ 2011-12-30 20:47 Timur Aydin
2012-01-01 20:18 ` Fwd: " Timur Aydin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Timur Aydin @ 2011-12-30 20:47 UTC (permalink / raw
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Fwd: Useful syntax highlighting (font lock) in a mixed xml lua file
2011-12-30 20:47 Useful syntax highlighting (font lock) in a mixed xml lua file Timur Aydin
@ 2012-01-01 20:18 ` Timur Aydin
2012-01-01 20:32 ` Lennart Borgman
2012-01-03 11:03 ` David Edmondson
2012-01-03 17:11 ` Titus von der Malsburg
2 siblings, 1 reply; 5+ messages in thread
From: Timur Aydin @ 2012-01-01 20:18 UTC (permalink / raw
To: emacs-devel
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...
--
Timur
-------- 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 <ta@taydin.org>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Useful syntax highlighting (font lock) in a mixed xml lua file
2012-01-01 20:18 ` Fwd: " Timur Aydin
@ 2012-01-01 20:32 ` Lennart Borgman
0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2012-01-01 20:32 UTC (permalink / raw
To: Timur Aydin; +Cc: emacs-devel
On Sun, Jan 1, 2012 at 21:18, Timur Aydin <ta@taydin.org> 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 <ta@taydin.org>
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Useful syntax highlighting (font lock) in a mixed xml lua file
2011-12-30 20:47 Useful syntax highlighting (font lock) in a mixed xml lua file Timur Aydin
2012-01-01 20:18 ` Fwd: " Timur Aydin
@ 2012-01-03 11:03 ` David Edmondson
2012-01-03 17:11 ` Titus von der Malsburg
2 siblings, 0 replies; 5+ messages in thread
From: David Edmondson @ 2012-01-03 11:03 UTC (permalink / raw
To: Timur Aydin, help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]
On Fri, 30 Dec 2011 22:47:10 +0200, Timur Aydin <ta@taydin.org> wrote:
> 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?
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.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Useful syntax highlighting (font lock) in a mixed xml lua file
2011-12-30 20:47 Useful syntax highlighting (font lock) in a mixed xml lua file Timur Aydin
2012-01-01 20:18 ` Fwd: " Timur Aydin
2012-01-03 11:03 ` David Edmondson
@ 2012-01-03 17:11 ` Titus von der Malsburg
2 siblings, 0 replies; 5+ messages in thread
From: Titus von der Malsburg @ 2012-01-03 17:11 UTC (permalink / raw
To: Timur Aydin; +Cc: help-gnu-emacs
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 <ta@taydin.org> 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/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-03 17:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-30 20:47 Useful syntax highlighting (font lock) in a mixed xml lua file Timur Aydin
2012-01-01 20:18 ` Fwd: " Timur Aydin
2012-01-01 20:32 ` Lennart Borgman
2012-01-03 11:03 ` David Edmondson
2012-01-03 17:11 ` Titus von der Malsburg
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.