unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Font lock question
Date: Wed, 17 Mar 2021 12:46:57 -0400	[thread overview]
Message-ID: <jwvmtv1ivd3.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87o8fhwyai.fsf@fastmail.fm> (Joost Kremers's message of "Wed, 17 Mar 2021 17:09:41 +0100")

>> But be aware that these approaches still won't work well if the [...]
>> thing can span multiple lines.
> Hmm, I'm afraid that is indeed possible. Perhaps I'll keep it simple and only
> font-lock the `B` part, since it can't contain any spaces and is fairly easy to
> do.

Can there be [...] without any `aBc`s in them and which need to be
font-lock differently?

If not (and if it shouldn't span too many lines), then I think
a MATCH-ANCHORED that just matches on the opening "[" and then uses the
PRE-MATCH-FORM to return the position of the matching "]" should work
acceptably, as long as you use `font-lock-multiline`.


        Stefan




  reply	other threads:[~2021-03-17 16:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  9:40 Font lock question Joost Kremers
2021-03-17 13:39 ` Stefan Monnier
2021-03-17 13:46   ` Joost Kremers
2021-03-17 15:33     ` Stefan Monnier
2021-03-17 16:09       ` Joost Kremers
2021-03-17 16:46         ` Stefan Monnier [this message]
2021-03-18 19:41           ` Joost Kremers
2021-03-17 16:31     ` Harald Jörg
2021-03-18 19:53       ` Joost Kremers
  -- strict thread matches above, loose matches on Subject: below --
2008-05-28 10:34 Shaun Johnson

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmtv1ivd3.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    --cc=joostkremers@fastmail.fm \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).