bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30393: 24.4; cperl-mode: indentation failure


From: Stefan Monnier
Subject: bug#30393: 24.4; cperl-mode: indentation failure
Date: Sun, 11 Feb 2018 17:53:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> OK, but I suspect in practice, this would be impossible to debug for
> lack of reproducibility.

Those problems can be hard to debug, indeed.  But an inf-loop should at
least be diagnosed as such fairly easily (even if its origin can be
difficult to track down), so I don't think "in practice I haven't bumped
into this problem yet" just because those problems stay undetected.

> Another definite bug is that the syntax-ppss cache is not flushed when
> the syntax-table is changed, whether with set-syntax-table or
> modify-syntax-entry.

That's right.  I haven't bumped into such issues yet, but here (contrary
to the above problem) it might very well be because the error
stays undetected.

> This is critical, now that primitives depend on this cache.

I can see two approaches to solve this problem:
- hook into set-syntax-table and modify-syntax-entry or something
  like that.  This will make it work right everywhere automatically, but
  I'm afraid it could turn out to be difficult to make it efficient
  (because of the cost of the tests needed to detect changes and more
  importantly because of excessive flushing of the syntax-ppss cache).
- provide new functions to let packages tell syntax-ppss about
  such things.  E.g. a macro `with-new-syntax-context` (which would
  be treated a bit like narrowing, maybe).  This would require changes
  to packages that suffer from this problem but should give
  better performance.

I'd prefer the second option, but at the same time, I'm not completely sure
what are the "typical" problem cases (which makes it hard to come up
with good new functions/macros) other than the case where we use
with-syntax-table (which is sometimes combined with a local narrowing)
but some of those only tweak the "word-vs-symbol-vs-punctuation"
settings so should ideally not flush the syntax-ppss cache.

Also I don't actually know whether the "fully automatic" approach would
actually turn out to be too expensive, it's just a gut feeling.

> Would you please fix this, Stefan.

It's fairly high up on my todo list, but I'm kinda swamped right now.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]