From: Dmitry Gutov <dgutov@yandex.ru>
To: Paul Eggert <eggert@cs.ucla.edu>, 20613@debbugs.gnu.org
Subject: bug#20613: Font locking is poorly documented
Date: Wed, 20 May 2015 04:00:57 +0300 [thread overview]
Message-ID: <555BDCC9.6000900@yandex.ru> (raw)
In-Reply-To: <555BBC3D.4060503@cs.ucla.edu>
On 05/20/2015 01:42 AM, Paul Eggert wrote:
> (defun pretty-lambdas ()
> (font-lock-add-keywords
> nil `(("(\\(lambda\\>\\)"
> (0 (progn (compose-region (match-beginning 1) (match-end 1)
> ,(make-char 'greek-iso8859-7 107))
> nil))))))
>
> but I can't find documentation explaining why a progn is needed, or why
> it must return niil, or why one must use compose-region, or why one must
> use it with a single λ rather than just having a λ character there.
The return value is documented in the docstring of font-lock-keywords.
This case is (MATCHER . HIGHLIGHT), where HIGHLIGHT is MATCH-HIGHLIGHT.
The expression is supposed to return the face to use, but here it
returns nil, because it doesn't apply a face.
Unfortunately, using compose-region in it is pretty much undocumented
behavior. But since we can anticipate in which context the expression is
evaluated, it's still relatively safe WRT future changes in font-lock code.
next prev parent reply other threads:[~2015-05-20 1:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 22:42 bug#20613: Font locking is poorly documented Paul Eggert
2015-05-20 1:00 ` Dmitry Gutov [this message]
2019-11-17 6:20 ` Lars Ingebrigtsen
2020-04-16 4:13 ` Stefan Kangas
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=555BDCC9.6000900@yandex.ru \
--to=dgutov@yandex.ru \
--cc=20613@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).