all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Multiline font-lock
@ 2009-01-14 23:15 Jose A. Ortega Ruiz
  2009-01-15  2:47 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Jose A. Ortega Ruiz @ 2009-01-14 23:15 UTC (permalink / raw
  To: emacs-devel


Hi,

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?

Thanks!
jao





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Multiline font-lock
  2009-01-14 23:15 Multiline font-lock Jose A. Ortega Ruiz
@ 2009-01-15  2:47 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-01-15  2:47 UTC (permalink / raw
  To: Jose A. Ortega Ruiz; +Cc: emacs-devel

> 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-15  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 23:15 Multiline font-lock Jose A. Ortega Ruiz
2009-01-15  2:47 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.