GNU bug report logs -
#20613
Font locking is poorly documented
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Tue, 19 May 2015 22:43:01 UTC
Severity: wishlist
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 20613 <at> debbugs.gnu.org (full text, mbox):
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.
This bug report was last modified 5 years and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.