From: Joost Kremers <joostkremers@fastmail.fm>
To: help-gnu-emacs@gnu.org
Subject: Re: Font lock question
Date: Thu, 18 Mar 2021 20:41:03 +0100 [thread overview]
Message-ID: <875z1ow866.fsf@fastmail.fm> (raw)
In-Reply-To: <jwvmtv1ivd3.fsf-monnier+emacs@gnu.org>
On Wed, Mar 17 2021, Stefan Monnier wrote:
>>> 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?
There are. What I'm really trying to achieve is fontifying Pandoc-style
citations in Markdown files. There are several other Markdown elements that use
brackets, so perhaps Harald's suggestion to use the entire `[aBc` as an anchor
is probably less error-prone.
> 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`.
Even if they may occasionally span two lines, I assume citations will rarely
span more than that, so font-lock-multiline may be an option. (Esp. given that
`markdown-mode.el` does, as well.)
--
Joost Kremers
Life has its moments
next prev parent reply other threads:[~2021-03-18 19:41 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
2021-03-18 19:41 ` Joost Kremers [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875z1ow866.fsf@fastmail.fm \
--to=joostkremers@fastmail.fm \
--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.