GNU bug report logs - #23180
2016-01-31; Auto-capitalize and change env

Previous Next

Package: auctex;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23180 in the body.
You can then email your comments to 23180 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 09:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Uwe Brauer <oub <at> mat.ucm.es>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Fri, 01 Apr 2016 09:39:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: bug-auctex <at> gnu.org
Subject: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 09:38:35 +0000
Hi

I just realized that auto-capitalize is in MELPA.
Maybe I am the only one who uses this _very  useful package.

But when auto-capitalize is turned on,

C-u C-c C-e

Does *not* change the environment correctly.


\documentclass[12pt]{article}
\begin{document}

\begin{equation}
\label{eq:example:1}
\int 
\end{equation}

\end{document}


With auto-capitalize mode on
leads to


\documentclass[12pt]{article}
\begin{align}

\begin{equation}
\label{eq:example:1}
\int 
\end{align}

\end{document}

This problem does not occur in Xemacs with auctex-11.88.

regards

Uwe Brauer 

Emacs  : GNU Emacs 25.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2016-01-19
Package: 2016-01-31

current state:
==============
(setq
 AUCTeX-date "2016-01-31"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("/home/oub/ALLES/var/auctex" "/home/oub/emacs/site-lisp/packages/auctex-git/auctex/style"
		  "/home/oub/.emacs.d/auctex/auto" "/home/oub/tex/sty/auto" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
		     TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX")
		    ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")
		    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil (texinfo-mode) :help
		     "Run Makeinfo with Info output")
		    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil (texinfo-mode)
		     :help "Run Makeinfo with HTML output")
		    ("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t" TeX-run-TeX nil (ams-tex-mode)
		     :help "Run AMSTeX")
		    ("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" TeX-run-TeX nil
		     (context-mode) :help "Run ConTeXt once")
		    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode)
		     :help "Run ConTeXt until completion")
		    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX")
		    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
		    ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer")
		    ("Print" "%p" TeX-run-command t t :help "Print the file")
		    ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible
		     TeX-queue-command)
		    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help "Generate PostScript file")
		    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help "Convert DVI file to PostScript")
		    ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help "Convert PostScript file to PDF")
		    ("Index" "makeindex %s" TeX-run-index nil t :help "Run makeindex to create index file")
		    ("makegloss" "makeindex %s.nlo -s nomencl.ist -o %s.nls" TeX-run-command t t)
		    ("Xindy" "texindy %s" TeX-run-command nil t :help "Run xindy to create index file")
		    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help
		     "Check LaTeX file for correctness")
		    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help
		     "Check LaTeX file for common mistakes")
		    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help
		     "Spell-check the document")
		    ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files")
		    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
		     "Delete generated intermediate and output files")
		    ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))
 )




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 10:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 1 Apr 2016 12:19:58 +0200
Hi Uwe,

2016-04-01 11:38 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
> Hi
>
> I just realized that auto-capitalize is in MELPA.
> Maybe I am the only one who uses this _very  useful package.
>
> But when auto-capitalize is turned on,
>
> C-u C-c C-e
>
> Does *not* change the environment correctly.
>
>
> \documentclass[12pt]{article}
> \begin{document}
>
> \begin{equation}
> \label{eq:example:1}
> \int
> \end{equation}
>
> \end{document}
>
>
> With auto-capitalize mode on
> leads to
>
>
> \documentclass[12pt]{article}
> \begin{align}
>
> \begin{equation}
> \label{eq:example:1}
> \int
> \end{align}
>
> \end{document}
>
> This problem does not occur in Xemacs with auctex-11.88.

I can't reproduce the bug you describe neither in Emacs 24.5 nor in
Emacs 25.1.50.17.  Please provide a reproducible recipe starting from
"emacs -Q".

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 10:49:01 GMT) Full text and rfc822 format available.

Message #11 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 10:47:54 +0000
   > Hi Uwe,
   > 2016-04-01 11:38 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:

   > I can't reproduce the bug you describe neither in Emacs 24.5 nor in
   > Emacs 25.1.50.17.  Please provide a reproducible recipe starting from
   > "emacs -Q".

Again aaaaaaaaaa.

I did emacs -Q, I loaded auto-capitalize and auctex manually and then
everything worked as expected, so the error is in some init file of
mine, sigh, that will take some time to figure out......




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 11:04:02 GMT) Full text and rfc822 format available.

Message #14 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 1 Apr 2016 13:02:44 +0200
2016-04-01 12:47 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
>    > Hi Uwe,
>    > 2016-04-01 11:38 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
>    > I can't reproduce the bug you describe neither in Emacs 24.5 nor in
>    > Emacs 25.1.50.17.  Please provide a reproducible recipe starting from
>    > "emacs -Q".
>
> Again aaaaaaaaaa.
>
> I did emacs -Q, I loaded auto-capitalize and auctex manually and then
> everything worked as expected, so the error is in some init file of
> mine, sigh, that will take some time to figure out......

Then can we close this? :-)

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 11:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 11:53:17 +0000
   > 2016-04-01 12:47 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:

   > Then can we close this? :-)

Right now, I'd say yes. I might come back though.




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 12:28:02 GMT) Full text and rfc822 format available.

Message #20 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 12:27:08 +0000
[Message part 1 (text/plain, inline)]
    > 2016-04-01 12:47 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:

    > Then can we close this? :-)

Hm, I found the recipe:

 emacs -Q
 load auto-capitalize manually.

Load the following two files

Open a latex buffer and proceed as I said.

The problem is caused by this


 (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)))))

That was recommended to me by Kevin in order that
auto-capitalize is deactivated in math environment.

For example
\begin{equation}
 A_i
\end{align}
should not be expanded to 
\begin{equation}
 A_I
\end{align}

The above function provides such a behavior but the price is that change
environment does not work properly. Any thoughts?





[my-auto.el (application/emacs-lisp, attachment)]
[auc-init.el (application/emacs-lisp, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 13:00:02 GMT) Full text and rfc822 format available.

Message #23 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 1 Apr 2016 14:58:57 +0200
2016-04-01 14:27 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
>     > 2016-04-01 12:47 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
>     > Then can we close this? :-)
>
> Hm, I found the recipe:
>
>  emacs -Q
>  load auto-capitalize manually.
>
> Load the following two files
>
> Open a latex buffer and proceed as I said.
>
> The problem is caused by this
>
>
>  (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)))))
>
> That was recommended to me by Kevin in order that
> auto-capitalize is deactivated in math environment.
>
> For example
> \begin{equation}
>  A_i
> \end{align}
> should not be expanded to
> \begin{equation}
>  A_I
> \end{align}

Still can't reproduce, and I think there is an error in your recipe.
I guess you start from

\begin{equation}
  A_i
\end{equation}

move anywhere inside the environment, issue C-u C-c C-e "align" RET and get

\begin{equation}
  A_i
\end{align}

Is it correct?  Then I can't reproduce, I get

\begin{align}
  A_i
\end{align}

as expected.

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 13:19:02 GMT) Full text and rfc822 format available.

Message #26 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 13:17:45 +0000
    > 2016-04-01 14:27 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:

    > Still can't reproduce, and I think there is an error in your recipe.
    > I guess you start from

    > \begin{equation}
    >   A_i
    > \end{equation}

    > move anywhere inside the environment, issue C-u C-c C-e "align" RET and get

    > \begin{equation}
    >   A_i
    > \end{align}

    > Is it correct?  Then I can't reproduce, I get

More or less. The begin document is changed as well. I just repeated the
steps.

First the recipe.

  emacs -Q
  load auc-init.el
  load my-auto.el
  load $HOME/.emacs.d/elpa/auto-capitalize-20131013.2205/auto-capitalize.el

Open a Latex file


\documentclass[11pt]{article}
\begin{document}


\begin{equation}
 A_i a_{I}i
\end{equation}
\end{document}

move anywhere inside the environment, issue C-u C-c C-e "align" RET and
get

And I obtain
\documentclass[11pt]{article}
\begin{align}


\begin{equation}
 A_i a_{I}i
\end{align}

\end{document}




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 15:32:01 GMT) Full text and rfc822 format available.

Message #29 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 1 Apr 2016 17:30:26 +0200
2016-04-01 15:17 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
>     > 2016-04-01 14:27 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>
>     > Still can't reproduce, and I think there is an error in your recipe.
>     > I guess you start from
>
>     > \begin{equation}
>     >   A_i
>     > \end{equation}
>
>     > move anywhere inside the environment, issue C-u C-c C-e "align" RET and get
>
>     > \begin{equation}
>     >   A_i
>     > \end{align}
>
>     > Is it correct?  Then I can't reproduce, I get
>
> More or less. The begin document is changed as well. I just repeated the
> steps.
>
> First the recipe.
>
>   emacs -Q
>   load auc-init.el
>   load my-auto.el
>   load $HOME/.emacs.d/elpa/auto-capitalize-20131013.2205/auto-capitalize.el
>
> Open a Latex file
>
>
> \documentclass[11pt]{article}
> \begin{document}
>
>
> \begin{equation}
>  A_i a_{I}i
> \end{equation}
> \end{document}
>
> move anywhere inside the environment, issue C-u C-c C-e "align" RET and
> get
>
> And I obtain
> \documentclass[11pt]{article}
> \begin{align}
>
>
> \begin{equation}
>  A_i a_{I}i
> \end{align}
>
> \end{document}
>

Ok, thanks, now I can reproduce it but can't find the real culprit.
The problem is that after `replace-match' point is left after
"\begin", instead of after "\end{align".  I can't understand what
moves point.  Apparently point is moved after `after-change-functions'
hook is run.  In a LaTeX buffer its value is (auto-capitalize
jit-lock-after-change t), but neither `auto-capitalize' nor
`jit-lock-after-change' moves point.  I really don't know what is
causing point to be moved after the change.

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:

--8<---------------cut here---------------start------------->8---
(goto-char (point-max))
(re-search-backward "equation")
(replace-match "foo")
--8<---------------cut here---------------end--------------->8---

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

Does someone have an idea of what happens after
`after-change-functions' hook is run?  Help is welcome!

Bye,
Mosè

PS: regarding the specific problem you're reporting we can work around
it by wrapping a `save-excursion' around `replace-match', but I'd
prefer to find what really triggers the bug and then decide what to
do.




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 17:12:01 GMT) Full text and rfc822 format available.

Message #32 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 17:11:20 +0000
   > 2016-04-01 15:17 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:

   > Ok, thanks, now I can reproduce it but can't find the real culprit.

Good, I was starting to feel paranoid :-D


   > The problem is that after `replace-match' point is left after
   > "\begin", instead of after "\end{align".  I can't understand what
   > moves point.  Apparently point is moved after `after-change-functions'
   > hook is run.  In a LaTeX buffer its value is (auto-capitalize
   > jit-lock-after-change t), but neither `auto-capitalize' nor
   > `jit-lock-after-change' moves point.  I really don't know what is
   > causing point to be moved after the change.

This comment is not really helpful, but in Xemacs this problem does not
occur.


   > 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.

I will play around with it a bit with that function.



   > PS: regarding the specific problem you're reporting we can work around
   > it by wrapping a `save-excursion' around `replace-match', but I'd
   > prefer to find what really triggers the bug and then decide what to
   > do.

Ah, I was thinking about something like this.




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 17:21:02 GMT) Full text and rfc822 format available.

Message #35 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Fri, 01 Apr 2016 17:20:09 +0000
   > 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.




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 01 Apr 2016 23:14:02 GMT) Full text and rfc822 format available.

Message #38 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org
Subject: Re: 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 <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è




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 09:29:01 GMT) Full text and rfc822 format available.

Message #41 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Sat, 02 Apr 2016 09:28:16 +0000
    > 2016-04-01 19:20 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:


    > 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.

I can do that of course, but honestly, wouldn't you be much more
qualified to explain and discuss that problem?

Uwe 




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 10:43:01 GMT) Full text and rfc822 format available.

Message #44 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org, Marcin Borkowski <mbork <at> mbork.pl>
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
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è




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 12:33:02 GMT) Full text and rfc822 format available.

Message #47 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, Marcin Borkowski <mbork <at> mbork.pl>,
 23180 <at> debbugs.gnu.org
Subject: Re: bug#23180: 2016-01-31; Auto-capitalize and change env
Date: Sat, 02 Apr 2016 12:32:46 +0000
>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:

   > 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))))
GREAT, that saves my day!

Many thanks for solving this issue!!!!

BTW, it seems that almost nobody uses auto-capitalize. I find it very
useful!

Uwe 




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 17:32:02 GMT) Full text and rfc822 format available.

Message #50 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, Marcin Borkowski <mbork <at> mbork.pl>,
 23180 <at> debbugs.gnu.org
Subject: Still a problem (was: bug#23180: 2016-01-31;
 Auto-capitalize and change env)
Date: Sat, 02 Apr 2016 17:31:04 +0000
>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:

    > 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))))

I did the change


(defun my-set-auto-capitalize ()
  (interactive)
  (set (make-local-variable 'auto-capitalize-predicate)
       (lambda () (not (save-match-data (texmathp))))))

Then when following the recipe;
emacs -Q

And loading the necessary files changing enviroments seems to work,
however not for my standard init setting, it seems that it is important
where that function is in the LaTeX-mode-hook.

(I think everybody is tired with this bug), 
So I thought of modifying directly the auto-capitalize code.

Most likely the line 
	       (funcall auto-capitalize-predicate)))

Should read

	       (funcall (save-match-data (auto-capitalize-predicate))))

Is this correct?

thanks

Uwe 




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 17:42:02 GMT) Full text and rfc822 format available.

Message #53 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org, Marcin Borkowski <mbork <at> mbork.pl>
Subject: Re: Still a problem (was: bug#23180: 2016-01-31; Auto-capitalize and
 change env)
Date: Sat, 2 Apr 2016 19:40:45 +0200
Hi Uwe,

2016-04-02 19:31 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:
>
>     > 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))))
>
> I did the change
>
>
> (defun my-set-auto-capitalize ()
>   (interactive)
>   (set (make-local-variable 'auto-capitalize-predicate)
>        (lambda () (not (save-match-data (texmathp))))))
>
> Then when following the recipe;
> emacs -Q
>
> And loading the necessary files changing enviroments seems to work,
> however not for my standard init setting, it seems that it is important
> where that function is in the LaTeX-mode-hook.
>
> (I think everybody is tired with this bug),
> So I thought of modifying directly the auto-capitalize code.
>
> Most likely the line
>                (funcall auto-capitalize-predicate)))
>
> Should read
>
>                (funcall (save-match-data (auto-capitalize-predicate))))
>
> Is this correct?

Yes.  Since that function is to be run in `after-change-functions' I
believe that it should be auto-capitalize task to make sure match data
is preserved after `auto-capitalize-predicate' is executed.

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 17:45:01 GMT) Full text and rfc822 format available.

Message #56 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, Marcin Borkowski <mbork <at> mbork.pl>,
 23180 <at> debbugs.gnu.org
Subject: Re: Still a problem
Date: Sat, 02 Apr 2016 17:44:35 +0000
>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:

   > Hi Uwe,
   > 2016-04-02 19:31 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
   >>>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:
   >> (I think everybody is tired with this bug),
   >> So I thought of modifying directly the auto-capitalize code.
   >> 
   >> Most likely the line
   >> (funcall auto-capitalize-predicate)))
   >> 
   >> Should read
   >> 
   >> (funcall (save-match-data (auto-capitalize-predicate))))
   >> 
   >> Is this correct?

   > Yes.  Since that function is to be run in `after-change-functions' I
   > believe that it should be auto-capitalize task to make sure match data
   > is preserved after `auto-capitalize-predicate' is executed.

No that did not work, gave a syntax error(!)

it seems that the correct syntax is

	       (save-match-data (funcall auto-capitalize-predicate))))


now (for the moment being, finger crossed) everything works as expected.

If Kevin is not responding in due time, I try to find out how I could
change the code in MELPA.

Bye

Uwe 




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Sat, 02 Apr 2016 18:08:02 GMT) Full text and rfc822 format available.

Message #59 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org, Marcin Borkowski <mbork <at> mbork.pl>
Subject: Re: Still a problem
Date: Sat, 2 Apr 2016 20:06:22 +0200
2016-04-02 19:44 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:
>
>    > Hi Uwe,
>    > 2016-04-02 19:31 GMT+02:00 Uwe Brauer <oub <at> mat.ucm.es>:
>    >>>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:
>    >> (I think everybody is tired with this bug),
>    >> So I thought of modifying directly the auto-capitalize code.
>    >>
>    >> Most likely the line
>    >> (funcall auto-capitalize-predicate)))
>    >>
>    >> Should read
>    >>
>    >> (funcall (save-match-data (auto-capitalize-predicate))))
>    >>
>    >> Is this correct?
>
>    > Yes.  Since that function is to be run in `after-change-functions' I
>    > believe that it should be auto-capitalize task to make sure match data
>    > is preserved after `auto-capitalize-predicate' is executed.
>
> No that did not work, gave a syntax error(!)
>
> it seems that the correct syntax is
>
>                (save-match-data (funcall auto-capitalize-predicate))))
>
>
> now (for the moment being, finger crossed) everything works as expected.

Sorry, I didn't look closely to the code.  `funcall' takes a function
as argument, `save-match-data' has to protect the whole `funcall'.

> If Kevin is not responding in due time, I try to find out how I could
> change the code in MELPA.

MELPA fetches that package from Emacswiki
https://www.emacswiki.org/emacs/auto-capitalize.el see the recipe
https://raw.githubusercontent.com/melpa/melpa/master/recipes/auto-capitalize

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Thu, 29 Dec 2016 00:10:01 GMT) Full text and rfc822 format available.

Message #62 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 23180 <at> debbugs.gnu.org
Subject: Re: Still a problem
Date: Thu, 29 Dec 2016 01:08:39 +0100
Hi Uwe,

can we close this ticket?

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Thu, 29 Dec 2016 09:11:01 GMT) Full text and rfc822 format available.

Message #65 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: Still a problem
Date: Thu, 29 Dec 2016 09:10:07 +0000
>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:

   > Hi Uwe,
   > can we close this ticket?

   > Bye,
   > Mosè

Sorry forgot all about it, I look into it right now and report back.

Uwe 




Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Thu, 29 Dec 2016 09:31:01 GMT) Full text and rfc822 format available.

Message #68 received at 23180 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 23180 <at> debbugs.gnu.org
Subject: Re: Still a problem
Date: Thu, 29 Dec 2016 09:30:23 +0000
>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:

   > Hi Uwe,
   > can we close this ticket?


Just checked it, please close it. Sorry for the delay.

Uwe 




Added tag(s) notabug. Request was from mose <at> gnu.org (Mosè Giordano) to control <at> debbugs.gnu.org. (Thu, 29 Dec 2016 18:18:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 23180 <at> debbugs.gnu.org and Uwe Brauer <oub <at> mat.ucm.es> Request was from mose <at> gnu.org (Mosè Giordano) to control <at> debbugs.gnu.org. (Thu, 29 Dec 2016 18:18:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-auctex <at> gnu.org:
bug#23180; Package auctex. (Fri, 30 Dec 2016 09:46:02 GMT) Full text and rfc822 format available.

Message #75 received at 23180-done <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: 23180-done <at> debbugs.gnu.org
Subject: Re: bug#23180: Still a problem
Date: Fri, 30 Dec 2016 10:45:45 +0100
Uwe Brauer <oub <at> mat.ucm.es> writes:

>>>> "Mosè" == Mosè Giordano <mose <at> gnu.org> writes:
>
>    > Hi Uwe,
>    > can we close this ticket?
>
> Just checked it, please close it. Sorry for the delay.

Done.

Bye,
Tassilo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 27 Jan 2017 12:24:04 GMT) Full text and rfc822 format available.

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.