bug-auctex
[Top][All Lists]
Advanced

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

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


From: Mosè Giordano
Subject: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Sat, 2 Apr 2016 01:12:50 +0200

2016-04-01 19:20 GMT+02:00 Uwe Brauer <address@hidden>:
>
>    > 2016-04-01 15:17 GMT+02:00 Uwe Brauer <address@hidden>:
>
>    > 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.

This bug is driving me crazy.  It occurs only with that specific value
of `auto-capitalize-predicate', but `texmathp' shouldn't move point
and `edebug-defun' confirms that it's run only once, within
`auto-capitalize', and does no harm.  Wrapping a `save-excursion'
around that `texmathp' doesn't fix it (but it shouldn't, since
`texmathp' doesn't move point).  The return value of the function
bound to the predicate isn't even important: (texmathp) returns t in
your example after the first `replace-match', but setting
`auto-capitalize-predicate' to (lambda () t) doesn't trigger the bug.

To summarize, my understanding is that `replace-match' correctly
leaves point after the modified text (the closing "equation" changed
into something else, in your example), then the
`after-change-functions' hook is run and none of the functions
involved (including `auto-capitalize') moves point.  After that,
something else happens that moves point but I don't really have a clue
of what.  You could try and poke emacs-devel to ask someone else with
more insights into Emacs internals to have a look at this problem.

Bye,
Mosè





reply via email to

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