colonelpanic8 / multi-line

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

"Unbalanced parentheses" in python-mode #9

Closed dinojr closed 5 years ago

dinojr commented 5 years ago

I cannot get multi-line to work in python-mode: I always get errors like: up-list: Scan error: "Unbalanced parentheses", 218, 22768 when running multi-line on a long line.

colonelpanic8 commented 5 years ago

where are you placing the cursor. You need to put the cursor inside of the expression object that you are trying to multi-line

dinojr commented 5 years ago

In a python buffer, with only: # This is a very long comment line that I expect to be split when running M-x multi-line with point in "multi" for instance.

colonelpanic8 commented 5 years ago

@dinojr you can use fill-paragraph which is default emacs command for that.

See: http://johnlaudun.org/20080321-word-wrap-filling-in-emacs/

multi-line is for multi-lining code expressions that require indentation etc.

dinojr commented 5 years ago

ok, I've been directed to your package when searching for a way to enforce cutting of long lines in python for instance. fill-paragraph will do for comments but not for long code lines like: os.environ['PATH'] = '/usr/local/texlive/current/bin/x86_64-linux:' + os.environ['PATH'] where the line-breaks from fill-paragraph will break the code.

colonelpanic8 commented 5 years ago

@dinojr multi-line aims to only touch whitespace. How exactly would you expect the example you gave to be multi-lined.

multi-line works mostly on comma delimted expressions in python, e.g.:

my_long_line_function_with_long_name(anarg1, afun(arg1, arg2), stuff, more_stuff)

In this case, you can put the cursor after the starting parenthesis, and multi-line will handle this automatically.