From: Michael Heerdegen <michael_heerdegen@web.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs Development <emacs-devel@gnu.org>
Subject: Re: Limits of multiline font-lock
Date: Mon, 16 Sep 2019 01:13:52 +0200 [thread overview]
Message-ID: <87sgoxjgpb.fsf@web.de> (raw)
In-Reply-To: <jwvv9ttdaax.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 15 Sep 2019 08:28:21 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 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.
Must be an emacs-lisp buffer, of course.
> - 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?
Matches are always limited by bounds of the current top-level
expression. A complete re-search from the beg-of-defun of window-start
up to window-end after a change is sufficient and doable in acceptable
time (in your concrete scenario, I could even restrict the search to all
parent sexps the edited text is in - most of the time these will no ever
be more than 20 or so...these can be tested very quickly).
I already have a prototype (not based on font-lock), and it starts
refontification only after a (tiny) idle time, and the search function
is interruptable (via throw-on-input). When interrupted, the old
visible state is restored.
This works quite nicely and feels quite natural unless the search
pattern is very costly (then I currently emit a warning - the pattern
could also remove itself from the list or turn the minor mode off).
The tricky rest is now stuff that font-lock already does well. My
current implementation has problems with cases like when different
(maybe overlapping) parts of a buffer are visible in different windows,
there is a certain risk of infinite retriggering of hi-locking etc.
Thanks,
Michael.
next prev parent reply other threads:[~2019-09-15 23:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-14 17:07 Limits of multiline font-lock Michael Heerdegen
2019-09-15 12:28 ` Stefan Monnier
2019-09-15 23:13 ` Michael Heerdegen [this message]
2019-09-16 19:00 ` Stefan Monnier
2019-09-18 3:23 ` Michael Heerdegen
2019-09-18 21:13 ` Adam Porter
2019-09-19 2:05 ` Michael Heerdegen
2019-09-19 2:36 ` Adam Porter
2023-10-07 7:30 ` Adam Porter
2023-10-14 4:06 ` Michael Heerdegen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgoxjgpb.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).