Malabarba / aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
850 stars 36 forks source link

Bogus "Unbalanced parentheses" error after indentation #153

Closed accforbugreports closed 2 years ago

accforbugreports commented 2 years ago

There is a discussion of the a problem on Emacs help:

https://lists.gnu.org/archive/html/help-gnu-emacs/2022-01/msg00148.html

Turns out the problem can only be replicated when aggressive indent is on.

Steps:

  1. Open a new empty elisp file, e.g. test.el
  2. Make sure aggressive indent mode is on
  3. Download the attached file example.txt
  4. Open it and copy the whole contents to the clipboard
  5. Go to the empty elisp file and paste the text into it
  6. the example file contains a huge lisp expression with an indentation error in it, so when you paste it into a lisp buffer with aggressive indent on, aggressive indent corrects the indentation which is good
  7. you are at the end of the expression, press C-M-b that is backward-sexp
  8. You get the "Unbalanced parentheses" error though the expression is balanced. You can check it by going to the beginning of the file and pressing C-M-f. If you step into the vector that is at the end before ] character and keep pressing C-M-b, you can find the problematic point. There the syntax highlight is mixed up. This only happens with aggressive indent on.

Tested with Emacs 27.1

accforbugreports commented 2 years ago

Does your code do something extra with syntax or font locking which could explain this?

accforbugreports commented 2 years ago

The problem went away by upgrading to a newer version.