GNU bug report logs -
#48518
13.0.11; LaTeX environment C-c C-e on region doesn't indent properly
Previous Next
Reported by: Berthold Lorke <berthold <at> lorke.de>
Date: Wed, 19 May 2021 10:58:02 UTC
Severity: normal
Tags: fixed
Found in version 13.0.11
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 48518 in the body.
You can then email your comments to 48518 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Wed, 19 May 2021 10:58:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Berthold Lorke <berthold <at> lorke.de>
:
New bug report received and forwarded. Copy sent to
bug-auctex <at> gnu.org
.
(Wed, 19 May 2021 10:58:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Whenever I highlight a region and do C-c C-e of any kind, the result
will not have the text indented correctly, and the closing
"\end{environment}" will also not be indented correctly. Merely the
"\begin{environment} is indented correctly.
Steps to reproduce:
1. Install auctex
2. Open a tex file (in latex-mode)
3. Start an intented environment, such as a section
4. Write some text
5. Highlight that text
6. Perform LaTeX-environment (C-c C-e) on that highlighted region
Example:
```tex
\documentclass{article}
\begin{document}
Hello.
\begin{section}
Here is a text.
With some paragraphs.
Here is a third paragraph.
\end{section}
\end{document}
```
After the steps:
```tex
\documentclass{article}
\begin{document}
Hello.
\begin{section}
\begin{environment}
Here is a text.
With some paragraphs.
Here is a third paragraph.
\end{environment}
\end{section}
\end{document}
```
It is easily fixed if I rehighlight the text and press tab (indent
region), but this is tedious. I should try to debug this myself, or
hotfix this by just writing a hook, but it should be easy to fix, and it
is a good exercise for me, but I am too lazy, sorry.
Best wishes
Berthold Lorke
Emacs : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.27, cairo version 1.17.4)
of 2021-03-26
Package: 13.0.11
current state:
==============
(setq
AUCTeX-date "2021-04-28"
window-system 'x
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex"
"/tmp/.emacs.d/elpa/auctex-13.0.11/style" "/tmp/.emacs.d/auctex/auto"
"/tmp/.emacs.d/auctex/style" "auto" "style")
TeX-auto-save nil
TeX-parse-self nil
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"))
)
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Thu, 20 May 2021 12:27:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Hi Berthold,
>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
> Whenever I highlight a region and do C-c C-e of any kind, the result
> will not have the text indented correctly, and the closing
> "\end{environment}" will also not be indented correctly. Merely the
> "\begin{environment} is indented correctly.
I guess you didn't enable `auto-fill-mode'. Try `M-x auto-fill-mode' in
the document buffer and do the same thing. If it works as expected, add
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
or
(add-hook 'text-mode-hook 'turn-on-auto-fill)
into your init file (init.el or .emacs).
Regards,
Ikumi Keita
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Thu, 20 May 2021 17:28:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 48518 <at> debbugs.gnu.org (full text, mbox):
[ Please keep Cc: 48518 <at> debbugs.gnu.org in the header when replying. ]
Hi Berthold,
>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
> Indeed, this fixes the indenting problem, but it adds a quirk. I don't
> want auto-fill-mode enabled, because this adds line breaks that I do not
> wish to have. Is there a way to achieve the indenting behaviour without
> having it add line breaks?
This "no indent" behavior was implemented upon request of another user
who also disables `auto-fill-mode'; Please take a look at the thread
beginning with
https://lists.gnu.org/r/auctex/2016-03/msg00056.html
What do you think about the rationale of the original poster of the
above thread?
Maybe AUCTeX should do only indentation, not filling, when
`auto-fill-mode' is disabled. (I'm not sure what is the best behavior
because I always enable `auto-fill-mode'.)
Regards,
Ikumi Keita
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Thu, 20 May 2021 19:01:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 48518 <at> debbugs.gnu.org (full text, mbox):
I see no contradiction.
On 20/05/2021 19.27, Ikumi Keita wrote:
> [ Please keep Cc: 48518 <at> debbugs.gnu.org in the header when replying. ]
>
> Hi Berthold,
>
>>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
>> Indeed, this fixes the indenting problem, but it adds a quirk. I don't
>> want auto-fill-mode enabled, because this adds line breaks that I do not
>> wish to have. Is there a way to achieve the indenting behaviour without
>> having it add line breaks?
>
> This "no indent" behavior was implemented upon request of another user
> who also disables `auto-fill-mode'; Please take a look at the thread
> beginning with
> https://lists.gnu.org/r/auctex/2016-03/msg00056.html
I don't see how "no indent" was requested by Florian. All he wanted was
no line wrapping of highlighted text after executing a latex-environment
C-c C-e command. Which I also do not want. So there is nothing he
suggested that I want changed.
>
> What do you think about the rationale of the original poster of the
> above thread?
>
> Maybe AUCTeX should do only indentation, not filling, when
> `auto-fill-mode' is disabled. (I'm not sure what is the best behavior
> because I always enable `auto-fill-mode'.)
Yes! This is exactly what I am requesting :)
>
> Regards,
> Ikumi Keita
>
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 21 May 2021 08:28:04 GMT)
Full text and
rfc822 format available.
Message #17 received at 48518 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Berthold,
>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
> I don't see how "no indent" was requested by Florian. All he wanted was
> no line wrapping of highlighted text after executing a latex-environment
> C-c C-e command. Which I also do not want. So there is nothing he
> suggested that I want changed.
Your argument is logical and convincing. ;-)
>> Maybe AUCTeX should do only indentation, not filling, when
>> `auto-fill-mode' is disabled. (I'm not sure what is the best behavior
>> because I always enable `auto-fill-mode'.)
> Yes! This is exactly what I am requesting :)
Could you test the attached patch to see whether it works as expected?
Regards,
Ikumi Keita
[latex-patch (text/x-diff, attachment)]
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 21 May 2021 11:01:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Yes! This is exactly the behaviour I expected, and I believe there is
no reason why this shouldn't be the default.
Thank you very much, I hope this will be patched in (or added as an
option, but again, I see no reason why it shouldn't be the default).
On 21/05/2021 10.26, Ikumi Keita wrote:
> Hi Berthold,
>
>>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
>> I don't see how "no indent" was requested by Florian. All he wanted was
>> no line wrapping of highlighted text after executing a latex-environment
>> C-c C-e command. Which I also do not want. So there is nothing he
>> suggested that I want changed.
>
> Your argument is logical and convincing. ;-)
>
>>> Maybe AUCTeX should do only indentation, not filling, when
>>> `auto-fill-mode' is disabled. (I'm not sure what is the best behavior
>>> because I always enable `auto-fill-mode'.)
>
>> Yes! This is exactly what I am requesting :)
>
> Could you test the attached patch to see whether it works as expected?
>
> Regards,
> Ikumi Keita
>
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 21 May 2021 14:06:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Hi Berthold,
>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
> Yes! This is exactly the behaviour I expected, and I believe there is
> no reason why this shouldn't be the default.
> Thank you very much, I hope this will be patched in (or added as an
> option, but again, I see no reason why it shouldn't be the default).
Pushed to the git repo. Thanks for your report.
Regards,
Ikumi Keita
Added tag(s) fixed.
Request was from
Ikumi Keita <ikumi <at> ikumi.que.jp>
to
control <at> debbugs.gnu.org
.
(Fri, 21 May 2021 14:06:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
48518 <at> debbugs.gnu.org and Berthold Lorke <berthold <at> lorke.de>
Request was from
Ikumi Keita <ikumi <at> ikumi.que.jp>
to
control <at> debbugs.gnu.org
.
(Fri, 21 May 2021 14:06: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
.
(Sat, 19 Jun 2021 11:24:04 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Berthold Lorke <berthold <at> lorke.de>
to
control <at> debbugs.gnu.org
.
(Tue, 20 Dec 2022 18:26:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Tue, 20 Dec 2022 18:46:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 48518 <at> debbugs.gnu.org (full text, mbox):
It seems that it still doesn't work quite right for any environments
listed in `LaTeX-indent-environment-list`, for example `equation`,
`align`, `cases`, `picture`, among many others.
Furthermore, I noticed the following.
If after selecting the environment, there is no additional prompt, say
for example for `cases`, the opening and closing `\begin{cases}` and
`\end{cases}` get indented correctly, but the content enclosed in it
(which was previously the highlighted region) stays unchanged.
If after selecting the environment, there is an additional prompt, say
for example for `equation`, the opening `\begin{equation}` gets indented
correctly, but the closing `\end{equation}` has no indentation at all
(id est is all the way left starting at column 0), and the content
enclosed also behaves as described before, unchanged indentation.
It should be easy to reproduce, I don't even think it is necessary to
already be in an indented environment to see this behaviour, but one can
try inside of an `itemize` environment for example, with wrongly
indented text spanning multiple lines and the highlight starting in the
middle of a line to see the effect the best.
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Tue, 20 Dec 2022 19:31:01 GMT)
Full text and
rfc822 format available.
Message #37 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Berthold Lorke <berthold <at> lorke.de> writes:
> It seems that it still doesn't work quite right for any environments
> listed in `LaTeX-indent-environment-list`, for example `equation`,
> `align`, `cases`, `picture`, among many others.
Are you still using 13.0.11? If yes, can you please update first from
ELPA? Thanks.
I'm not sure if I understand what you describe. If I take this .tex
file:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
Furthermore, I noticed the following.
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
Mark the sentence and hit 'C-c C-e equation RET', this is what I get:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
\begin{equation}
\label{eq:1}
Furthermore, I noticed the following.
\end{equation}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
Am I missing something?
Best, Arash
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Tue, 20 Dec 2022 20:01:02 GMT)
Full text and
rfc822 format available.
Message #40 received at 48518 <at> debbugs.gnu.org (full text, mbox):
my apologies, i was using version 13.1.1, and i thought this was the
most recent version (my package management had a hiccup or something).
i updated to 13.1.6, and now it works. thank you, and sorry for the
inconvenience.
bug archived.
Request was from
Arash Esbati <arash <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 22 Dec 2022 19:08:02 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Berthold Lorke <berthold <at> lorke.de>
to
control <at> debbugs.gnu.org
.
(Thu, 02 Feb 2023 20:03:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Thu, 02 Feb 2023 20:07:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Okay, I am sorry if I am bugging you (no pun intended), but I now still
do believe there is a problem.
I am using auctex 13.1.9. Let us assume the following inside of a
buffer in `tex-mode` with auctex installed. I did this with a fresh
Emacs, no other packages installed and no config.
```tex
\documentclass{article}
\begin{document}
\begin{itemize}
\item hello test.
some more text.
a^2 + b^2 = c^2
and some text afterwards here.
\end{itemize}
\end{document}
```
- Mark the region where I wrote `a^2 + b^2 = c^2`, that is line 7.
- Perform `M-x LaTeX-environment`, put `equation` in the prompt, press
enter, and then for the next prompt press enter again.
The buffer then reads the following
```tex
\documentclass{article}
\begin{document}
\begin{itemize}
\item hello test.
some more text.
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
and some text afterwards here.
\end{itemize}
\end{document}
```
As you can see, it is not correctly indented. Have tried this multiple
times on multiple machines and so on. Can you confirm this behaviour?
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 03 Feb 2023 08:14:01 GMT)
Full text and
rfc822 format available.
Message #50 received at 48518 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Berthold, thanks for the report.
>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
> Okay, I am sorry if I am bugging you (no pun intended), but I now
> still do believe there is a problem.
> I am using auctex 13.1.9. Let us assume the following inside of a
> buffer in `tex-mode` with auctex installed. I did this with a fresh
> Emacs, no other packages installed and no config.
I assume AUCTeX latex mode, not `tex-mode`.
> - Mark the region where I wrote `a^2 + b^2 = c^2`, that is line 7.
> - Perform `M-x LaTeX-environment`, put `equation` in the prompt, press
> enter, and then for the next prompt press enter again.
[...]
> As you can see, it is not correctly indented. Have tried this
> multiple times on multiple machines and so on. Can you confirm this
> behaviour?
Indeed. This is't nice. :-(
Currenty, `LaTeX-insert-environment' doesn't indent the active region if
the environment is in `LaTeX-indent-environment-list'. I expect that it
doesn't harm if it indents. Could you try the attached patch?
Bye,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
[patch (text/x-diff, attachment)]
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 03 Feb 2023 10:21:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Hi Keita,
Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
> Currenty, `LaTeX-insert-environment' doesn't indent the active region if
> the environment is in `LaTeX-indent-environment-list'.
Yes, this was also my conclusion after having a brief look.
> Could you try the attached patch?
Thanks, I tried and it works. Let's wait and see if it also works for
Berthold.
Best, Arash
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 03 Feb 2023 14:57:01 GMT)
Full text and
rfc822 format available.
Message #56 received at 48518 <at> debbugs.gnu.org (full text, mbox):
hey guys! thanks for checking out and trying to fix it!
i tried the patch and it seems like everything works fine now! thanks!
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 03 Feb 2023 16:16:02 GMT)
Full text and
rfc822 format available.
Message #59 received at 48518 <at> debbugs.gnu.org (full text, mbox):
>>>>> Berthold Lorke <berthold <at> lorke.de> writes:
> hey guys! thanks for checking out and trying to fix it!
> i tried the patch and it seems like everything works fine now! thanks!
Thanks for checking. Sorry for not being carefull enough to fix
bug#28382[1] last year. :-(
To developers:
I'm a bit unsure whether there is regression with this fix or not. Do
you think it should be delayed until the new tarball release is out?
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28382
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Fri, 03 Feb 2023 17:14:02 GMT)
Full text and
rfc822 format available.
Message #62 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
> To developers:
> I'm a bit unsure whether there is regression with this fix or not. Do
> you think it should be delayed until the new tarball release is out?
My tendency is to install the change. It seems to fix a bug, and fixes
before release are OK, at least in my book :-)
Best, Arash
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#48518
; Package
auctex
.
(Sat, 04 Feb 2023 06:28:02 GMT)
Full text and
rfc822 format available.
Message #65 received at 48518 <at> debbugs.gnu.org (full text, mbox):
Hi Arash,
>>>>> Arash Esbati <arash <at> gnu.org> writes:
> My tendency is to install the change. It seems to fix a bug, and fixes
> before release are OK, at least in my book :-)
Alright, I've pushed the commit.
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 04 Mar 2023 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 108 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.