Subject: bug#36358: Indentation of not matched braces in latex-mode

From: Sebastian Urban <[email-masked]>
Date: Wed, 26 Jun 2019 09:46:19 +0200

I really don't like the solution, because it'll force people to add
environments/commands they don't want to be indented and it may be
long list.

I may be wrong but do we need to include environments?  Shouldn't they
be indented by default?  I guess it depends on preferences and because
it costs nothing why not have it as well...  but then again as you
wrote (see quote below) "(...) the main distinction is whether the
command is used "within a paragraph" or not (...)", so we don't really
need environments.

> Thinking more about it, the main distinction is whether the command
> is used "within a paragraph" or not.  But I don't really know how to
> precisely characterize this notion of "within a paragraph".

This is the main problem of this bug, i.e. how to make text "flow"
better in paragraph (environments can be indented).  For now we can
populate variable '*-commands' with commands commonly used inside
paragraph, like the one I wrote in previous message.

Idea: Maybe if its at the beginning of the line and there is no text
after '}' - indent? And if it has text after OR before OR is
surrounded by it - noindet.  This would fit for things like 'section',
'emph' would be indented as well but it would not be inside paragraph
but as a separate being, so it can be indented.  I didn't check other
commands/env so there could be exceptions...

> It seems to indent by 2 regardless of the command, just like what
> you don't want.

Because this is the default value, and with setq we can change it to 0.

Also when I byte compiled tex-mode.el with your changes, there was a
warning about unused 'x' or something like that - could it be one of
'lambda (x)' in 'defcustom latex-noindent-environments'?

Also I think declarations doesn't work(1) or are mixed(2):
{\small Quisque ullamcorper placerat ipsum.  Cras nibh.  Morbi
   vel justo vitae lacus tincidunt ultrices.  Lorem ipsum dolor sit
   amet, consectetuer adipiscing elit.}

{\small\emph{Quisque ullamcorper placerat ipsum.  Cras nibh.  Morbi
vel justo vitae lacus tincidunt ultrices.}  Lorem ipsum dolor sit
   amet, consectetuer adipiscing elit.}