From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Custom colour for a custom command Date: Fri, 02 Oct 2015 02:00:58 +0200 Message-ID: <87r3le16md.fsf@debian.uxu> References: <87mvw3re4i.fsf@skimble.plus.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443752559 32236 80.91.229.3 (2 Oct 2015 02:22:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Oct 2015 02:22:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 02 04:22:30 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZhpzQ-0006xB-No for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 04:22:28 +0200 Original-Received: from localhost ([::1]:57072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhpzP-0004ey-P8 for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Oct 2015 22:22:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhpzE-0004el-4w for help-gnu-emacs@gnu.org; Thu, 01 Oct 2015 22:22:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhpzA-0006nt-7W for help-gnu-emacs@gnu.org; Thu, 01 Oct 2015 22:22:16 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:49790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhne0-0003ye-1d for help-gnu-emacs@gnu.org; Thu, 01 Oct 2015 19:52:12 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zhndy-0001ep-Ck for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 01:52:10 +0200 Original-Received: from nl106-137-244.student.uu.se ([130.243.137.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Oct 2015 01:52:10 +0200 Original-Received: from embe8573 by nl106-137-244.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Oct 2015 01:52:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 40 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-244.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:jg+vvkaqm76Ca3lMvEciKRw3+Sg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107452 Archived-At: Sharon Kimble 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