[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiline font lock questions

From: rgb
Subject: Re: Multiline font lock questions
Date: 17 Nov 2006 12:15:54 -0800
User-agent: G2/1.0

David Abrahams wrote:
> "rgb" <address@hidden> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]