help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: help with font-lock-multiline


From: Katsumi Yamaoka
Subject: Re: help with font-lock-multiline
Date: Tue, 28 Sep 2004 11:12:11 +0900
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

>>>>> In <mailman.4324.1096326611.1998.help-gnu-emacs@gnu.org>
>>>>>   Raul Acevedo wrote:

> I'm doing JSP development, and I want something very simple.  I want to
> fontify the text between <% and %> tags, even if spread across multiple
> lines.

You will need to use a function which searches for a range
larger than the range which font-lock usually searches for,
instead of a regexp.  I tried it in the *scratch* buffer using
the following configuration:

(defun find-brackets (limit)
  (or (re-search-forward "<%[^>]*%>" nil t)
      (let ((start (point)))
        (if (and (search-backward "<%" nil t)
                 (search-forward "%>" nil t))
            (goto-char limit)
          (goto-char start)
          nil))))

(setq font-lock-keywords (append font-lock-keywords
                                 '((find-brackets (0 'underline t))))
      font-lock-multiline t)

reply via email to

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