From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 36136@debbugs.gnu.org
Subject: bug#36136: [PATCH]: Re: bug#36136: syntax-ppss fails to invalidate its cache on changes to syntax-table text properties
Date: Thu, 13 Jun 2019 12:21:50 +0000 [thread overview]
Message-ID: <20190613122150.GA25866@ACM> (raw)
In-Reply-To: <jwv5zpbumm5.fsf-monnier+emacs@gnu.org>
Hello, Stefan.
On Wed, Jun 12, 2019 at 06:54:25 -0400, Stefan Monnier wrote:
> >> Hmm... I'm not too fond of adding ad-hoc support for specific
> >> text-properties in (set_properties, add_properties, remove_properties).
> > Neither am I, particularly. But the whole point of syntax-ppss, surely,
> > is that it should work automatically, without users having to call
> > syntax-ppss-flush-cache all the time.
> `grep` seems to argue that "all the time" is an over statement.
CC Mode has to call that function all the time, without any scare
quotes. In particular, it has to call the thing before each
font-locking action. It shouldn't have to; it doesn't even make any use
of the package, and is thus messy programming indeed.
The root of the problem is the implicit assumption made by syntax-ppss
that programs would never set syntax-table properties. This assumption
doesn't hold.
[ .... ]
> > It will probably not make a great deal of difference either way. Buffer
> > changes are frequent in Emacs, and so are calls to syntax-ppss in many
> > major modes.
> That's also my impression (which is why I haven't bothered to make
> syntax-ppss-flush-cache lazy like your patch does, even tho I've been
> tempted to several times).
> > Well, for CC Mode I'm going to have to do that anyway, since Emacs-26.x
> > and earlier are already out there and aren't going to change.
> Indeed.
> [ unless you decide to make CC-mode use syntax-propertize, of course ;-) ]
I don't think that would work without loss of functionality and loss of
speed (to whatever degree), and even if it could, would be more work than
it's worth.
> But I also agree that it shouldn't prevent us from looking for
> better solutions.
What about my idea of giving a "no inhibit" property to functions on
before/after-change-functions? This would be easy to implement, though
might have unwanted unexpected consequences.
> > This is going to be tedious and error prone.
> I don't see why. Usually a single call does the trick (as seen above:
> either in the function that sets the syntax-table property, or in the
> function that takes care of refreshing things in response to a buffer
> modification).
Yes, you're right, it wasn't too bad. There are many functions in CC
Mode which set the syntax-table property, so adapting each of them
didn't come into consideration. I amended the existing cache
invalidation routine to keep track of a syntax-table property position,
and pass that position to syntax-ppss-flush-cache at the end of
c-after-change, just before font-lock kicks in.
But, as already said, I shouldn't have to do this.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2019-06-13 12:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-08 13:17 bug#36136: syntax-ppss fails to invalidate its cache on changes to syntax-table text properties Alan Mackenzie
2019-06-08 20:36 ` bug#36136: [PATCH]: " Alan Mackenzie
2019-06-09 5:56 ` Eli Zaretskii
2019-06-09 14:52 ` Alan Mackenzie
2019-06-09 18:39 ` Alan Mackenzie
2019-06-12 8:37 ` Stefan Monnier
2019-06-12 10:15 ` Alan Mackenzie
2019-06-12 10:54 ` Stefan Monnier
2019-06-13 12:21 ` Alan Mackenzie [this message]
2019-06-13 21:31 ` Stefan Monnier
[not found] ` <handler.36136.B.155999987226722.ack@debbugs.gnu.org>
2019-08-24 19:35 ` bug#36136: Acknowledgement (syntax-ppss fails to invalidate its cache on changes to syntax-table text properties) Alan Mackenzie
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=20190613122150.GA25866@ACM \
--to=acm@muc.de \
--cc=36136@debbugs.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).