www.delorie.com/gnu/docs/elisp-manual-21/elisp_639.html   search  
 
Buy the book!


GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

38.11.8 Automatic Face Assignment

Starting with Emacs 21, a hook is available for automatically assigning faces to text in the buffer. This hook is used for part of the implementation of Font-Lock mode.

Variable: fontification-functions
This variable holds a list of functions that are called by Emacs redisplay as needed to assign faces automatically to text in the buffer.

The functions are called in the order listed, with one argument, a buffer position pos. Each function should attempt to assign faces to the text in the current buffer starting at pos.

Each function should record the faces they assign by setting the face property. It should also add a non-nil fontified property for all the text it has assigned faces to. That property tells redisplay that faces have been assigned to that text already.

It is probably a good idea for each function to do nothing if the character after pos already has a non-nil fontified property, but this is not required. If one function overrides the assignments made by a previous one, the properties as they are after the last function finishes are the ones that really matter.

For efficiency, we recommend writing these functions so that they usually assign faces to around 400 to 600 characters at each call.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003