all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Jose A. Ortega Ruiz" <jao@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Multiline font-lock
Date: Wed, 14 Jan 2009 21:47:29 -0500	[thread overview]
Message-ID: <jwv3aflz3vu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87fxjlwkbv.fsf@mithrandir.homeunix.net> (Jose A. Ortega Ruiz's message of "Thu, 15 Jan 2009 00:15:32 +0100")

> 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	other threads:[~2009-01-15  2:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 23:15 Multiline font-lock Jose A. Ortega Ruiz
2009-01-15  2:47 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv3aflz3vu.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=jao@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.