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: Sat, 03 Oct 2015 03:16:00 +0200 Message-ID: <87mvw0rbu7.fsf@debian.uxu> References: <87mvw3re4i.fsf@skimble.plus.com> <87r3le16md.fsf@debian.uxu> <87wpv5dqxa.fsf@skimble.plus.com> <87612on5g5.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443834466 16862 80.91.229.3 (3 Oct 2015 01:07:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Oct 2015 01:07:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 03 03:07:38 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 1ZiBIV-0002ti-7Y for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Oct 2015 03:07:35 +0200 Original-Received: from localhost ([::1]:36340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiBIU-0001WS-GF for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Oct 2015 21:07:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiBII-0001Vz-RE for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 21:07:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiBIE-00063z-MH for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 21:07:22 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:44576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiBIE-00063l-Fx for help-gnu-emacs@gnu.org; Fri, 02 Oct 2015 21:07:18 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZiBI7-0002QD-Gq for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 03:07:11 +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 ; Sat, 03 Oct 2015 03:07:11 +0200 Original-Received: from embe8573 by nl106-137-244.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Oct 2015 03:07:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 48 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:7kUvh+duUn4oXukI3D6Kl/nXRKQ= 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:107490 Archived-At: Emanuel Berg writes: >> 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... Try this: (font-lock-add-keywords 'latex-mode '(("\\(myparencite\\){\\(\\(.\\|\n\\)*?\\)}" (1 font-lock-constant-face) (2 font-lock-doc-face) ))) Here is a dump that shows that it works :P http://user.it.uu.se/~embe8573/dumps/faces.png But seriously, this is a quick fix that is useful to know and often to use but for more complicated stuff it will run into to problems - that are patchable (?) - sooner or later anyway (both the problems and the patches). So probably instead I'd be content with just highlighting the command which will make for a super-easy regexp and a most-definitely tangible improvement at low cost. Otherwise dig deep. Here, I have a piece of code that hopefully will discourage you from such long-ear workaholicism - highlighting starts line 246. No, only those mad, or very enthusiastic, do that sort of things... http://user.it.uu.se/~embe8573/fps/fpscalc.el -- underground experts united http://user.it.uu.se/~embe8573