help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Custom colour for a custom command


From: Emanuel Berg
Subject: Re: Custom colour for a custom command
Date: Sat, 03 Oct 2015 03:16:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

>> This is working well, except in this situation -
>>
>> \myparencite{1767}[18] and N-methyl-serotonin
>> \parencite{ }[19].
>>
>> where the green colouration continues after
>> \myparencite into the following text, and even
>> colouring the \parencite which has not yet been
>> worked on.
>
> Okay, well obviously that shouldn't happen so then
> there is a bug in the regexp. Stay tuned...

Try this:

(font-lock-add-keywords 'latex-mode
                        '(("\\(myparencite\\){\\(\\(.\\|\n\\)*?\\)}"
                           (1 font-lock-constant-face)
                           (2 font-lock-doc-face) )))

Here is a dump that shows that it works :P

    http://user.it.uu.se/~embe8573/dumps/faces.png

But seriously, this is a quick fix that is useful to
know and often to use but for more complicated stuff
it will run into to problems - that are patchable (?)
- sooner or later anyway (both the problems and the
patches).

So probably instead I'd be content with just
highlighting the command which will make for
a super-easy regexp and a most-definitely tangible
improvement at low cost.

Otherwise dig deep. Here, I have a piece of code that
hopefully will discourage you from such long-ear
workaholicism - highlighting starts line 246. No, only
those mad, or very enthusiastic, do that sort of
things...

    http://user.it.uu.se/~embe8573/fps/fpscalc.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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