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

From: Uwe Brauer <[email-masked]>
Date: Fri, 01 Apr 2016 17:20:09 +0000

> 2016-04-01 15:17 GMT+02:00 Uwe Brauer <[email-masked]>:

   > I can't reproduce the bug with other major modes (I tested
   > fundamental-mode and text-mode).  I can't reproduce it with other
   > values of `auto-capitalize-predicate' , like both (lambda () t) or
   > (lambda () nil), so I thought `texmathp' is involved but it doesn't move point.

   > Here are the smallest recipe to reproduce the bug once auto-capitalize
   > and AUCTeX have been loaded and the file you provided has been
   > visited:

   > (goto-char (point-max))
   > (re-search-backward "equation")
   > (replace-match "foo")

   > As I said, point after `replace-match' isn't where it should be.

I forgot to add something. The problem is the function in the latex
hook:
 (add-hook 'LaTeX-mode-hook 'my-set-auto-capitalize) 
 (defun my-set-auto-capitalize ()
 (interactive)
         (set (make-local-variable 'auto-capitalize-predicate)
              (lambda () (not (texmathp)))))

Once it is in the hook, even removing the function from the hook does
not help anymore. I have to reset the mode. But maybe this is how the
hook is supposed to work.