GNU bug report logs - #74056
`LaTeX-insert-item' inserts comment characters if called from inside comment

Previous Next

Package: auctex;

Reported by: Vangelis Evangelou <evangelou <at> gmail.com>

Date: Mon, 28 Oct 2024 09:42:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Vangelis Evangelou <evangelou <at> gmail.com>
To: 74056 <at> debbugs.gnu.org
Subject: bug#74056: `LaTeX-insert-item' inserts comment characters if called from inside comment
Date: Mon, 28 Oct 2024 17:15:00 +0000
[Message part 1 (text/plain, inline)]
Correction: Instead of `LaTeX-newline' use `newline'. In my original
message I said to use `TeX-newline'. So the proposal is
(unless (string-match-p "^[[:blank:]]*$" (buffer-substring-no-properties
(line-beginning-position) (line-end-position))) (newline))


On Mon, 28 Oct 2024 at 09:40, Vangelis Evangelou <evangelou <at> gmail.com>
wrote:

> Hello.
>
> Consider the following latex snippet with the cursor position indicated by
> |:
>
> \begin{itemize}
> \item My 1st item %%% comment |
> \end{itemize}
>
> At that point call `LaTeX-insert-item' (M-RET) to get the following:
>
> \begin{itemize}
> \item My 1st item %%% comment
>   %%% \item |
> \end{itemize}
>
> while I would have expected
>
> \begin{itemize}
> \item My 1st item %%% comment
> \item |
> \end{itemize}
>
> I cannot think of a situation where the current version is desirable.
>
> This happens because `LaTeX-insert-item' inserts a new line using
> `LaTeX-newline' instead of `TeX-newline.
>
> In addition to the above, `LaTeX-insert-item' always inserts a new line
> unless the cursor is at the beginning of line:
>
> (unless (bolp) (LaTeX-newline))
>
> This is rarely the case. For example, if you enter a new line inside
> itemize, the line is indented. It would be better to replace the (bolp)
> check with a check that the line contains only whitespace characters. So my
> proposal is to replace the above line with
>
> (unless (string-match-p "^[[:blank:]]*$" (buffer-substring-no-properties
> (line-beginning-position) (line-end-position))) (TeX-newline))
>
[Message part 2 (text/html, inline)]

This bug report was last modified 277 days ago.

Previous Next


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