auctex
[Top][All Lists]

## Re: Indenting the code written in square brackets as optional parameters

 From: Ikumi Keita Subject: Re: Indenting the code written in square brackets as optional parameters Date: Sat, 05 Mar 2022 12:59:05 +0900

Hi Arash,

>>>>> Arash Esbati <arash@gnu.org> writes:
> Does your proposal deal with cases where you only have an opening
> bracket?

Hmm, it doesn't seem to do so according to experiment.

>  I mean something like this which is valid LaTeX code:
> \documentclass[a4paper]{article}
> \begin{document}

> Text {%
>   this is indented and we trust that a closing \} will come.%
> }

> Text [%
> Do we have the same level of confidence for [?
> \end{document}

Well, isn't it almost impossible? AUCTeX cannot know whether the author
intends to insert closing "]" later but hasn't done that yet, or "]" is
to be really missing when the document is complete. In general,
indentation always have to be done depending only on the context which
comes before the target line.

I feel that it isn't worth discriminating whether a leading "[" is
a delimiter of optional argument for a macro/environment or a part of
ordinary text. How about introducing a new user option to determine
whether indentation inside "[]" should be done or not?

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine