[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] Question reg. font-locking
From: |
Arash Esbati |
Subject: |
Re: [AUCTeX-devel] Question reg. font-locking |
Date: |
Tue, 16 Feb 2016 22:13:28 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 |
Hi Mosè,
Mosè Giordano <address@hidden> writes:
> 2016-02-13 21:45 GMT+01:00 Arash Esbati <address@hidden>:
>>
>> Is there a way to make `*' part of the macro?
>
> Not that I'm aware of, but I faced a similar problem some years ago
> with "\caption*" macro provided by longtable.sty package: the standard
> "\caption" macro takes an optional and a mandatory argument,
> "\caption*" by longtable.sty only a mandatory one: the font-locking
> specification that makes all cases work is "*[{".
>
> In your case I'd use:
>
> (font-latex-add-keywords '(("titleformat" "*{[{")) 'function)
> (font-latex-add-keywords '(("titlerule" "*[{")) 'function)
>
> They're not strictly true, but works in most cases, most importantly
> when the syntax is right. The rule of thumb is to use the minimum
> number of common mandatory arguments. There will be some cases with
> "good font-locking with wrong syntax", above all with "\titleformat",
> but I consider these cases less serious than "bad font-locking with
> right syntax".
Thanks for your response, I see your point and have an idea where to go
now.
> If you decide to go by this route, please add a comment explaining
> this is a workaround (like what I did in style/longtable.el),
> hopefully it'll be useful for other people reading that code.
Will do so.
> Anyway, feel free to investigate how to make it possible to specify
> font-locking rules with macros with a star in their name ;-)
Nice try ;-) I think that will not happen, font-latex is definitely
beyond my depth.
Cheers, Arash