Disable electric indent for python strings (Bug#29305)
* lisp/progmodes/python.el (python-indent-post-self-insert-function): Do nothing when point or beginning of line is in string.
This commit is contained in:
parent
35f1ed10e4
commit
946bb6d225
1 changed files with 5 additions and 1 deletions
|
@ -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,
|
If a line renders a paren alone, after adding a char before it,
|
||||||
the line will be re-indented automatically if needed."
|
the line will be re-indented automatically if needed."
|
||||||
(when (and electric-indent-mode
|
(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
|
(cond
|
||||||
;; Electric indent inside parens
|
;; Electric indent inside parens
|
||||||
((and
|
((and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue