help-source-highlight
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-source-highlight] conditional highlight (without losing other


From: Federico Bruni
Subject: Re: [Help-source-highlight] conditional highlight (without losing other definitions)
Date: Sat, 11 Feb 2012 13:58:42 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120129 Thunderbird/10.0

Il 07/02/2012 21:48, Lorenzo Bettini ha scritto:
On 02/02/2012 06:09 PM, Federico Bruni wrote:
Hi,

I'm trying to find a smarter way to highlight some strings:

All the "\strings" inside \markup{ ... } should have a different colour
of \strings occurences in other parts of the input.
How can I achieve that in a smart way (i.e. without using a list of all
the \strings which can occur inside a \markup{} block)?

I want to preserve all the other highlighting definitions. Maybe
state|environment is not the right tool? Because in Doc 7.9 it says:

"When entering a state/environment, however, the definitions given
outside the state/environment are not matched. "

Let's do an example:

\markup {
\override #'(box-padding . 1.0) \override #'(baseline-skip . 2.7) \box
\center-column {
\small \line { Sheet music from \with-url
#"http://www.MutopiaProject.org";
\line { \teeny www. \hspace #-0.5 MutopiaProject \hspace #-0.5 \teeny
.org \hspace #0.5 }
}
}
}

I want to match only: \override \box \center-column \small \line
\with-url \teeny \hspace

The following environment:

environment markup delim '\\markup\s*\{' "}" multiline nested begin
environment markup delim "{" "}" multiline nested begin
markup_command = '\\[[:alpha:]-]+'
end
end

Hi

what is that - '\\[[:alpha:]-]+' ?

if the strings starting with \ are fixed, you could simply list them

markup_command = "\override","\box" etc.


I want to avoid using a list: that's the main purpose of my question :)
I said it explicitly:
>> How can I achieve that in a smart way (i.e. without using a list of all
>> the \strings which can occur inside a \markup{} block)?



can see the relevant block and highlight the \strings correctly, but at
the same time it breaks something, in particular some elements lose
their highlighting (as documentations says):

1) \markup
2) {}
3) #......

I didn't understand this, could you please elaborate it?


In my lilypond.lang file all these three elements are defined, so that they are supposed to have their own highlighting: \markup and {} are bold black, #... is kind of brown. But if I use the environment pasted above their highlighting is overridden.

I attach the current version of the files.
As you can see, I wrote a list for markup_command, but this is not much efficient because some \commands should be highlighted as markup commands only if they are inside a \markup{} block (for example, \override). I chose to put in the list only the \commands specific of a \markup block, but if I could make this "conditional highlighting" work it would be much better (for a number of reasons).

I'll be off for a week. I hope to finalize it as soon as I'm back.
If you have any advice in the meanwhile, I'll be happy to hear :)

Thanks,
Federico

Attachment: lilypond.lang
Description: Text document

Attachment: lilypond.style
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]