Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env

From: Mosè Giordano <[email-masked]>
Date: Sat, 2 Apr 2016 12:41:28 +0200

Hi Uwe,

I dug further into the bug and noticed that it can be better
circumvented by setting `auto-capitalize-predicate' to

    (lambda () (not (save-match-data (texmathp))))

It seems that something uses match data by `texmathp' and moves point
after `after-change-functions' hook is run.  This is actually also
documented into Elisp manual:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Change-Hooks.html
(info "(elisp)Change Hooks").

My question to other readers is: does someone knows if it's safe to
wrap the whole `texmathp' function with a `save-match-data' or this
affects the result of `texmathp' and related functions?  I'm CC-ing
Marcin that recently studied the code of `texmathp' (sorry for the
noise, Marcin :-)

In the end I'd say that `LaTeX-modify-environment' is fine, your
`auto-capitalize-predicate' must restore match data anyway, `texmathp'
could be adjusted, but without further comments I'll leave it as it is now.

Bye,
Mosè