Subject: 25.3; Bad indentation in LaTeX-mode with unmatched square brackets.

From: Harvey Stein <[email-masked]>
Date: Tue, 19 Sep 2017 13:18:05 -0400

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from 'emacs -Q':

Start emacs.

Edit a new LaTeX file, like foo.tex

When you type the following, you get the indentation as shown:

This is an example of bad indentation in LaTeX-mode when half open
intervals are used in mathematics, such as $[-3, 5)$.

  LaTeX-mode insists on indenting everything after the above text.

  It doesn't stop indenting until seeing a closing square bracket, or
  until an unindented line is forcibly added.

  % Commenting out a closing bracket doesn't help]

  Hitting return on an unindented line causes it to get indented.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    'bt full' and 'xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/25.3/etc/DEBUG.

In GNU Emacs 25.3.1 (x86_64-unknown-cygwin)
 of 2017-09-11 built on desktop-new
Configured using:
 'configure
 --srcdir=/home/kbrown/src/cygemacs/emacs-25.3-1.x86_64/src/emacs-25.3
 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc
 --docdir=/usr/share/doc/emacs --htmldir=/usr/share/doc/emacs/html -C
 --with-x=no 'CFLAGS=-ggdb -O2 -pipe -Wimplicit-function-declaration
 -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-25.3-1.x86_64/build=/usr/sr\
c/debug/emacs-25.3-1
 -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-25.3-1.x86_64/src/emacs-25.\
3=/usr/src/debug/emacs-25.3-1'
 CPPFLAGS= LDFLAGS='

Configured features:
JPEG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: LaTeX

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
C-x C-g is undefined
foo.tex has auto save data; consider M-x recover-this-file
(New file)
Mark set
Auto-saving...done
completing-read-default: Command attempted to use minibuffer while in
minibuffe\
r
No docstring slot for tex-start-shell

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils tex-mode compile tool-bar
shell pcomplete comint regexp-opt ansi-color ring latexenc term/xterm
xterm time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind gfilenotify multi-tty
make-network-process emacs)

Memory information:
((conses 16 95831 4033)
 (symbols 48 19729 0)
 (miscs 40 50 110)
 (strings 32 17693 5402)
 (string-bytes 1 515296)
 (vectors 16 11041)
 (vector-slots 8 391743 6251)
 (floats 8 156 123)
 (intervals 56 223 0)
 (buffers 976 20))