emacs-devel
[Top][All Lists]
Advanced

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

Re: Limits of multiline font-lock


From: Stefan Monnier
Subject: Re: Limits of multiline font-lock
Date: Sun, 15 Sep 2019 08:28:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> I want to provide a hi-lock like feature for el-search patterns: an on
> the fly highlighting of any expressions matching a certain el-search
> pattern.  Elisp expressions can be multiline, of course.  After reading what
> the manual says about multiline font lock I'm not sure if I can use
> font-lock for that.

I think before deciding which tools to use, I think you need to figure
out how you want to solve the fundamental difficulty:

- we're inside an arbitrary buffer with your new el-search-hi-lock
  functionality enabled for a particular pattern.
- let's assume for now that currently there's no match anywhere.
- then the user makes an edit at line N which makes the pattern match
  on lines M to M' (M < N and M' > N).

How do you plan on finding this match?

- You can scan the whole buffer from point-min, but that might be too
  costly (tho maybe it's OK if you do it from an idle timer).
- Or you can add limits like "we'll only look for it between N-5 and
  N+5" and we don't care if we don't notice new "hard to find" matches.
- Or you can rely on the earlier scans having noted that the text between M and 
N
  matches the beginning of the pattern and hence only need to check whether,
  after the edit, the new text starting at N matches "the rest of the
  pattern".
- ...


        Stefan




reply via email to

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