From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joakim Hove Newsgroups: gmane.emacs.help Subject: Re: Fontification with a specific function Date: Fri, 15 Oct 2004 12:27:16 +0200 Organization: University of Bergen Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1097836082 30142 80.91.229.6 (15 Oct 2004 10:28:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Oct 2004 10:28:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 15 12:27:54 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CIPJS-0000Wk-00 for ; Fri, 15 Oct 2004 12:27:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CIPQa-0001XG-Ud for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Oct 2004 06:35:17 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tdcnorge.no!uninett.no!nntp.uib.no!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: termo1.fi.uib.no Original-X-Trace: toralf.uib.no 1097836038 80234 129.177.39.206 (15 Oct 2004 10:27:18 GMT) Original-X-Complaints-To: abuse@uib.no Original-NNTP-Posting-Date: 15 Oct 2004 10:27:18 GMT User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:GKQSO+l/uD9lSmhj5yloosqFtrE= Original-Xref: shelby.stanford.edu gnu.emacs.help:125886 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21256 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21256 joao17@mailinator.com (joao) writes: > I don't see where this "match data" is defined. Can anyone point me to > an example, in the emacs sources or in some package, of this usage of > fontification ? The match data is some global emacs variable/stack of the last regexp search results. Let us say you you wanted to fontify the word 'horse' then function could be like this: (defun find-horse (p-max) ;; OK the regexp is probably far to simple, but it finds ;; "horse". Maybe the optional fourth argument COUNT should be ;; set?? (if (re-search-forward " \\(horse\\) " p-max t) t nil)) This function will return t or nil depending on wether the string horse was found, and if it was found. The match (i.e. horse), and other information about the match can be found from the functions match-string, match-beginning , match-data etc, and I guess that is what the internals of the font-lock code does. Hence, the match data is automatically set by the (re-search-forward ) function, you don't have to do that. Good luck Joakim -- Joakim Hove hove AT ift uib no +47 (55 5)8 27 90 http://www.ift.uib.no/~hove/