colonelpanic8 / multi-line

multi-line everything from function invocations and definitions to array and map literals in a wide variety of languages
56 stars 6 forks source link

evil-mode, Scan error: "Unbalanced parentheses", 21, 21 #13

Open duianto opened 3 years ago

duianto commented 3 years ago

In evil-mode when the cursor is on the first element. Then the first call to multi-line works as expected.

But it leaves the cursor to the left of the open bracket.

This means that the next call to multi-line results in the error message:

Scan error: "Unbalanced parentheses", 21, 21

Reproduction steps

In a python-mode buffer.

  1. With the cursor (vertical bar = |) on the first element:
    a = [|1, 2, 3]
  2. M-x multi-line results in:
    a = |[
    1, 2, 3,
    ]
  3. M-x multi-line again

Observed

Scan error: "Unbalanced parentheses", 21, 21

A possible solution

Maybe the cursor should stay on the first element:

a = [|1, 2, 3]
a = [
    |1, 2, 3,
]
a = [
    |1,
    2,
    3,
]

It works without evil-mode

It works as expected when evil-mode is disabled. Because the cursor stays to the right of the open bracket.

a = [|
    1, 2, 3,
]

System Info

multi-line-20170822.226 evil-20210220.2343 GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21

colonelpanic8 commented 1 year ago

@duianto thanks for the report. Does spacemacs change the behavior of sexp navigation functions?

duianto commented 1 year ago

I haven't used Emacs for a couple of years. I don't know if Spacemacs changes the sexp navigation functions.

From the System Info in the original post, the steps above seem to have been tested without Spacemacs, just Emacs, evil, and multi-line.

It would be better if a current Emacs user tested the reproduction steps to confirm that the error still occurs.