From: Sebastian Urban <mrsebastianurban@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 36358@debbugs.gnu.org
Subject: bug#36358: Indentation of not matched braces in latex-mode
Date: Thu, 27 Jun 2019 10:53:12 +0200 [thread overview]
Message-ID: <cd781089-08e2-3d1c-5dac-bd6890ea2d92@gmail.com> (raw)
In-Reply-To: <jwvpnn0sbw1.fsf-monnier+emacs@gnu.org>
> 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.
next prev parent reply other threads:[~2019-06-27 8:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 16:08 bug#36358: Indentation of not matched braces in latex-mode Sebastian Urban
2019-06-24 23:22 ` Stefan Monnier
2019-06-25 7:30 ` Sebastian Urban
2019-06-25 14:53 ` Stefan Monnier
2019-06-26 7:46 ` Sebastian Urban
2019-06-26 13:49 ` Stefan Monnier
2019-06-27 8:53 ` Sebastian Urban [this message]
2019-06-29 20:08 ` Sebastian Urban
2019-06-29 21:02 ` Stefan Monnier
2020-07-09 17:18 ` Sebastian Urban
2019-07-05 15:20 ` Basil L. Contovounesios
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd781089-08e2-3d1c-5dac-bd6890ea2d92@gmail.com \
--to=mrsebastianurban@gmail.com \
--cc=36358@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.