From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: Multiline font lock questions Date: 17 Nov 2006 12:15:54 -0800 Organization: http://groups.google.com Message-ID: <1163794554.336332.297920@k70g2000cwa.googlegroups.com> References: <1163782948.761971.258500@h48g2000cwc.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1163796035 6197 80.91.229.2 (17 Nov 2006 20:40:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Nov 2006 20:40:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 17 21:40:30 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GlAVe-0000cw-Vv for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Nov 2006 21:40:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GlAVe-0004EY-FD for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Nov 2006 15:40:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!k70g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 52 Original-NNTP-Posting-Host: 168.208.215.220 Original-X-Trace: posting.google.com 1163794560 29836 127.0.0.1 (17 Nov 2006 20:16:00 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 17 Nov 2006 20:16:00 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k70g2000cwa.googlegroups.com; posting-host=168.208.215.220; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:143164 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: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38783 Archived-At: David Abrahams wrote: > "rgb" writes: > > >> * Place a `font-lock-multiline' property on the construct when it is > >> added to the buffer. > >> > >> I don't understand how that can help. If I start with > >> > >> +------------+ > >> |This [is | > >> |paragraph 1 | > >> | | > >> |This is | > >> |paragraph] 2| > >> +------------+ > >> > >> then presumably nothing is marked with the `font-lock-multiline' > >> property, because there are no multiline constructs. If I then kill > >> the blank line, how is it going to know to start identification at the > >> beginning of the newly-formed paragraph? > > > > Look at the SYNTAX-BEGIN argument of font-lock-defaults. > > IIUC that is only for `syntactic fontification,' which apparently > refers just to fontifying comments and strings. Did I misinterpret > the doc? AFAIK font-lock does ALL fontification (outside of any you do yourself of course). Not just comments and strings. Moreover it takes several passes across the text to accomplish fontification. font-lock-syntactic-keywords allows you to pick and choose which characters have begin string fence syntax, comment end syntax etc. before a pass marks strings and comments. Only then can keywords be fontified so as to avoid words in comments or strings. So it depends on how you plan to apply font-lock-multiline. If it were me, I'd be using the fontification routines to apply the font-lock-multiline property to the text. But to do that I would need to insure that, as in your example, when something like a blank line is deleted, fontification starts at the beginning of the paragraph; which now is 2 lines prior to the deleted line. I believe syntax-begin defaults to beginning-of-line. So by default the multi-line construct would not get recognized. I've never actually had to change syntax-begin for my own modes but I've written font-lock support for some fairly unusual syntax. Leading me to diluded myself into thinking I know how it works.