GNU bug report logs - #41195
27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Mon, 11 May 2020 23:33:02 UTC

Severity: normal

Found in version 27.0.91

Fixed in version 28.1

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: 41195 <at> debbugs.gnu.org
Subject: bug#41195: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops
Date: Tue, 12 May 2020 02:32:37 +0300
In theory, syntax-propertize-function implementations shouldn't change
buffer syntax the way that would affect the current syntax-ppss cache.
Or if they do, they should clear the cache accordingly.

Unfortunately, using syntax-ppss-flush-cache for that purpose doesn't
work: it makes Emacs infloop.

To reproduce, apply this patch:

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 5ec3e94275..efe38049ab 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2362,6 +2362,7 @@ js-syntax-propertize
                            (eval-when-compile (append "=({[,:;" 
'(nil))))))
            (put-text-property (match-beginning 1) (match-end 1)
                               'syntax-table (string-to-syntax "\"/"))
+           (syntax-ppss-flush-cache (match-beginning 0))
            (js-syntax-propertize-regexp end)))))
     ("\`\(#\)!" (1 "< b"))
     ("<" (0 (ignore

and then edit a file with js-mode containing

  a = /xyz/




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

Previous Next


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