emacs-devel
[Top][All Lists]
Advanced

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

Re: Multiline font-lock


From: Stefan Monnier
Subject: Re: Multiline font-lock
Date: Wed, 14 Jan 2009 21:47:29 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> I need multiline font lock in a major mode that i'm writing. I read in
> the elisp manual (and have actually checked it) that using regexps
> matching multiple lines in font-lock-keywords is a bad idea.
> I've also read the node dedicated to multiline font-lock in the
> manual, but it's not clear to me how it works.  Could you please point
> me to an example of that mechanism being used?

As explained in the manual, there are different mechanisms available,
and which one to use depends on the particular situation.

You can either use syntax-tables to turn your multiline thingy into
a pseudo-comment or pseudo-string (and then use
font-lock-syntactic-face-function to highlight it in a different way).

Or you can use the font-lock-multiline text-property (not to be confused
with the variable) on the multiline elements once you've found them.

Or you can use font-lock-extend-region-functions and use your own ad-hoc
code to make sure that your regexps always get to look at complete
multiline elements.


        Stefan




reply via email to

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