unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20613: Font locking is poorly documented
@ 2015-05-19 22:42 Paul Eggert
  2015-05-20  1:00 ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2015-05-19 22:42 UTC (permalink / raw)
  To: 20613

I was recently urged to use font locking to support a feature in Emacs, 
and I must say that I am still confused about how it works even after 
reading the Elisp manual several times.  The manual has a lot of 
low-level discussion of mechanism, but it doesn't explain policy and 
since crucial features seem to be undocumented, I'm at a loss as to how 
to use it, or how to debug it when it's not working. I finally gave up 
and used Google and found cookbook stuff, but I have no idea how or why 
it works as well as it does, or why it fails when it does.  For example:

http://www.emacswiki.org/emacs/PrettyLambda

gives this example:

(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.

One small suggestion: add a section explaining how the above example works.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-16  4:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-19 22:42 bug#20613: Font locking is poorly documented Paul Eggert
2015-05-20  1:00 ` Dmitry Gutov
2019-11-17  6:20   ` Lars Ingebrigtsen
2020-04-16  4:13     ` Stefan Kangas

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).