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

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 07 May 2022 18:56:51 +0200

Stefan Monnier <[email-masked]> writes:

>> The Python auto fill basically just calls `do-auto-fill', so I wondered
>> whether there was something simple to tell that function to not consider
>> any points where ppss-string-terminator is non-nil as a break point, but
>> apparently not?
>
> `fill-nobreak-predicate`?

Ah, yes, perfect.  With this, it works like the original bug reporter
wanted:

              (setq-local fill-nobreak-predicate
              (lambda ()
                (ppss-string-terminator (syntax-ppss))))

But this reminds me that auto-fill-mode in programming modes is a bad
idea in general: Even if it doesn't chop anything inside the string,
it'll still lead to invalid code.

So I think the answer to this bug report is really -- don't use
auto-fill in python-mode, and I'm closing it as a wontfix.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no