From: David Koppelman <koppel@ece.lsu.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Chong Yidong <cyd@stupidchicken.com>,
192@emacsbugs.donarmstrong.com, Bruno Haible <bruno@clisp.org>,
emacs-devel@gnu.org
Subject: bug#192: regexp does not work as documented
Date: Mon, 12 May 2008 10:03:52 -0500 [thread overview]
Message-ID: <yg5d4nra7jb.fsf__12691.6426503614$1210622399$gmane$org@nested.ece.lsu.edu> (raw)
In-Reply-To: <jwvr6c8pbd6.fsf-monnier+emacsbugreports@gnu.org> (Stefan Monnier's message of "Sun, 11 May 2008 21:28:18 -0400")
> I guess I simply do not understand what you propose. Any improvement in
> the multiline handling is welcome, but beware: this is not an easy area.
I'm proposing that font-lock divide keywords into two or three
classes, ordinary, multi-line, and maybe mega-line, matches for
multi-line and mega-line keywords would be over much larger
regions. Here is how it might work with two classes (keep in mind that
I don't yet have a thorough understanding of font-lock and jit-lock):
Multi-line keywords are explicitly identified as such, perhaps
through keyword syntax or the way they are given to font-lock (say,
using font-lock-multiline-keywords). Explicit identification avoids
performance problems from keywords that, though technically
multi-line, rarely span more than a few lines.
Functions such as font-lock-default-fontify-region would find two
sets of extended regions, ordinary and multi, running functions on
two hooks for this purpose. The multi-line hook might extend the
region based on the size of the largest supported match rather than
using the multline property. The multiline property might still be
useful for non-deferred handling of existing matches.
Functions such as font-lock-fontify-keywords-region would be passed
both extended regions and use the region appropriate for each
keyword they process. The large region is only used on the few
multi-line patterns that need it.
Here I'm assuming that a mode might have hundreds of single-line (or
two-line) keywords and only a few multi-line keywords, and the
multi-line keywords might span no more than hundreds of lines. We
could guarantee that matches for such patterns are perfect (using a
line-count-limit variable).
If there were a third class, mega-line, it would have its own text
property and region-extension hook.
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> A better solution would be to have font-lock use multi-line extended
>> regions selectively. Perhaps a hint in the current keyword syntax
>> (say, explicitly applying the font-lock-multiline property), or a
>> separate method for providing multi-line keywords to font-lock.
>
> I don't understand the difference between the above and the application
> of font-lock-multiline properties which you seem to have tried and rejected.
>
> I don't necessarily disagree with your rejection of font-lock-multiline:
> it can have disastrous effect indeed if the multiline region becomes large.
>
>> Such keywords would get the multi-line extended regions, the other
>> just the whole-line extensions (or whatever the hooks do).
>> Is this something the font-lock maintainers would consider?
>
> I guess I simply do not understand what you propose. Any improvement in
> the multiline handling is welcome, but beware: this is not an easy area.
>
next prev parent reply other threads:[~2008-05-12 15:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87k5i8ukq8.fsf@stupidchicken.com>
[not found] ` <200805061335.11379.bruno@clisp.org>
[not found] ` <48204B3D.6000500@gmx.at>
2008-05-10 19:18 ` bug#192: regexp does not work as documented David Koppelman
[not found] ` <yg5skwqc6ho.fsf@nested.ece.lsu.edu>
2008-05-10 20:13 ` David Koppelman
[not found] ` <yg5bq3ddij2.fsf@nested.ece.lsu.edu>
2008-05-11 7:40 ` martin rudalics
[not found] ` <4826A303.3030002@gmx.at>
2008-05-11 14:27 ` Chong Yidong
[not found] ` <87abiwoqzd.fsf@stupidchicken.com>
2008-05-11 15:36 ` David Koppelman
[not found] ` <yg57ie0df8u.fsf@nested.ece.lsu.edu>
2008-05-11 18:44 ` Stefan Monnier
[not found] ` <jwv4p94r8vp.fsf-monnier+emacsbugreports@gnu.org>
2008-05-11 19:09 ` David Koppelman
[not found] ` <yg5tzh4bqtw.fsf@nested.ece.lsu.edu>
2008-05-12 1:28 ` Stefan Monnier
[not found] ` <jwvr6c8pbd6.fsf-monnier+emacsbugreports@gnu.org>
2008-05-12 15:03 ` David Koppelman [this message]
[not found] ` <yg5d4nra7jb.fsf@nested.ece.lsu.edu>
2008-05-12 16:29 ` Stefan Monnier
[not found] ` <jwvzlqvmr6g.fsf-monnier+emacsbugreports@gnu.org>
2008-05-12 17:04 ` David Koppelman
2008-05-11 18:44 ` Stefan Monnier
[not found] ` <jwv8wygrbss.fsf-monnier+emacsbugreports@gnu.org>
2008-05-11 20:03 ` Thomas Lord
[not found] ` <482750F4.2050102@emf.net>
2008-05-12 1:43 ` Stefan Monnier
[not found] ` <jwvlk2gpas3.fsf-monnier+emacsbugreports@gnu.org>
2008-05-12 3:30 ` Thomas Lord
[not found] ` <4827B9B8.30406@emf.net>
2008-05-12 13:43 ` Stefan Monnier
[not found] ` <jwvfxsnpryp.fsf-monnier+emacsbugreports@gnu.org>
2008-05-12 15:55 ` Thomas Lord
[not found] ` <48286862.6040105@emf.net>
2008-05-12 16:18 ` tomas
[not found] ` <jwvfxsvbgg5.fsf-monnier+emacs@gnu.org>
2008-05-10 20:04 ` Bruno Haible
2008-05-06 1:30 Bruno Haible
2015-12-29 17:48 ` bug#192: " Bruno Haible
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='yg5d4nra7jb.fsf__12691.6426503614$1210622399$gmane$org@nested.ece.lsu.edu' \
--to=koppel@ece.lsu.edu \
--cc=192@emacsbugs.donarmstrong.com \
--cc=bruno@clisp.org \
--cc=cyd@stupidchicken.com \
--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).