emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 946bb6d 2/5: Disable electric indent for python s


From: Noam Postavsky
Subject: [Emacs-diffs] emacs-26 946bb6d 2/5: Disable electric indent for python strings (Bug#29305)
Date: Sat, 2 Dec 2017 09:52:24 -0500 (EST)

branch: emacs-26
commit 946bb6d2250ce81fc68ec0bca4e1bb79815f4a59
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.
---
 lisp/progmodes/python.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index d4226e5..9e09bfc 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]