all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Custom colour for a custom command
Date: Sat, 03 Oct 2015 03:16:00 +0200	[thread overview]
Message-ID: <87mvw0rbu7.fsf@debian.uxu> (raw)
In-Reply-To: 87612on5g5.fsf@debian.uxu

Emanuel Berg <embe8573@student.uu.se> 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




  reply	other threads:[~2015-10-03  1:16 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
2015-10-03  0:47     ` Emanuel Berg
2015-10-03  1:16       ` Emanuel Berg [this message]
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=87mvw0rbu7.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --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.