From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Font Lock documentation. Date: Fri, 22 Apr 2005 15:24:30 +0200 Message-ID: <87vf6f7xm9.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1114176311 20578 80.91.229.2 (22 Apr 2005 13:25:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 22 Apr 2005 13:25:11 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 22 15:25:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DOy9G-0004iG-2m for ged-emacs-devel@m.gmane.org; Fri, 22 Apr 2005 15:24:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DOyE9-0004Bf-86 for ged-emacs-devel@m.gmane.org; Fri, 22 Apr 2005 09:29:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DOyDx-0004BZ-8z for emacs-devel@gnu.org; Fri, 22 Apr 2005 09:29:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DOyDw-0004BN-38 for emacs-devel@gnu.org; Fri, 22 Apr 2005 09:29:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DOyDv-0003m3-Te for emacs-devel@gnu.org; Fri, 22 Apr 2005 09:29:36 -0400 Original-Received: from [194.109.24.34] (helo=smtp-vbr14.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DOyBY-0005Wl-Hk for emacs-devel@gnu.org; Fri, 22 Apr 2005 09:27:09 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr14.xs4all.nl (8.12.11/8.12.11) with ESMTP id j3MDOWe6083450 for ; Fri, 22 Apr 2005 15:24:32 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DOy91-0002g1-00 for ; Fri, 22 Apr 2005 15:24:31 +0200 Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 733 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36270 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36270 I've worked on improving the Font Lock documentation. Here's what I have done. Ok to commit? Lute. 2005-04-22 Lute Kamstra * modes.texi (Defining Minor Modes): Add cross reference. (Font Lock Mode): Simplify. (Font Lock Basics): Say that font-lock-defaults is buffer-local when set and that some parts are optional. Add cross references. (Search-based Fontification): Say how to specify font-lock-keywords. Add cross references. Add font-lock-multiline to index. Move font-lock-keywords-case-fold-search here from node "Other Font Lock Variables". Document font-lock-add-keywords and font-lock-remove-keywords (Other Font Lock Variables): Move font-lock-keywords-only, font-lock-syntax-table, font-lock-beginning-of-syntax-function, and font-lock-syntactic-face-function to node "Syntactic Font Lock". Move font-lock-keywords-case-fold-search to node "Search-based Fontification". Document font-lock-inhibit-thing-lock and font-lock-{,un}fontify-{buffer,region}-function. (Precalculated Fontification): Add font-lock-core-only to index. Update example. (Syntactic Font Lock): Add intro. Move font-lock-keywords-only, font-lock-syntax-table, font-lock-beginning-of-syntax-function, and font-lock-syntactic-face-function here from node "Other Font Lock Variables". Add cross references. * hooks.texi (Standard Hooks): Add Font-Lock functions. 2005-04-22 Lute Kamstra * font-core.el (font-lock-defaults): Fix docstring. * font-lock.el (font-lock-syntactic-face-function): Fix docstring. Index: lispref/modes.texi =================================================================== RCS file: /cvsroot/emacs/emacs/lispref/modes.texi,v retrieving revision 1.96 diff -c -r1.96 modes.texi *** lispref/modes.texi 19 Apr 2005 21:06:00 -0000 1.96 --- lispref/modes.texi 22 Apr 2005 13:18:54 -0000 *************** *** 1131,1137 **** Custom group name to use in all generated @code{defcustom} forms. Defaults to @var{mode} without the possible trailing @samp{-mode}. Be aware that this default may not be a valid customization group defined ! with @code{defgroup}. Please make sure it is. @item :global @var{global} If non-@code{nil} specifies that the minor mode should be global. --- 1131,1138 ---- Custom group name to use in all generated @code{defcustom} forms. Defaults to @var{mode} without the possible trailing @samp{-mode}. Be aware that this default may not be a valid customization group defined ! with @code{defgroup} (@pxref{Group Definitions}). Please make sure it ! is. @item :global @var{global} If non-@code{nil} specifies that the minor mode should be global. *************** *** 2020,2031 **** which contexts. This section explains how to customize Font Lock for a particular major mode. ! Font Lock mode finds text to highlight in two ways: through syntactic ! parsing based on the syntax table, and through searching (usually for ! regular expressions). Syntactic fontification happens first; it finds ! comments and string constants, and highlights them using ! @code{font-lock-comment-face} and @code{font-lock-string-face} ! (@pxref{Faces for Font Lock}). Search-based fontification follows. @menu * Font Lock Basics:: Overview of customizing Font Lock. --- 2021,2031 ---- which contexts. This section explains how to customize Font Lock for a particular major mode. ! Font Lock mode finds text to highlight in two ways: through ! syntactic parsing based on the syntax table, and through searching ! (usually for regular expressions). Syntactic fontification happens ! first; it finds comments and string constants and highlights them. ! Search-based fontification follows. @menu * Font Lock Basics:: Overview of customizing Font Lock. *************** *** 2036,2043 **** * Precalculated Fontification:: How Lisp programs that produce the buffer contents can also specify how to fontify it. * Faces for Font Lock:: Special faces specifically for Font Lock. ! * Syntactic Font Lock:: Defining character syntax based on context ! using the Font Lock mechanism. @end menu @node Font Lock Basics --- 2036,2042 ---- * Precalculated Fontification:: How Lisp programs that produce the buffer contents can also specify how to fontify it. * Faces for Font Lock:: Special faces specifically for Font Lock. ! * Syntactic Font Lock:: Fontification based on syntax tables. @end menu @node Font Lock Basics *************** *** 2051,2095 **** @defvar font-lock-defaults This variable is set by major modes, as a buffer-local variable, to ! specify how to fontify text in that mode. The value should look like ! this: @example ! (@var{keywords} @var{keywords-only} @var{case-fold} ! @var{syntax-alist} @var{syntax-begin} @var{other-vars}@dots{}) @end example The first element, @var{keywords}, indirectly specifies the value of ! @code{font-lock-keywords}. It can be a symbol, a variable whose value ! is the list to use for @code{font-lock-keywords}. It can also be a list of ! several such symbols, one for each possible level of fontification. The ! first symbol specifies how to do level 1 fontification, the second ! symbol how to do level 2, and so on. The second element, @var{keywords-only}, specifies the value of the variable @code{font-lock-keywords-only}. If this is non-@code{nil}, syntactic fontification (of strings and comments) is not performed. The third element, @var{case-fold}, specifies the value of ! @code{font-lock-keywords-case-fold-search}. If it is non-@code{nil}, Font Lock ! mode ignores case when searching as directed by ! @code{font-lock-keywords}. ! If the fourth element, @var{syntax-alist}, is non-@code{nil}, it should be ! a list of cons cells of the form @code{(@var{char-or-string} . @var{string})}. These are used to set up a syntax table for fontification (@pxref{Syntax Table Functions}). The resulting syntax ! table is stored in @code{font-lock-syntax-table}. The fifth element, @var{syntax-begin}, specifies the value of ! @code{font-lock-beginning-of-syntax-function} (see below). All the remaining elements (if any) are collectively called @var{other-vars}. Each of these elements should have the form ! @code{(@var{variable} . @var{value})}---which means, make @var{variable} ! buffer-local and then set it to @var{value}. You can use these ! @var{other-vars} to set other variables that affect fontification, ! aside from those you can control with the first five elements. @end defvar @node Search-based Fontification --- 2050,2099 ---- @defvar font-lock-defaults This variable is set by major modes, as a buffer-local variable, to ! specify how to fontify text in that mode. It automatically becomes ! buffer-local when you set it. The value should look like this: @example ! (@var{keywords} [@var{keywords-only} [@var{case-fold} ! [@var{syntax-alist} [@var{syntax-begin} @var{other-vars}@dots{}]]]]) @end example The first element, @var{keywords}, indirectly specifies the value of ! @code{font-lock-keywords} (@pxref{Search-based Fontification}). It ! can be a symbol, a variable or a function whose value is the list to ! use for @code{font-lock-keywords}. It can also be a list of several ! such symbols, one for each possible level of fontification. The first ! symbol specifies how to do level 1 fontification, the second symbol ! how to do level 2, and so on. @xref{Levels of Font Lock}. The second element, @var{keywords-only}, specifies the value of the variable @code{font-lock-keywords-only}. If this is non-@code{nil}, syntactic fontification (of strings and comments) is not performed. + @xref{Syntactic Font Lock}. The third element, @var{case-fold}, specifies the value of ! @code{font-lock-keywords-case-fold-search}. If it is non-@code{nil}, ! Font Lock mode ignores case when searching as directed by ! @code{font-lock-keywords}. @xref{Search-based Fontification}. ! If the fourth element, @var{syntax-alist}, is non-@code{nil}, it ! should be a list of cons cells of the form @code{(@var{char-or-string} . @var{string})}. These are used to set up a syntax table for fontification (@pxref{Syntax Table Functions}). The resulting syntax ! table is stored in @code{font-lock-syntax-table}. @xref{Syntactic ! Font Lock}. The fifth element, @var{syntax-begin}, specifies the value of ! @code{font-lock-beginning-of-syntax-function} (@pxref{Syntactic Font ! Lock}). All the remaining elements (if any) are collectively called @var{other-vars}. Each of these elements should have the form ! @code{(@var{variable} . @var{value})}---which means, make ! @var{variable} buffer-local and then set it to @var{value}. You can ! use these @var{other-vars} to set other variables that affect ! fontification, aside from those you can control with the first five ! elements. @xref{Other Font Lock Variables}. @end defvar @node Search-based Fontification *************** *** 2097,2103 **** The most important variable for customizing Font Lock mode is @code{font-lock-keywords}. It specifies the search criteria for ! search-based fontification. @defvar font-lock-keywords This variable's value is a list of the keywords to highlight. Be --- 2101,2109 ---- The most important variable for customizing Font Lock mode is @code{font-lock-keywords}. It specifies the search criteria for ! search-based fontification. The value of this variable should be ! specified with @var{keywords} in @code{font-lock-defaults} ! (@pxref{Font Lock Basics}). @defvar font-lock-keywords This variable's value is a list of the keywords to highlight. Be *************** *** 2187,2193 **** @code{font-lock-extra-managed-props} so that the properties will also be cleared out when they are no longer appropriate. Alternatively, you can set the variable @code{font-lock-unfontify-region-function} to ! a function that clears these properties. @item (@var{matcher} . @var{subexp-highlighter}) In this kind of element, @var{subexp-highlighter} is a list --- 2193,2200 ---- @code{font-lock-extra-managed-props} so that the properties will also be cleared out when they are no longer appropriate. Alternatively, you can set the variable @code{font-lock-unfontify-region-function} to ! a function that clears these properties. @xref{Other Font Lock ! Variables}. @item (@var{matcher} . @var{subexp-highlighter}) In this kind of element, @var{subexp-highlighter} is a list *************** *** 2307,2312 **** --- 2314,2320 ---- Its value should have one of the forms described in this table. @end table + @vindex font-lock-multiline @strong{Warning:} Do not design an element of @code{font-lock-keywords} to match text which spans lines; this does not work reliably. While @code{font-lock-fontify-buffer} handles multi-line patterns correctly, *************** *** 2317,2368 **** setting @code{font-lock-multiline} to @code{t}. But it still will not work in all cases. ! @node Other Font Lock Variables ! @subsection Other Font Lock Variables ! ! This section describes additional variables that a major mode ! can set by means of @code{font-lock-defaults}. ! ! @defvar font-lock-keywords-only ! Non-@code{nil} means Font Lock should not fontify comments or strings ! syntactically; it should only fontify based on ! @code{font-lock-keywords}. ! @end defvar ! ! @ignore ! Other variables include those for buffer-specialized fontification functions, ! `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', ! `font-lock-fontify-region-function', `font-lock-unfontify-region-function', ! `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'. ! @end ignore @defvar font-lock-keywords-case-fold-search Non-@code{nil} means that regular expression matching for the sake of @code{font-lock-keywords} should be case-insensitive. @end defvar ! @defvar font-lock-syntax-table ! This variable specifies the syntax table to use for fontification of ! comments and strings. ! @end defvar ! @defvar font-lock-beginning-of-syntax-function ! If this variable is non-@code{nil}, it should be a function to move ! point back to a position that is syntactically at ``top level'' and ! outside of strings or comments. Font Lock uses this when necessary ! to get the right results for syntactic fontification. ! This function is called with no arguments. It should leave point at the ! beginning of any enclosing syntactic block. Typical values are ! @code{beginning-of-line} (i.e., the start of the line is known to be ! outside a syntactic block), or @code{beginning-of-defun} for programming ! modes or @code{backward-paragraph} for textual modes (i.e., the ! mode-dependent function is known to move outside a syntactic block). ! If the value is @code{nil}, the beginning of the buffer is used as a ! position outside of a syntactic block. This cannot be wrong, but it can ! be slow. ! @end defvar @defvar font-lock-mark-block-function If this variable is non-@code{nil}, it should be a function that is --- 2325,2398 ---- setting @code{font-lock-multiline} to @code{t}. But it still will not work in all cases. ! You can use @var{case-fold} in @code{font-lock-defaults} (@pxref{Font ! Lock Basics}) to specify the value of ! @code{font-lock-keywords-case-fold-search} which says whether ! search-based fontification should be case-insensitive. @defvar font-lock-keywords-case-fold-search Non-@code{nil} means that regular expression matching for the sake of @code{font-lock-keywords} should be case-insensitive. @end defvar ! It is possible to add keywords to highlight to what is already ! specified by @code{font-lock-keywords}. You can use this to change ! the normal search-based fontification that is performed by a major ! mode. ! ! @defun font-lock-add-keywords mode keywords &optional append ! This function adds highlighting @var{keywords} for @var{mode}. The ! argument @var{mode} should be a symbol, the major mode command name, ! such as @code{c-mode}. @var{mode} can also be @code{nil}; the ! highlighting @var{keywords} are added for the current buffer in that ! case. @var{keywords} should be a list like for the variable ! @code{font-lock-keywords}. By default they are added at the beginning ! of the current highlighting list. If the optional argument ! @var{append} is @code{set}, they are used to replace the current ! highlighting list. If @var{append} is any other non-nil value, they ! are added at the end of the current highlighting list. ! For example: ! @smallexample ! (font-lock-add-keywords 'c-mode ! '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend) ! ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face))) ! @end smallexample ! adds two fontification patterns for C mode. One to fontify ! @samp{FIXME} words, even in comments, and another to fontify ! @samp{and}, @samp{or} and @samp{not} words as keywords. ! ! Some modes have specialized support for additional patterns. See the ! variables @code{c-font-lock-extra-types}, ! @code{c++-font-lock-extra-types}, @code{objc-font-lock-extra-types} ! and @code{java-font-lock-extra-types}, for example. ! @end defun ! ! The function @code{font-lock-remove-keywords} can be used to remove ! keywords to highlight from what you have specified with ! @code{font-lock-add-keywords}. ! ! @defun font-lock-remove-keywords mode keywords ! This function removes highlighting @var{keywords} for @var{mode}. ! Like with @code{font-lock-add-keywords}, @var{mode} should be a major ! mode command name or @code{nil}. If @code{nil}, the highlighting ! @var{keywords} are removed for the current buffer. ! @end defun ! ! @strong{Warning:} When you use @code{font-lock-add-keywords} or ! @code{font-lock-remove-keywords} from an elisp package (such as a ! minor mode), we recommended that you use @code{nil} for @var{mode} ! (and place the call in a loop or on a hook) to avoid subtle problems ! due to the details of the implementation. ! ! @node Other Font Lock Variables ! @subsection Other Font Lock Variables ! ! This section describes additional variables that a major mode can ! set by means of @var{other-vars} in @code{font-lock-defaults} ! (@pxref{Font Lock Basics}). @defvar font-lock-mark-block-function If this variable is non-@code{nil}, it should be a function that is *************** *** 2378,2402 **** @end defvar @defvar font-lock-extra-managed-props ! Additional properties (other than @code{font-lock-face}) that are ! being managed by Font Lock mode. Font Lock mode normally manages only ! the @code{font-lock-face} property; if you want it to manage others as ! well, you must specify them in a @var{facespec} in @code{font-lock-keywords} as well as adding them to this list. @end defvar ! @defvar font-lock-syntactic-face-function ! A function to determine which face to use for a given syntactic ! element (a string or a comment). The function is called with one ! argument, the parse state at point returned by ! @code{parse-partial-sexp}, and should return a face. The default ! value returns @code{font-lock-comment-face} for comments and ! @code{font-lock-string-face} for strings. ! This can be used to highlighting different kinds of strings or ! comments differently. It is also sometimes abused together with ! @code{font-lock-syntactic-keywords} to highlight elements that span ! multiple lines, but this is too obscure to document in this manual. @end defvar @defvar font-lock-lines-before --- 2408,2445 ---- @end defvar @defvar font-lock-extra-managed-props ! This variable is used by @code{font-lock-default-unfontify-region}. ! It specifies additional properties (other than @code{font-lock-face}) ! that are being managed by Font Lock mode. Font Lock mode normally ! manages only the @code{font-lock-face} property; if you want it to ! manage others as well, you must specify them in a @var{facespec} in @code{font-lock-keywords} as well as adding them to this list. + @xref{Search-based Fontification}. @end defvar ! @defvar font-lock-fontify-buffer-function ! Function to use for fontifying the buffer. The default value of this ! variable is @code{font-lock-default-fontify-buffer}. ! @end defvar ! @defvar font-lock-unfontify-buffer-function ! Function to use for unfontifying the buffer. This is used when ! turning off Font Lock mode. The default value of this variable is ! @code{font-lock-default-unfontify-buffer}. ! @end defvar ! ! @defvar font-lock-fontify-region-function ! Function to use for fontifying a region. It should take two ! arguments, the beginning and end of the region, and an optional third ! argument @var{verbose}. If this argument is non-@code{nil}, the ! function should print status messages. The default value of this ! variable is @code{font-lock-default-fontify-region}. ! @end defvar ! ! @defvar font-lock-unfontify-region-function ! Function to use for unfontifying a region. It should take two ! arguments, the beginning and end of the region. The default value of ! this variable is @code{font-lock-default-unfontify-region}. @end defvar @defvar font-lock-lines-before *************** *** 2407,2412 **** --- 2450,2461 ---- multi-line patterns. @end defvar + @defvar font-lock-inhibit-thing-lock + List of Font Lock mode related modes that should not be turned on. + Currently, valid mode names are @code{fast-lock-mode}, + @code{jit-lock-mode} and @code{lazy-lock-mode}. + @end defvar + @node Levels of Font Lock @subsection Levels of Font Lock *************** *** 2450,2455 **** --- 2499,2505 ---- which construct their text programmatically, such as @code{list-buffers} and @code{occur}. + @vindex font-lock-core-only If your mode does not use any of the other machinery of Font Lock (i.e. it only uses the @code{font-lock-face} property), you can tell Emacs not to load all of font-lock.el (unless it's already loaded), by *************** *** 2458,2465 **** way to do this: @example ! (set (make-local-variable 'font-lock-defaults) ! '(nil t nil nil nil (font-lock-core-only . t))) @end example @node Faces for Font Lock --- 2508,2515 ---- way to do this: @example ! (setq font-lock-defaults ! '(nil t nil nil nil (font-lock-core-only . t))) @end example @node Faces for Font Lock *************** *** 2529,2542 **** @node Syntactic Font Lock @subsection Syntactic Font Lock Font Lock mode can be used to update @code{syntax-table} properties ! automatically. This is useful in languages for which a single syntax ! table by itself is not sufficient. @defvar font-lock-syntactic-keywords ! This variable enables and controls syntactic Font Lock. It is ! normally set via @code{font-lock-defaults}. Its value should be a ! list of elements of this form: @example (@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch}) --- 2579,2650 ---- @node Syntactic Font Lock @subsection Syntactic Font Lock + Syntactic fontification uses the syntax table to find comments and + string constants (@pxref{Syntax Tables}). It highlights them using + @code{font-lock-comment-face} and @code{font-lock-string-face} + (@pxref{Faces for Font Lock}). There are several variables that + affect syntactic fontification; they can be set by means of + @code{font-lock-defaults} (@pxref{Font Lock Basics}). + + @defvar font-lock-keywords-only + Non-@code{nil} means Font Lock should not do syntactic fontification; + it should only fontify based on @code{font-lock-keywords}. The value + of this variable can be specified with @var{keywords-only} in + @code{font-lock-defaults}. + @end defvar + + @defvar font-lock-syntax-table + This variable specifies the syntax table to use for fontification of + comments and strings. The value of this variable can be specified + with @var{syntax-alist} in @code{font-lock-defaults}. + @end defvar + + @c The docstring says that font-lock-syntax-table is semi-obsolete. + @c How the alternative should be used is not clear. --lute + + @defvar font-lock-beginning-of-syntax-function + If this variable is non-@code{nil}, it should be a function to move + point back to a position that is syntactically at ``top level'' and + outside of strings or comments. Font Lock uses this when necessary + to get the right results for syntactic fontification. + + This function is called with no arguments. It should leave point at the + beginning of any enclosing syntactic block. Typical values are + @code{beginning-of-line} (i.e., the start of the line is known to be + outside a syntactic block), or @code{beginning-of-defun} for programming + modes or @code{backward-paragraph} for textual modes (i.e., the + mode-dependent function is known to move outside a syntactic block). + + If the value is @code{nil}, the beginning of the buffer is used as a + position outside of a syntactic block. This cannot be wrong, but it can + be slow. + + The value of this variable can be specified with @var{syntax-begin} in + @code{font-lock-defaults}. + @end defvar + + @defvar font-lock-syntactic-face-function + A function to determine which face to use for a given syntactic + element (a string or a comment). The function is called with one + argument, the parse state at point returned by + @code{parse-partial-sexp}, and should return a face. The default + value returns @code{font-lock-comment-face} for comments and + @code{font-lock-string-face} for strings. + + This can be used to highlighting different kinds of strings or + comments differently. It is also sometimes abused together with + @code{font-lock-syntactic-keywords} to highlight elements that span + multiple lines, but this is too obscure to document in this manual. + @end defvar + Font Lock mode can be used to update @code{syntax-table} properties ! automatically (@pxref{Syntax Properties}). This is useful in ! languages for which a single syntax table by itself is not sufficient. @defvar font-lock-syntactic-keywords ! This variable enables and controls updating @code{syntax-table} ! properties by Font Lock. Its value should be a list of elements of ! this form: @example (@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch}) *************** *** 2546,2555 **** sort of element of @code{font-lock-keywords}, @example ! (@var{matcher} @var{subexp} @var{facename} @var{override} @var{laxmatch}) @end example ! However, instead of specifying the value @var{facename} to use for the @code{face} property, it specifies the value @var{syntax} to use for the @code{syntax-table} property. Here, @var{syntax} can be a string (as taken by @code{modify-syntax-entry}), a syntax table, a cons cell --- 2654,2663 ---- sort of element of @code{font-lock-keywords}, @example ! (@var{matcher} @var{subexp} @var{facespec} @var{override} @var{laxmatch}) @end example ! However, instead of specifying the value @var{facespec} to use for the @code{face} property, it specifies the value @var{syntax} to use for the @code{syntax-table} property. Here, @var{syntax} can be a string (as taken by @code{modify-syntax-entry}), a syntax table, a cons cell *************** *** 2585,2591 **** the form @samp{'@var{c}'} as strings syntactically. Other forms, such as @samp{foo'bar} or @samp{'fubar'}, will not be highlighted as strings. - @end defvar @node Desktop Save Mode --- 2693,2698 ---- Index: lispref/hooks.texi =================================================================== RCS file: /cvsroot/emacs/emacs/lispref/hooks.texi,v retrieving revision 1.19 diff -c -r1.19 hooks.texi *** lispref/hooks.texi 3 Apr 2005 13:53:56 -0000 1.19 --- lispref/hooks.texi 22 Apr 2005 13:18:55 -0000 *************** *** 147,152 **** --- 147,173 ---- @item first-change-hook @xref{Change Hooks}. + @item font-lock-beginning-of-syntax-function + @xref{Other Font Lock Variables}. + + @item font-lock-fontify-buffer-function + @xref{Other Font Lock Variables}. + + @item font-lock-fontify-region-function + @xref{Other Font Lock Variables}. + + @item font-lock-mark-block-function + @xref{Other Font Lock Variables}. + + @item font-lock-syntactic-face-function + @xref{Other Font Lock Variables}. + + @item font-lock-unfontify-buffer-function + @xref{Other Font Lock Variables}. + + @item font-lock-unfontify-region-function + @xref{Other Font Lock Variables}. + @item initial-calendar-window-hook @inforef{Calendar Customizing,, emacs-xtra}. Index: lisp/font-core.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/font-core.el,v retrieving revision 1.26 diff -c -r1.26 font-core.el *** lisp/font-core.el 4 Apr 2005 08:56:36 -0000 1.26 --- lisp/font-core.el 22 Apr 2005 13:18:55 -0000 *************** *** 32,38 **** "Defaults for Font Lock mode specified by the major mode. Defaults should be of the form: ! (KEYWORDS KEYWORDS-ONLY CASE-FOLD SYNTAX-ALIST SYNTAX-BEGIN ...) KEYWORDS may be a symbol (a variable or function whose value is the keywords to use for fontification) or a list of symbols. If KEYWORDS-ONLY is non-nil, --- 32,38 ---- "Defaults for Font Lock mode specified by the major mode. Defaults should be of the form: ! (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST [SYNTAX-BEGIN ...]]]]) KEYWORDS may be a symbol (a variable or function whose value is the keywords to use for fontification) or a list of symbols. If KEYWORDS-ONLY is non-nil, *************** *** 66,76 **** around a text block relevant to that mode). Other variables include that for syntactic keyword fontification, ! `font-lock-syntactic-keywords' ! and those for buffer-specialized fontification functions, ! `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', ! `font-lock-fontify-region-function', `font-lock-unfontify-region-function', ! `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") (make-variable-buffer-local 'font-lock-defaults) (defvar font-lock-defaults-alist nil --- 66,75 ---- around a text block relevant to that mode). Other variables include that for syntactic keyword fontification, ! `font-lock-syntactic-keywords' and those for buffer-specialized fontification ! functions, `font-lock-fontify-buffer-function', ! `font-lock-unfontify-buffer-function', `font-lock-fontify-region-function', ! `font-lock-unfontify-region-function', and `font-lock-inhibit-thing-lock'.") (make-variable-buffer-local 'font-lock-defaults) (defvar font-lock-defaults-alist nil Index: lisp/font-lock.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/font-lock.el,v retrieving revision 1.238 diff -c -r1.238 font-lock.el *** lisp/font-lock.el 8 Apr 2005 14:26:13 -0000 1.238 --- lisp/font-lock.el 22 Apr 2005 13:18:58 -0000 *************** *** 493,499 **** "Function to determine which face to use when fontifying syntactically. The function is called with a single parameter (the state as returned by `parse-partial-sexp' at the beginning of the region to highlight) and ! should return a face.") (defvar font-lock-syntactic-keywords nil "A list of the syntactic keywords to highlight. --- 493,499 ---- "Function to determine which face to use when fontifying syntactically. The function is called with a single parameter (the state as returned by `parse-partial-sexp' at the beginning of the region to highlight) and ! should return a face. This is normally set via `font-lock-defaults'.") (defvar font-lock-syntactic-keywords nil "A list of the syntactic keywords to highlight. *************** *** 643,648 **** --- 643,649 ---- ;;;###autoload (defun font-lock-add-keywords (mode keywords &optional append) "Add highlighting KEYWORDS for MODE. + MODE should be a symbol, the major mode command name, such as `c-mode' or nil. If nil, highlighting keywords are added for the current buffer. KEYWORDS should be a list; see the variable `font-lock-keywords'.