unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25030: 25.1; Unexpected indentation and syntax-highlighting in `emacs-lisp-mode'
@ 2016-11-25 23:12 Klaus-Dieter Bauer
  2016-11-27 20:38 ` Philipp Stephani
  0 siblings, 1 reply; 12+ messages in thread
From: Klaus-Dieter Bauer @ 2016-11-25 23:12 UTC (permalink / raw)
  To: 25030


[-- Attachment #1.1: Type: text/plain, Size: 3601 bytes --]

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))

--=-=-=--

[-- Attachment #1.2: Type: text/html, Size: 9421 bytes --]

[-- Attachment #2: emacs-indent-bug.el --]
[-- Type: application/octet-stream, Size: 817 bytes --]

;;; -*- mode: emacs-lisp; coding: utf-8-unix -*-

() => x ;; No weird coloring
(
 ) this is colored unexpectedly
;; indent is fine here

`(form
  ((() 
    ())) => 
    x);; Unexepected indentation, by two spaces too much.

(form
 (
  ) WEIRD HIGHLIGHT
    x) ;; Unexepected indentation in a different way.

`(form 
  (
   x) =>
   x) ;; Unexpected indentation in a different way


    ;; 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)))


) Here the coloring is probably intended.

[-- Attachment #3: emacs-indent-bug.png --]
[-- Type: image/png, Size: 44175 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-02-12  8:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-25 23:12 bug#25030: 25.1; Unexpected indentation and syntax-highlighting in `emacs-lisp-mode' Klaus-Dieter Bauer
2016-11-27 20:38 ` Philipp Stephani
2018-03-14  1:49   ` Noam Postavsky
2018-03-18 19:53   ` Andy Moreton
2018-03-18 21:32     ` Drew Adams
2018-03-19 23:53     ` Noam Postavsky
2018-03-20  0:23       ` Andy Moreton
2018-03-20  1:35         ` Drew Adams
2018-03-20  2:14           ` Noam Postavsky
2018-03-20 12:55             ` Andy Moreton
2018-03-22  2:38               ` Noam Postavsky
2022-02-12  8:54   ` bug#25030: elisp: highlighting of unexpected indentation should use separate face from highlight of error functions Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).