bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Sebastian Urban
Subject: bug#36358: Indentation of not matched braces in latex-mode
Date: Thu, 27 Jun 2019 10:53:12 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

I don't understand the question.  AFAIK this discussion and the
patch I installed is independent from what happens to environments.

Sorry, for some reason I thought that `latex-noindent-environments'
was also added in this patch.

Idea: Maybe if its at the beginning of the line and there is no text
after `}' - indent?

Hmm... I can try something like that.

Perhaps to solve the problem, you only need to write code for `indent'
condition and put something like - otherwise => noindent.  In this
case there would be no need to define `noindent' as text before/after
or surrounded by text - one of this would indicate that brackets are
inside paragraph.  This way we would made two cases: if separated =>
indent, if inside paragraph => noindent.  Or do the opposite define
`noindent' and otherwise - indent.

If this would work, we wouldn't need `latex-noindent-commands'.  But
there are probably quite a few ``styles'' of how people write latex, so
tests will be needed.

Yes, of course, but I meant that it also does it for all commands.

So... this sounds like `tex-indent-basic'... maybe they limit the
range somehow later in the code.

I believe this was fixed a few hours later by Basil.
Do you still see it with the current code?

It's OK after the update.

... about declarations...

Hmm... that looks wrong indeed: will have to investigate, thanks.

The problem is that we have two constructs `\something{...}' and
`{\something...}' and if I understand correctly your patch after
reaching `{' moves back and compare word between `\' and `{' with the
list of `latex-noindent-commands' - if match then don't indent.  In
case of declaration, command is after `{' not before.

So, perhaps, how far it goes backward can be (already is?) limited to
SPC (& perhaps beginning of the line)?  Then if it won't find
backward, it should look forward again to SPC (& perhaps to EOL) and
compare word between `\' and SPC.

Another problem may arise from nested declarations.  As for them,
maybe add _second_ `\' as limit?  But the rest of declarations will be
ignored - or simply mention this nuisance in doc string.  Maybe look
for second `\' compare word, then to the next one `\' and compare,
until it'll find SPC instead of `\'.  Currently they indent by the
value of `tex-indent-basic' no mater how many of them is there.

Funny thing - currently (e26.2), each nested command adds value of
`tex-indent-basic' to the end value of indent, for example
(setq t-i-b 2):

\textbf{\textit{\textsc{hypertext links, including those to hypertext
      links, including those to external documents and URLs
      external}}} documents and URLs.

However, your patch works and adding any of them to commands list will
decrease indent by 2 (in this example), i.e. patch works for nested
commands.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]