bug-auctex
[Top][All Lists]
Advanced

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

bug#47757: 13.0.6; Point position after indent-for-tab-command with LaTe


From: Gustavo Barros
Subject: bug#47757: 13.0.6; Point position after indent-for-tab-command with LaTeX-syntactic-comments
Date: Tue, 13 Apr 2021 16:39:32 -0300
User-agent: mu4e 1.4.15; emacs 27.2

Hi All,

As of the latest AUCTeX release, when `LaTeX-syntactic-comments' is t, as it is by default, calling `indent-for-tab-command' ("TAB") before the start of the comment text on the line will move point to the start of the comment text. I believe this to be unexpected, but I might be missing something from expected behavior. Either way, I can provide at least one example of inconvenience resulting from this when it interacts with `electric-indent-mode' (also on by default).

I'm not claiming this behavior is new, but I don't recall it being the case previously. Anyway, I just said "as of the latest AUCTeX release" because that's where I verified the behavior. It might well be older, I don't know.

An ECM to reproduce the issue is:

Start `emacs -Q'.

Do an initial setup:
#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/elpa/auctex-13.0.6")
(load "auctex.el" nil t t)
(setq TeX-parse-self t)
(setq TeX-auto-save t)
#+end_src

Visit a `.tex' file with contents ("|" represents point position):
#+begin_src latex

|% comment

#+end_src

Call `indent-for-tab-command' ("TAB"), and point moves to:
#+begin_src latex

% |comment

#+end_src

Whether there was actually some indenting to do or not, as long as point was before the start of the text (somewhere in the comment prefix, or before it) point is moved to the start of the comment text. I would expect it not to move at all if there is no indent to be done, and only move if indenting deletes the place where point was, in which case, I'd expect point to end at the comment character (only after a possible whitespace).

As far as I could dig, this results from (or is related to) `LaTeX-syntactic-comments', which is set to t by default. Setting `LaTeX-syntactic-comments' to nil eliminates the described behavior.

As for an example of a resulting inconvenience of this behavior, when `electric-indent-mode' is on (which is the case by default), if point is at the start of the line, as in:

#+begin_src latex

|% comment

#+end_src

And we want to add some blank lines before comment, it would be only natural to hit "RET" a couple of times. If we do so, the result is:

#+begin_src latex


%
|comment

#+end_src

While I'd expect it to be:

#+begin_src latex



|% comment

#+end_src


Best regards,
Gustavo.

PS: Please keep me CC'd.



Emacs : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2021-03-25
Package: 13.0.6

current state:
==============
(setq
AUCTeX-date "2021-04-02"
window-system 'x
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex"
                  "/home/gustavo/.emacs.d/elpa/auctex-13.0.6/style"
                  "/home/gustavo/.emacs.d/auctex/auto"
                  "/home/gustavo/.emacs.d/auctex/style" "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)%' %(output-dir) %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) %(o-dir) %t"
                     TeX-run-compile nil (texinfo-mode) :help
                     "Run Makeinfo with Info output")
                    ("Makeinfo HTML"
                     "makeinfo %(extraopts) %(o-dir) --html %t"
                     TeX-run-compile nil (texinfo-mode) :help
                     "Run Makeinfo with HTML output")
                    ("AmSTeX"
"amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %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 %(O?aux)" TeX-run-BibTeX nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode context-mode)
                     :help "Run BibTeX")
                    ("Biber" "biber %s %(output-dir)" TeX-run-Biber nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :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
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :help "Generate PostScript file")
                    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :help "Convert DVI file to PostScript")
("Dvipdfmx" "dvipdfmx %d -o %(O?pdf)" TeX-run-dvipdfmx nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :help "Convert DVI file to PDF with dvipdfmx")
                    ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :help "Convert PostScript file to PDF")
("Glossaries" "makeglossaries %(O?aux)" TeX-run-command
                     nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
:help "Run makeglossaries to create glossary\n file")
                    ("Index" "makeindex %(O?idx)" TeX-run-index nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :help "Run makeindex to create index file")
                    ("upMendex" "upmendex %(O?idx)" TeX-run-index t
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :help "Run upmendex to create index file")
                    ("Xindy" "texindy %s" TeX-run-command nil
                     (plain-tex-mode latex-mode doctex-mode ams-tex-mode
                      texinfo-mode)
                     :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")
                    )
)





reply via email to

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