Subject: Re: bug#69398: `LaTeX-fill-paragraph` behavior within indented environments

From: Ikumi Keita <[email-masked]>
Date: Sun, 03 Mar 2024 17:41:53 +0900

Hi Ruiyang,

>>>>> Ruiyang Wu <[email-masked]> writes:
> Hi there,
> When the point is on the first letter of a line inside an indented environment (e.g., itemize, proof, etc.), running `LaTeX-fill-paragraph` will move the point to the beginning of the line. Here is a MWE:

> \documentclass{article}

> \begin{document}
> \begin{itemize}
> \item In indented environments, when the point is at the first letter
>     of a line, running ``LaTeX-fill-paragraph'' will move the point to
>   the beginning of the line. Ideally, it should stay with the letter.
> \end{itemize}
> \end{document}

> 1. If the point is on the first “o” in the line immediately after “\item”, running `LaTeX-fill-paragraph` moves the point to column 0, while “o” is moved to column 2 because of the filling operation.
> 2. If the point is on the first “f” in the same line as above, the point stays on “f” after running `LaTeX-fill-paragraph` (both moved to column 3).

> I think it is better to have consistent point behavior as in scenario 2, because users probably want to continue editing after running `M-q’, and it is much more efficient if the point stays on the same letter before and after filling.

Sorry for late response. I confirmed what you reported (with fill-column
being 70) and had brief look at the relevant code. Unfortunately, the
code uses `save-excursion' to preserve the point, so it seems that
something very exceptional is happening. I'll try to figure out the
origin and fix it, but it can take a non trivial span of time. :-(

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW