[Top][All Lists]

[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: Sun, 18 Apr 2021 18:05:34 -0300
User-agent: mu4e 1.4.15; emacs 27.2

On Sun, 18 Apr 2021 at 16:07, Tassilo Horn <tsdh@gnu.org> wrote:

Hi Tassilo,

Hi Gustavo,

Filling those comments within itemize and quote will not join those
lines, whereas outside the environments it does.

Hm, indeed.  But that doesn't actually seem to come from the commend
being inside an environment but from the comment being indented.

Despite that, shouldn't the contiguous lines be filled?

That's the question.  Given that long lines are still filled, I'm
tempted to say that contiguous short lines should also be joined. OTOH,
I wouldn't be surprised if that's a feature...

Oh, yeah, I've just checked the docs (info "(auctex) Filling"):

--8<---------------cut here---------------start------------->8---
Code comments are comments preceded by code or text in the same line.
Upon filling a region, code comments themselves will not get filled.
Filling is done from the start of the region to the line with the code
comment and continues after it.  In order to prevent overfull lines in
the source code, a linebreak will be inserted before the last
non-comment word by default.  This can be changed by customizing
'LaTeX-fill-break-before-code-comments'.  If you have overfull lines
with code comments you can fill those explicitely by calling
'LaTeX-fill-paragraph' or pressing 'M-q' with the cursor positioned on
them.  This will add linebreaks in the comment and indent subsequent
comment lines to the column of the comment in the first line of the code
comment.  In this special case 'M-q' only acts on the current line and
not on the whole paragraph.
--8<---------------cut here---------------end--------------->8---

So it seems like AUCTeX considers any comment not starting in column one
(zero?) as a code comment, and then it'll fill only that line and not
the complete comment paragraph.

Now the question is if whitespace qualifies as "code or text".  Most
probably it shouldn't but I'm not too sure.

Well, in this case, I do have an opinion: The lines should be joined, and indentation whitespace does not qualify as "code or text". That's the way it works elsewhere in Emacs, as far as I can tell.

Besides, not being able to fill comment paragraphs inside environments is a relevant (and arbitrary) limitation, I think. As a matter of fact, I have a good example. One of those things that belong to those "muscle memory workarounds on a not very conscious level", but now that I think of it, this is the reason. The situation is the following. When I have to translate a quote from a reference, which happens quite a lot since I'm not from an English speaking country, I translate the quote's text, but keep the original as a comment right below it, inside the environment. Now, there is no way to fill this commented paragraph properly. The semi-conscious workaround is the following: add a blank line between the translated and the original text; select the commented paragraph; uncomment it; select it again; fill it; navigate back; delete the blank line. All that instead of "M-q", and the result is still not good, because the filling was not done considering the two characters the comment takes, so that it still occasionally extrapolates fill-column in the end.

I've just tested this again, and it turns out this behavior is also dependent on `LaTeX-syntactic-comments'. If `LaTeX-syntactic-comments' is set to nil, the filling of the comment paragraph indented inside the quote environment does occur as expected (or, at least, as I'd expect it). In my view, this is enough evidence that the mentioned documentation paragraph should not be taken as meaning this is a feature, since whitespace is not being interpreted as "code or text" when `LaTeX-syntactic-comments' is nil, and that this should be seen as a bug related to `LaTeX-syntactic-comments'.

Best regards,

reply via email to

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