Subject: bug#45922: 27.1; Better auto-fill for strings in python-mode

From: Tomas Nordin <[email-masked]>
Date: Sun, 17 Jan 2021 12:58:38 +0100

Hello Акимжанчег

Акимжанчег <[email-masked]> writes:

> Date: Sun, 17 Jan 2021 03:45:31 +0600
> Message-ID: <[email-masked]>
> --text follows this line--
>
> Today I was making a program in Python for myself. One of the functions
> required me to pass a long string to it, so I did that. Auto-fill-mode
> got triggered when I pressed the space bar and the string was split from
> this:
> ```
> matrix = self.getprop("Coordinate Transformation Matrix").split(", ")
> ```
> To this:
> ```
> matrix = self.getprop("Coordinate Transformation
>                                   Matrix").split(", ")
> ```
> After that, I saw `SyntaxError: EOL while scanning string literal'.
> This can be fixed with two different methods:
> 1. Adding a `+' between the strings, so that it looks like
> ```
> matrix = self.getprop("Coordinate Transformation"
>                      +"Matrix").split(", ")
> ```
> 2. Dividing the string to 2 separate strings:
> ```
> matrix = self.getprop("Coordinate Transformation"
>                       "Matrix").split(", ")

>From the recepie it would seem like fill-column is set to something low.
But probably you have some indentation there prior to 'matrix = ...'?

I don't think there is something in python mode that do what you are
suggesting as of now. For curiosity, do you see this kind of support in
other editors?

nit: the 2 suggestions would loose a space in the string