Hi Ruiyang, >>>>> Ruiyang Wu <ywwr...@gmail.com> writes: > Currently, using "LaTeX-fill-paragraph” when point is in latex > preamble will cause unintended result, e.g., merging multiple > “\usepackage” commands into one line. IMHO, preamble should not be > filled just like those in the "LaTeX-indent-environment-list”. Is it > possible to make "LaTeX-fill-paragraph” skip preamble by default?
There was once a similar suggestion before[1], but didn't get attention at that time. :-( I think there are at least two difficulties for this idea. (1) `LaTeX-fill-paragraph' is called repeatedly in `LaTeX-fill-region', which is called from most of `LaTeX-fill-*' functions. Thus it can slow down the family if `LaTeX-fill-paragraph' checks every time whether the point is in preamble or not. (2) Even in preamble, users still want filling inside some arguments, say, \newcommand and \newenvironment. My preliminary idea to address (1) is either to add an optional argument to `LaTeX-fill-paragraph' which is non-nil only when called interactively, or to make a new function `LaTeX-fill-paragraph-interactive' and assign it in the keymap instead of `LaTeX-fill-paragraph'. In either way, we can check the preamble just once only when called interactively. However, I don't have a good idea to work consistently with the issue (2) yet. Does anyone see a good solution? Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30704