aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorNoam Postavsky2017-11-19 09:00:43 -0500
committerNoam Postavsky2017-12-02 09:35:40 -0500
commit946bb6d2250ce81fc68ec0bca4e1bb79815f4a59 (patch)
treebf969307cdf4e3f2208f22520317d3510874a7bd /lisp
parent35f1ed10e464c105758994050edec05506a5dfb3 (diff)
downloademacs-946bb6d2250ce81fc68ec0bca4e1bb79815f4a59.tar.gz
emacs-946bb6d2250ce81fc68ec0bca4e1bb79815f4a59.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/python.el6
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.'
1257If a line renders a paren alone, after adding a char before it, 1257If a line renders a paren alone, after adding a char before it,
1258the line will be re-indented automatically if needed." 1258the line will be re-indented automatically if needed."
1259 (when (and electric-indent-mode 1259 (when (and electric-indent-mode
1260 (eq (char-before) last-command-event)) 1260 (eq (char-before) last-command-event)
1261 (not (python-syntax-context 'string))
1262 (save-excursion
1263 (beginning-of-line)
1264 (not (python-syntax-context 'string (syntax-ppss)))))
1261 (cond 1265 (cond
1262 ;; Electric indent inside parens 1266 ;; Electric indent inside parens
1263 ((and 1267 ((and