diff options
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d4226e5ce7b..9e09bfc5941 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1257,7 +1257,11 @@ This function is intended to be added to `post-self-insert-hook.' If a line renders a paren alone, after adding a char before it, the line will be re-indented automatically if needed." (when (and electric-indent-mode - (eq (char-before) last-command-event)) + (eq (char-before) last-command-event) + (not (python-syntax-context 'string)) + (save-excursion + (beginning-of-line) + (not (python-syntax-context 'string (syntax-ppss))))) (cond ;; Electric indent inside parens ((and |