GNU bug report logs - #36136
syntax-ppss fails to invalidate its cache on changes to syntax-table text properties

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 8 Jun 2019 13:18:01 UTC

Severity: normal

Tags: wontfix

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 36136 <at> 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: Wed, 12 Jun 2019 04:37:25 -0400
> The following patch is simpler than my first proposal, following
> feedback from Eli.  It works for me.
>
> Stefan, could you look at this, please?

Here I am.

> * src/textprop.c (syntax-propertize--done): New buffer local variable.
> (set_properties, add_properties, remove_properties): when a syntax-table text
> property is being changed, reduce syntax-propertize--done to the buffer
> position.

Hmm... I'm not too fond of adding ad-hoc support for specific
text-properties in (set_properties, add_properties, remove_properties).

> * lisp/emacs-lisp/syntax.el (syntax-ppss--trim-cache): New function extracted
> from syntax-ppss-flush-cache.
> (syntax-ppss-flush-cache): Now only modifies syntax-propertize--done and
> syntax-ppss--done.
> (syntax-ppss): Calls syntax-ppss--trim-cache and sets syntax-propertize--done.

This part looks OK.

I'm not sure if making the cache-flushing more lazy will be a win
overall: it speeds up buffer modifications at the cost of slowing down
syntax-ppss.

To get back to the original problem:

> This is because the invalidation function, syntax-ppss-flush-cache is
> invoked only as a before-change function, but typical (?all)
> syntax-table property changes happen when before-change-functions
> is inactive.

That's why it doesn't have "--" in its name: if you don't want to use
syntax-propertize then you'll probably have to call that function
by hand.  I consider it as perfectly acceptable.


        Stefan





This bug report was last modified 5 years and 266 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.