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 02:47:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Sharon Kimble <boudiccas@skimble.plus.com> writes:

>>> I have a latex command called "\myparencite{foo}"
>>> which has the same colour as the surrounding text.
>> (font-lock-add-keywords 'latex-mode
>> '(("\\(myparencite\\){\\(.*\\)}" (1
>> font-lock-constant-face) (2 font-lock-doc-face) )))
>
> 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...

> These two lines are from my theme, if its relevant
>
>  '(font-lock-constant-face ((t (:foreground
> "#A6E22E")))) '(font-lock-doc-face ((t (:foreground
> "#EEDC82"))))

It is relevant in the sense that there you set those
color constants to the colors you'd like, but that is
the fun and easy part once the regexp matches.

Note that font-lock-constant-face and -doc- ditto are
only placeholders for a color in this case, so instead
of changing those colors (unless for some other reason
of course) in this case you probably have colors that
you like already, so pick the font-lock-constant-*s
that correspond to them you like. Because obviously if
you change the colors in your theme them will change
not only those two new matches (when it works) but all
Emacs which uses those font constants, and that should
be a lot and the more the marrier. Right?

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




reply via email to

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