From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@gmx.net (=?iso-8859-1?q?Kai_Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Doc extension: document font-lock patterns for font-lock-add-keywords Date: Fri, 27 Jun 2003 22:09:53 +0200 Organization: University of Duisburg, Germany Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <84r85fqo32.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1056745312 24614 80.91.224.249 (27 Jun 2003 20:21:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 27 Jun 2003 20:21:52 +0000 (UTC) Cc: Mayer Goldberg Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Jun 27 22:21:47 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19VziN-0006Kr-00 for ; Fri, 27 Jun 2003 22:20:59 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19VznX-0003uE-00 for ; Fri, 27 Jun 2003 22:26:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Vzby-0002up-LM for emacs-devel@quimby.gnus.org; Fri, 27 Jun 2003 16:14:22 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19VzZV-0000u8-Pm for emacs-devel@gnu.org; Fri, 27 Jun 2003 16:11:49 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19VzZ0-0000IR-L6 for emacs-devel@gnu.org; Fri, 27 Jun 2003 16:11:19 -0400 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19VzYn-0008WH-Pe for emacs-devel@gnu.org; Fri, 27 Jun 2003 16:11:05 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19VzYR-0005VL-00 for ; Fri, 27 Jun 2003 22:10:43 +0200 Mail-Followup-To: emacs-devel@gnu.org X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19VzXx-0005Ss-00 for ; Fri, 27 Jun 2003 22:10:13 +0200 Original-Lines: 67 Original-X-Complaints-To: usenet@main.gmane.org Mail-Copies-To: never User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:L91912c4Zar3u7FXCIkZH87ybk4= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15305 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15305 Mayer Goldberg pointed out to me that the Emacs info file does not explain the syntax of the patterns arg for font-lock-add-keywords. I tried to describe the most common usage (leaving all the gory details to the lispref) and have concocted the following patch. It also xrefs the relevant documentation. OK to install? Kai (not quite sure how to proceed with doc fixes) cvs server: Diffing man Index: man/ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/man/ChangeLog,v retrieving revision 1.186 diff -u -r1.186 ChangeLog --- man/ChangeLog 17 Jun 2003 14:05:19 -0000 1.186 +++ man/ChangeLog 27 Jun 2003 20:06:31 -0000 @@ -1,3 +1,8 @@ +2003-06-27 Kai Gro,A_(Bjohann + + * display.texi (Font Lock): Explain highlighting patterns for + font-lock. + 2003-06-17 Kai Gro,A_(Bjohann Version 2.0.35 of Tramp released. Index: man/display.texi =================================================================== RCS file: /cvsroot/emacs/emacs/man/display.texi,v retrieving revision 1.68 diff -u -r1.68 display.texi --- man/display.texi 4 Feb 2003 14:53:27 -0000 1.68 +++ man/display.texi 27 Jun 2003 20:06:34 -0000 @@ -317,6 +317,28 @@ To remove keywords from the font-lock highlighting patterns, use the function @code{font-lock-remove-keywords}. +@cindex font-lock highlighting pattern + Normally, the highlighting patterns will have the structure +@code{(@var{regexp} @var{match} @var{face} @var{override})}. Here, +@var{regexp} gives the regular expression to match. It might use +subexpressions (@code{\\(...\\)}); @var{match} specifies which of the +subexpressions are to be highlighted. Zero means to highlight the match +of the whole regular expression, positive numbers specify the pair of +parentheses to highlight. (The open parentheses are counted left to +right to give the number.) @var{face} specifies the face to use; type +@kbd{M-x list-faces-display @key{RET}} for a list of available faces. +Finally, @var{override} equals t means to override any previously +specified fontification; `keep' means to +highlight only unfontified parts; `prepend' means to merge with +existing fontification where the new fontification takes precedence; +and finally, `append' means to merge with existing fontififcation where +the existing fontification takes precedence. + + Complete documentation on the patterns can be found in the +documentation for the variable @code{font-lock-keywords}, and also in +the Emacs Lisp Reference Manual, @xref{Search-based +Fontification,,elisp}. + @cindex just-in-time (JIT) font-lock @cindex background syntax highlighting Fontifying large buffers can take a long time. To avoid large -- ~/.signature