[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug #25608 and the comment-cache branch
From: |
Stefan Monnier |
Subject: |
Re: Bug #25608 and the comment-cache branch |
Date: |
Thu, 16 Feb 2017 09:10:44 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> It was a case of seeing if two distinct syntax tables were "the same"
> from the point of view of literals. In other words, they could parse
> parentheses, whitespace and so on however they liked, but comments and
> strings had to be parsed identically by both tables for them to count
> "the same".
Interesting. Indeed, given that syntax-ppss has to pay attention to
more than comments and strings, equivalence between syntax-tables is
never something I considered.
> This is an instance where syntax-ppss's ambitions count against it - on
> any set-syntax-table syntax-ppss's caches should really be cleared,
> strictly speaking.
As you know, syntax-ppss's caching is fairly naive currently and doesn't
make enough checks to give correct results in some cases. Changes in
the syntax-tables and in point-min being two examples discussed here.
I already suggested to fix the issue w.r.t point-min by replacing
syntax-ppss-cache with a table indexed by the value of point-min.
The same idea could be used for syntax-tables. I.e. make
syntax-ppss-cache indexed by the combination of syntax-table and
point-min.
Another option is to provide a `with-temp-syntactic-context` macro,
which would locally bind syntax-ppss-cache to nil. So code which needs
to temporarily use a different point-min and/or syntax-table for some
parsing&navigation work could use this macro to avoid being affected by
the normal cache as well as polluting the cache.
I use this approach of let-binding syntax-ppss-cache is sm-c-mode, for
example (and yes: it's a dirty hack since sm-c-mode shouldn't mess with
syntax-ppss's internals).
Which approach is best depends on the use: If that same syntax-table
will be reused many times (so caching between uses would be beneficial),
then indexing by syntax-table in syntax-ppss-cache is likely the better
choice, otherwise with-temp-syntactic-context is probably all you need.
Stefan
- Re: Bug #25608 and the comment-cache branch, (continued)
- Re: Bug #25608 and the comment-cache branch, Dmitry Gutov, 2017/02/06
- Re: Bug #25608 and the comment-cache branch, Alan Mackenzie, 2017/02/07
- Re: Bug #25608 and the comment-cache branch, Dmitry Gutov, 2017/02/14
- Re: Bug #25608 and the comment-cache branch, Stefan Monnier, 2017/02/14
- Re: Bug #25608 and the comment-cache branch, Dmitry Gutov, 2017/02/21
- Re: Bug #25608 and the comment-cache branch, Stefan Monnier, 2017/02/21
- Re: Bug #25608 and the comment-cache branch, Dmitry Gutov, 2017/02/23
- Re: Bug #25608 and the comment-cache branch, Stefan Monnier, 2017/02/23
- Re: Bug #25608 and the comment-cache branch, Tom Tromey, 2017/02/24
- Re: Bug #25608 and the comment-cache branch, Alan Mackenzie, 2017/02/14
- Re: Bug #25608 and the comment-cache branch,
Stefan Monnier <=
- Re: Bug #25608 and the comment-cache branch, Alan Mackenzie, 2017/02/18
- Re: Bug #25608 and the comment-cache branch, Stefan Monnier, 2017/02/18
- Re: Bug #25608 and the comment-cache branch, John Wiegley, 2017/02/11
- Re: Bug #25608 and the comment-cache branch, Elias Mårtenson, 2017/02/12
- Re: Bug #25608 and the comment-cache branch, Alan Mackenzie, 2017/02/12
- Re: Bug #25608 and the comment-cache branch, martin rudalics, 2017/02/12
- Re: Bug #25608 and the comment-cache branch, Andreas Röhler, 2017/02/12
- Re: Bug #25608 and the comment-cache branch, Eli Zaretskii, 2017/02/12
- Re: Bug #25608 and the comment-cache branch, Alan Mackenzie, 2017/02/05
- Re: Bug #25608 and the comment-cache branch, Stefan Monnier, 2017/02/05