Subject: 27.0.50; inhibit-changing-match-data can be t in syntax-propertize functions, breaking backtrace and looking-at

From: Pip Cet <[email-masked]>
Date: Sat, 17 Nov 2018 13:30:04 +0000

I'm debugging an issue in a custom mode that happened because my
syntax-propertize function, which is complex, assumed it could use the
match data and looking-at. However, the function itself was called
from within looking-at-p, via a regexp generated by (regexp-opt "..."
'symbols), so inhibit-changing-match-data was still bound to t,
yielding unexpected results.

This was a bit tricky to debug because (backtrace) doesn't work when
inhibit-changing-match-data is t.  (In emacs -Q, enter

(let ((inhibit-changing-match-data t)) (backtrace))

into the *scratch* buffer and evaluate with C-M-x.)

At the very least, we should document these unfortunate limitations,
though I think it would be better to remove them.