I'm writing a Python script in Emacs and have activated Auto-Fill minor mode with M-x auto-fill-mode
. An issue I always seem to come across is that this fill mode tends to break quoted strings across multiple lines without making any compensating adjustments, resulting in an error when the script is run.
For example:
print 'the quick brown fox jumped over the lazy dog and
then did something else'
which results in SyntaxError: EOL while scanning string literal
when run.
Is there a fill mode in Emacs that is Python "string literal aware" and automatically makes for example one of the line continuation/related adjustments discussed in Python style - line continuation with strings?, rather than naively splitting the string inducing an error?