[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: |
Fri, 02 Oct 2015 02:00:58 +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) )))
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
--
underground experts united
http://user.it.uu.se/~embe8573