From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Abrahams Newsgroups: gmane.emacs.help Subject: Re: Multiline font lock questions Date: Fri, 17 Nov 2006 17:44:07 -0500 Message-ID: <87u00xd77s.fsf@pereiro.luannocracy.com> References: <1163782948.761971.258500@h48g2000cwc.googlegroups.com> <1163794554.336332.297920@k70g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1163803514 29169 80.91.229.2 (17 Nov 2006 22:45:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Nov 2006 22:45:14 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 17 23:45:11 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 1GlCSK-0007sH-Sf for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Nov 2006 23:45:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GlCSK-000842-9d for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Nov 2006 17:45:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GlCS2-00081D-Q9 for help-gnu-emacs@gnu.org; Fri, 17 Nov 2006 17:44:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GlCRz-0007xw-F7 for help-gnu-emacs@gnu.org; Fri, 17 Nov 2006 17:44:48 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GlCRy-0007xf-WF for help-gnu-emacs@gnu.org; Fri, 17 Nov 2006 17:44:47 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GlCRy-0002y3-IN for help-gnu-emacs@gnu.org; Fri, 17 Nov 2006 17:44:46 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GlCRn-0007l7-F0 for help-gnu-emacs@gnu.org; Fri, 17 Nov 2006 23:44:35 +0100 Original-Received: from 216-15-125-177.c3-0.smr-ubr3.sbo-smr.ma.cable.rcn.com ([216.15.125.177]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Nov 2006 23:44:35 +0100 Original-Received: from dave by 216-15-125-177.c3-0.smr-ubr3.sbo-smr.ma.cable.rcn.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Nov 2006 23:44:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 97 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 216-15-125-177.c3-0.smr-ubr3.sbo-smr.ma.cable.rcn.com User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.0 (gnu/linux) Cancel-Lock: sha1:gwGA/ARwePBaafXJ13H62d5jKdI= 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:38785 Archived-At: "rgb" writes: > 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 I know that. > (outside of any you do yourself of course). "Do yourself?" That might be just what I need, actually. How do I do that? > 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. Right. However, the docs for font-lock-defaults say: If SYNTAX-BEGIN is non-nil, it should be a function with no args used to move backwards outside any enclosing syntactic block, for syntactic fontification. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Maybe "syntactic fontification" means something different from the "just comments and strings" meaning of "syntactic"...? Typical values are `beginning-of-line' (i.e., the start of the line is known to be outside a syntactic block), or `beginning-of-defun' for programming modes or `backward-paragraph' for textual modes (i.e., the mode-dependent function is known to move outside a syntactic block). If nil, the beginning of the buffer is used as a position outside of a syntactic block, in the worst case. > So it depends on how you plan to apply font-lock-multiline. > If it were me, I'd be using the fontification routines Sorry, which are those? > 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. In my case, it's already nil, which according to the above should mean that it goes all the way back to the beginning of the buffer ("in the worst case," whatever that means) so it doesn't seem like this is the right lever to pull. > 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. Well, I am really stumped. I am also, it seems, getting some combinatoric regexp evaluation. Whoopee! -- Dave Abrahams Boost Consulting www.boost-consulting.com