auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Re: Fontifying of titles...


From: Ralf Angeli
Subject: Re: [AUCTeX-devel] Re: Fontifying of titles...
Date: Tue, 05 Apr 2005 15:04:01 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

* David Kastrup (2005-04-05) writes:

> Ralf Angeli <address@hidden> writes:
>
>> Each part is determined by one match and will get a different face.
>> If there is more than one mandatory argument, the match will span
>> all arguments:
>>
>> \fooo[bar]{baz}{bla}
>> |_1_||_2_||___3____|
>
> IIRC, you had a change proposal in your explanation.  If this stands
> any chance of being implemented in a reasonable time frame, it would
> probably impact the results of the survey.  So if you are leaning
> towards the idea of working on this in the next months/versions, we
> should probably shift the poll to some later time, when we are more or
> less sure that the default behavior can't be improved further.

I don't have a change proposal.  And the way I understand font-lock.el
implementing such a change would be rather difficult or at least
result in horrible code.

Font locking of keywords basically works like this (for a more
detailed description look into the doc string of
`font-lock-keywords'): You define several elements with the following
structure.

(<matcher>
  (1 <face1>)
  (2 <face2>)
  (3 <face3>))

The matcher may be a regexp or a function setting the match data.
font-lock.el will the apply the defined faces to the respective parts
of the match.  That means for

\magenta[orange]{blue}[yellow]{green}

you'd need `(<matcher> (1 magenta) (2 orange) (2 yellow) (4 green))'.
For every such combination of arguments and colors you will need a
separate item in `font-lock-keywords'.

As the face specification can be any sort of expression returning a
face symbol I thought about implementing a check there which would
return different faces for different keywords, but I don't see a way
to check for properties of the matcher.  Global variables would work
though, so maybe this could be a way to avoid the combinatorial
nightmare I constructed above.

We'd then get some sort of super matcher, i.e. an item in
`font-lock-keywords' which could deal with, say, up to ten or twenty
matches and would decide on the fly which face would have to be used
for which match.

But this is just a rough idea and I don't know when I will be coming
around looking at it.

-- 
Ralf




reply via email to

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