Subject: bug#25030: 25.1; Unexpected indentation and syntax-highlighting in `emacs-lisp-mode'

From: Klaus-Dieter Bauer <[email-masked]>
Date: Sat, 26 Nov 2016 00:12:03 +0100

Hello!

In `emacs-lisp-mode', the counting of the nesting level of forms seems
to be broken in some subtle way. Consider e.g.

    (form
     (
      ) WEIRD HIGHLIGHT
        x) ;; Unexepected Indentation

It looks like "WEIRD HIGHLIGHT" is wrongly highlighted as junk after a
surplus closing parenthesis, and the subsequent form is also weirdly
indented.

So this particular example is artificial, it occurred for me when I was
writing testing-code with in some personal emacs-lisp project:

    ;; Example from actual code (abbreviated)
    (ert-deftest expr--parser-rule-def-firsts ()
      (myert-test-results #'expr--parser-rule-def-firsts
        `("The `firsts' function doesn't yet enforce, that every rule
          must have a resolvable first."
          (((&def RuleA RuleB)
            (&def RuleB RuleA))) => WEIRD-HIGHLIGHT-HERE
            :WEIRD-INDENTATION-HERE)))

I confirmed the issue in Emacs 25.1.1 64bit (from Chocolatey), running
that same Emacs with "runemacs -q", and with Emacs 26.0.50.1
(self-compiled).

For reference I have attached an elisp file with examples and a
screenshot of how it looks on my system.

regards, Klaus

--------------------------------------------------

In GNU Emacs 25.1.1 (x86_64-w64-mingw32)
 of 2016-09-17 built on KAEL
Windowing system distributor 'Microsoft Corp.', version 10.0.14393
Configured using:
 'configure --prefix=/tmp/emacs --without-imagemagick 'CFLAGS=-O2
 -fomit-frame-pointer -g0''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: DEA
  locale-coding-system: cp1252

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

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 cl-loaddefs pcase
cl-lib mail-prsvr mail-utils vc-git diff-mode easymenu easy-mmode
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar 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
w32notify dbusbind w32 multi-tty make-network-process emacs)

Memory information:
((conses 16 94172 5940)
 (symbols 56 20219 0)
 (miscs 48 89 106)
 (strings 32 17676 3993)
 (string-bytes 1 489683)
 (vectors 16 12293)
 (vector-slots 8 433157 4526)
 (floats 8 164 100)
 (intervals 56 581 40)
 (buffers 976 20))

--=-=-=--