all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sharon Kimble <boudiccas@skimble.plus.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Custom colour for a custom command
Date: Fri, 02 Oct 2015 20:13:53 +0100	[thread overview]
Message-ID: <87wpv5dqxa.fsf@skimble.plus.com> (raw)
In-Reply-To: <87r3le16md.fsf@debian.uxu> (Emanuel Berg's message of "Fri, 02 Oct 2015 02:00:58 +0200")

[-- Attachment #1: Type: text/plain, Size: 2192 bytes --]

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

> 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 -

--8<---------------cut here---------------start------------->8---
 \myparencite{1767}[18] and N-methyl-serotonin \parencite{ }[19]. 
--8<---------------cut here---------------end--------------->8---

where the green colouration continues after \myparencite into the
following text, and even colouring the \parencite which has not yet been
worked on.

These two lines are from my theme, if its relevant, -

--8<---------------cut here---------------start------------->8---
 '(font-lock-constant-face ((t (:foreground "#A6E22E"))))
 '(font-lock-doc-face ((t (:foreground "#EEDC82"))))
--8<---------------cut here---------------end--------------->8---

But it is usable so thanks very much. 

Thanks
Sharon.

>
> Note: If you open a file.tex, you might end up in
> TeX-mode or some other mode to do (La)TeX. So, first
> see if it works (after evaluation) with
>
>     M-x latex-mode RET
>
> then, if your mode isn't that, make the substitution
> in the code.
>
>> How can I have a colour of :foreground "green"
>> :background "black" for it in my theme please?
>
> As you see in the code, use the font-lock-*
> faces instead. I'm sure one of yours is green, so
> use that.
>
> One way of finding out which one is green is putting
> point at a char that has a green face and then invoke
> this:
>
> (defun what-face (pos)
>   (interactive "d")
>   (let((face (or (get-char-property pos 'face)
>                  (get-char-property pos 'read-cf-name) )))
>     (message " Face: %s" (or face "(no face!)")) ))
>
> Source: http://user.it.uu.se/~embe8573/conf/emacs-init/faces.el

-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.0, fluxbox 1.3.7, emacs 24.5.50.3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2015-10-02 19:13 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 [this message]
2015-10-03  0:47     ` Emanuel Berg
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=87wpv5dqxa.fsf@skimble.plus.com \
    --to=boudiccas@skimble.plus.com \
    --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.