From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sharon Kimble Newsgroups: gmane.emacs.help Subject: Re: Custom colour for a custom command Date: Fri, 02 Oct 2015 20:13:53 +0100 Message-ID: <87wpv5dqxa.fsf@skimble.plus.com> References: <87mvw3re4i.fsf@skimble.plus.com> <87r3le16md.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1443815502 5806 80.91.229.3 (2 Oct 2015 19:51:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Oct 2015 19:51:42 +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 21:51:31 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 1Zi6Mc-0005r6-SS for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 21:51:31 +0200 Original-Received: from localhost ([::1]:34873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi6MW-0002zZ-VP for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 15:51:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5m4-00024C-1I for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 15:13:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi5lz-0000fM-8I for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 15:13:43 -0400 Original-Received: from avasout03.plus.net ([84.93.230.244]:55192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5lz-0000eu-2I for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 15:13:39 -0400 Original-Received: from london.london ([212.56.101.125]) by avasout03 with smtp id QKDc1r0032iKkuk01KDdmT; Fri, 02 Oct 2015 20:13:37 +0100 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=SKu/L7bH c=1 sm=1 tr=0 a=Z6vFUnHZFshV1nOgW1CWSg==:117 a=Z6vFUnHZFshV1nOgW1CWSg==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=MUnkXy62AAAA:8 a=LlzXLoV6AAAA:8 a=iI7HsYTVAAAA:8 a=VAAphzKdliTmNKsf980A:9 a=L81R5fWek2UpJsX_:21 a=kESW8tQ-rTiUZ6l2:21 a=rmtb54IHetG5FW-Kzr8A:9 X-AUTH: skimble@:2500 In-Reply-To: <87r3le16md.fsf@debian.uxu> (Emanuel Berg's message of "Fri, 02 Oct 2015 02:00:58 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 84.93.230.244 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:107480 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Emanuel Berg writes: > 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) ))) This is working well, except in this situation - =2D-8<---------------cut here---------------start------------->8--- \myparencite{1767}[18] and N-methyl-serotonin \parencite{ }[19].=20 =2D-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, - =2D-8<---------------cut here---------------start------------->8--- '(font-lock-constant-face ((t (:foreground "#A6E22E")))) '(font-lock-doc-face ((t (:foreground "#EEDC82")))) =2D-8<---------------cut here---------------end--------------->8--- But it is usable so thanks very much.=20 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 =2D-=20 A taste of linux =3D http://www.sharons.org.uk TGmeds =3D http://www.tgmeds.org.uk Debian 8.0, fluxbox 1.3.7, emacs 24.5.50.3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJWDtdxAAoJEDaBgBkK+INbJoQP/iu6GNfBZvyLaC6c/jagRwpO 3m69R3u8HjLzSson9+/2iSDo7ZbuzfHFC8DnXG8GOJeoANVc3fHvSGNEpGq9nM6F 0XGct4ndMnTWxgkrfWujXfU9TyN5ucHRxqBm/dNyfanJ0N14RsoKmwGZh/SEjmbS t7HJLbRoL6Z5Ep6kOgPw7Expp4F/9p1csW3b2h7H4+agyCVmJ3MXiwPAPL1gxGdM jrxPJYCbCn6FQBUtV+bRp2yiNcTfUbOXOhdrQaZFHfdMlAx7Ac2nNvouDU30ZYrg kaJ5z1ztDwjaWww2gcKcxajwGEwdo/FaPKNUsxpa0xiyqLz6x9Ck3jYdSQXFMyzY zSxZuX2C3+OCUdnaRMg8GuBmVLFq+/25o/Xltgmta2wfjbUbf3YG1maj4lHi5jC1 ySxHux7VuSQWgL9AKEtMt/+JJugroIywiab/hP67evGgGWMPtOtI2blizwhhXdf9 Od/7axq2bDLonl4WMW9Agd1+rqGMlFsAi6JZ9jz/dvYEQwjOXnu2qRETT/JIA7XK zzj6cadRHWistcasFlnm8Z2qaDv87cQDh9mPrO6V1EAJLFwx6K/3aDMzFPaWjNBd EMyK5n3m9bSMHp1W5ZVhfyRoXzMsTZ0w6+7i9QIXK5/sRT8lo3lR2F2HkEpmKXlz bajKHpimGzPvWhKcYMK7 =/hsW -----END PGP SIGNATURE----- --=-=-=--