From: immerrr again <immerrr+lua@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Bug in font-lock-syntactic-keywords handling?
Date: Mon, 6 Oct 2014 18:21:35 +0400 [thread overview]
Message-ID: <CAERznn-QPwbGB93Km62H2V4-7_63tPPD_X5j5fNNZ5vM-LjXsw@mail.gmail.com> (raw)
In-Reply-To: <jwvppe5ny15.fsf-monnier+emacs@gnu.org>
On Mon, Oct 6, 2014 at 5:14 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> That seems like a performance bug (it re-fontifies something that's
> already been fontified), indeed, but I don't see why that would cause
> something to "fail".
>
> If it really causes a failure, I suspect that the failure is really
> caused by an underlying bug in the specific syntactic-keywords rules,
> which merely gets triggered by this performance bug.
>
>
> Stefan
The problem is that it doesn't unfontify the already processed chunk beforehand.
It this particular situation, when I encounter a "--[[" comment
starter I need to be sure that there are no dashes before
("---[[...\n" is a single-line comment by design) and that this
starter is not inside another comment. I did this the "smart" way: I
checked (elt ppss 4) of the *second* dash, so that when there's
something like "--X-[[" with X being the point, the point is already
inside a single-line comment. That single check covers both cases,
yet, as most "smart" things do, it breaks unexpectedly.
This one breaks when "--[[" is already propertized as a comment opener
and the second dash is already a part of that comment. This causes
comment-open matcher to fail and simple two-step propertize function
[1],
(lambda (limit) (or (try-close-comment limit) (try-open-comment limit)))
doesn't work, since there is no comment to be closed at the beginning
of the chunk, the opener is already propertized and thus skipped and
the closer is never invoked again.
Cheers,
immerrr
1. This lambda is a simplified version of
https://github.com/immerrr/lua-mode/blob/master/lua-mode.el#L868-L872
next prev parent reply other threads:[~2014-10-06 14:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 11:42 Bug in font-lock-syntactic-keywords handling? immerrr again
2014-10-06 13:14 ` Stefan Monnier
2014-10-06 14:21 ` immerrr again [this message]
2014-10-06 16:28 ` Stefan Monnier
2014-10-06 23:27 ` immerrr again
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=CAERznn-QPwbGB93Km62H2V4-7_63tPPD_X5j5fNNZ5vM-LjXsw@mail.gmail.com \
--to=immerrr+lua@gmail.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 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.