all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Custom colour for a custom command
Date: Sat, 03 Oct 2015 02:47:38 +0200	[thread overview]
Message-ID: <87612on5g5.fsf@debian.uxu> (raw)
In-Reply-To: 87wpv5dqxa.fsf@skimble.plus.com

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	other threads:[~2015-10-03  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 17:49 Custom colour for a custom command Sharon Kimble
2015-10-02  0:00 ` Emanuel Berg
2015-10-02 19:13   ` Sharon Kimble
2015-10-03  0:47     ` Emanuel Berg [this message]
2015-10-03  1:16       ` Emanuel Berg
2015-10-04  0:22         ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87612on5g5.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.