Hi,

I know that the matter has been discussed in the past (e.g., https://lists.gnu.org/archive/html/auctex/2012-01/msg00025.html), however looking at those past discussions I could not find a solution to my specific problem, so please take my apology in advance for re-opening the topic.

I am not interested in opinions on what one should use or the relative merits of hard wrap over soft wrap or viceversa. Independently of this (and even of my own preferences) I often need to cooperate with other people who use tools based on the soft wrap approach (e.g. TeXStudio or the online Overleaf editor) and follow their choices. Basically this means that I often need to use soft wrap too.

In Emacs, using soft wrap means disabling auto-fill, rewiring your brain so that you do not press "ESC q" mechanically, and enabling the visual-line-mode. Even with this you miss all the nice indentation that auctex provides, though. You can get a bit closer to it by enabling the adaptive-wrap-prefix-mode. This is more or less what I found in the previous exchanges.

However, I still miss one thing: the adaptive-wrap does not seem to understand braces. Hence, when some "macro argument" gets wrapped, it gets no indentation. For instance, I get

\section{This is a rather long section name that
gets wrapped}

and not

\section{This is a rather long section name that
  gets wrapped}

The same goes with \emph, \foreignlanguage, \textbf, etc. Particularly when things get nested it becomes a burden to check where the arguments end and whether the braces are matched.

So my question is: are auctex and adaptive-wrap-prefix-mode two completely independent packages, or is it possible for auctex to use its "understanding" of LaTeX to provide hints to adaptive-wrap-prefix-mode about the amount of spaces to use in the prefix for each soft wrapped line?

Thanks and best regards,

Sergio


Reply via email to