GNU bug report logs -
#23180
2016-01-31; Auto-capitalize and change env
Previous Next
Reported by: Uwe Brauer <oub <at> mat.ucm.es>
Date: Fri, 1 Apr 2016 09:39:01 UTC
Severity: normal
Tags: notabug
Done: mose <at> gnu.org (Mosè Giordano)
Bug is archived. No further changes may be made.
Full log
Message #38 received at 23180 <at> debbugs.gnu.org (full text, mbox):
2016-04-01 19:20 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
> > 2016-04-01 15:17 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
> > 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è
This bug report was last modified 8 years and 229 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.