GNU bug report logs - #35128
12.1.2; C-u ` <symbol> puts cursor before closing dollar sign

Previous Next

Package: auctex;

Reported by: Todor Tsankov <tt.debian <at> mail.ru>

Date: Wed, 3 Apr 2019 18:19:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 12.1.2

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

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 35128 in the body.
You can then email your comments to 35128 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#35128; Package auctex. (Wed, 03 Apr 2019 18:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Todor Tsankov <tt.debian <at> mail.ru>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Wed, 03 Apr 2019 18:19:02 GMT) Full text and rfc822 format available.

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

From: Todor Tsankov <tt.debian <at> mail.ru>
To: bug-auctex <at> gnu.org
Subject: 12.1.2; C-u ` <symbol> puts cursor before closing dollar sign
Date: Wed, 3 Apr 2019 20:18:33 +0200
Dear maintainer,

The math prefix command "`" with a prefix argument allows to quickly
insert mathematical symbols surrounded by dollar signs. After this
command, AucTeX places the cursor before the closing dollar sign, so one
needs an extra keystroke to move forward and continue typing after that.
This did not happen in version 11.91, where the cursor was placed after
the closing dollar sign, so it can be considered a regression. This is
quite annoying for me: I mostly use this command to insert single
symbols (for example Greek letters) in the text.

In case this change was intentional, please provide a configuration
option to revert to the old behaviour (which, in my opinion, makes more
sense).

Thank you for maintaining AucTeX!

Regards,
Todor


Emacs  : GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-15, modified by Debian
Package: 12.1.2

current state:
==============
(setq
 AUCTeX-date "2019-02-08"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
"/home/todor/.emacs.d/elpa/auctex-12.1.2/style"
                  "/home/todor/.emacs.d/auctex/auto"
"/home/todor/.emacs.d/auctex/style"
                  "auto" "style")
 TeX-auto-save nil
 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 ams-tex-mode
texinfo-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")
                    ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help
                     "Convert DVI file to PDF with dvipdfmx")
                    ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help
                     "Convert PostScript file to PDF")
                    ("Glossaries" "makeglossaries %s" TeX-run-command
nil t :help
                     "Run makeglossaries to create glossary file")
                    ("Index" "makeindex %s" TeX-run-index nil t :help
                     "Run makeindex to create index file")
                    ("upMendex" "upmendex %s" TeX-run-index t t :help
                     "Run upmendex to create index file")
                    ("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#35128; Package auctex. (Thu, 04 Apr 2019 17:32:02 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Todor Tsankov <tt.debian <at> mail.ru>
Cc: 35128 <at> debbugs.gnu.org
Subject: Re: bug#35128: 12.1.2;
 C-u ` <symbol> puts cursor before closing dollar sign
Date: Fri, 05 Apr 2019 02:31:49 +0900
Hi Tsankov,

>>>>> Todor Tsankov <tt.debian <at> mail.ru> writes:
> The math prefix command "`" with a prefix argument allows to quickly
> insert mathematical symbols surrounded by dollar signs. After this
> command, AucTeX places the cursor before the closing dollar sign, so one
> needs an extra keystroke to move forward and continue typing after that.
> This did not happen in version 11.91, where the cursor was placed after
> the closing dollar sign, so it can be considered a regression. This is
> quite annoying for me: I mostly use this command to insert single
> symbols (for example Greek letters) in the text.

Thanks for reporting the bug.  This is a regression in an attempt to
wrap the whole "\langle" and "\rangle" pair inside the dollar signs,
when one types "`" followed by "(".

I hope that the following definition for the function
`LaTeX-math-insert' would fix the bug.  Could you test it if you know
how to do that?

To other maintainers: The new definition contains a fix to behave
correctly when active region is in effect.  Now typing "`" followed by,
say, "^", wraps the text in the active region in "\hat{}", even when the
prefix C-u is given and the point is placed at the end of the active
region.  (This issue is not a regression brought by me.  It has been in
AUCTeX since long before.)

Regards,
Ikumi Keita

(defun LaTeX-math-insert (string dollar)
  "Insert \\STRING{}.  If DOLLAR is non-nil, put $'s around it.
If `TeX-electric-math' is non-nil wrap that symbols around the
string."
  (let ((active (TeX-active-mark))
	(m (make-marker))
	closer)
    (if (and active (> (point) (mark)))
	(exchange-point-and-mark))
    (when dollar
      (insert (or (car TeX-electric-math) "$"))
      (save-excursion
	(if active (goto-char (mark)))
	;; Store closer string for later reference.
	(setq closer (or (cdr TeX-electric-math) "$"))
	(insert closer)
	;; Set temporal marker to decide whether to put the point
	;; after the math mode closer or not.
	(set-marker m (point))))
    (funcall LaTeX-math-insert-function string)
    ;; If the above `LaTeX-math-insert-function' resulted in
    ;; inserting, e.g., a pair of "\langle" and "\rangle" by
    ;; typing "`(", keep the point between them.  Otherwise
    ;; move the point after the math mode closer.
    (if (and dollar
	     (= m (+ (point) (length closer))))
	(goto-char m))
    ;; Make temporal marker point nowhere not to slow down the
    ;; subsequent editing in the buffer.
    (set-marker m nil)))





Added tag(s) patch. Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Fri, 05 Apr 2019 05:56:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-auctex <at> gnu.org:
bug#35128; Package auctex. (Sat, 06 Apr 2019 05:35:01 GMT) Full text and rfc822 format available.

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

From: Todor Tsankov <tt.debian <at> mail.ru>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 35128 <at> debbugs.gnu.org
Subject: Re: bug#35128: 12.1.2; C-u ` <symbol> puts cursor before closing
 dollar sign
Date: Fri, 5 Apr 2019 22:34:22 -0700
On 04/04/2019 10:31, Ikumi Keita wrote:
> Hi Tsankov,
> 
>>>>>> Todor Tsankov <tt.debian <at> mail.ru> writes:
>> The math prefix command "`" with a prefix argument allows to quickly
>> insert mathematical symbols surrounded by dollar signs. After this
>> command, AucTeX places the cursor before the closing dollar sign, so one
>> needs an extra keystroke to move forward and continue typing after that.
>> This did not happen in version 11.91, where the cursor was placed after
>> the closing dollar sign, so it can be considered a regression. This is
>> quite annoying for me: I mostly use this command to insert single
>> symbols (for example Greek letters) in the text.
> 
> Thanks for reporting the bug.  This is a regression in an attempt to
> wrap the whole "\langle" and "\rangle" pair inside the dollar signs,
> when one types "`" followed by "(".
> 
> I hope that the following definition for the function
> `LaTeX-math-insert' would fix the bug.  Could you test it if you know
> how to do that?
> 

The new function works for me. Thanks for the quick reaction and for the
fix!

Best,
Todor




Information forwarded to bug-auctex <at> gnu.org:
bug#35128; Package auctex. (Sat, 06 Apr 2019 11:42:01 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Todor Tsankov <tt.debian <at> mail.ru>
Cc: 35128 <at> debbugs.gnu.org
Subject: Re: bug#35128: 12.1.2;
 C-u ` <symbol> puts cursor before closing dollar sign
Date: Sat, 06 Apr 2019 20:41:00 +0900
>>>>> Todor Tsankov <tt.debian <at> mail.ru> writes:

> The new function works for me. Thanks for the quick reaction and for the
> fix!

Thanks for confirmation.  I installed the fix in the git repository.

Best,
Ikumi Keita




Added tag(s) fixed. Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Sat, 06 Apr 2019 11:44:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35128 <at> debbugs.gnu.org and Todor Tsankov <tt.debian <at> mail.ru> Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Sun, 08 Dec 2019 02:54:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 4 years and 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.