summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-10-07 14:51:26 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-10-07 14:51:26 -0400
commit2abb4e656039e19e36bcee12ced22a45383ea156 (patch)
tree44df2dca83b2a4d99b35764766a671eda18cf6cf /lisp/progmodes/python.el
parentd2e0e79548df07e8e2f7a7cf2e5d9b353f547efd (diff)
downloademacs-2abb4e656039e19e36bcee12ced22a45383ea156.tar.gz
* lisp/electric.el (electric-indent-inhibit): New var.
(electric-indent-post-self-insert-function): Use it. * lisp/progmodes/python.el (python-mode): Set it.
Diffstat (limited to 'lisp/progmodes/python.el')
-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 5f919bf495f..ce727391ce8 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3544,6 +3544,8 @@ list is returned as is."
(reverse acc))))
+(defvar electric-indent-inhibit)
+
;;;###autoload
(define-derived-mode python-mode prog-mode "Python"
"Major mode for editing Python files.
@@ -3572,7 +3574,9 @@ if that value is non-nil."
(set (make-local-variable 'indent-line-function)
#'python-indent-line-function)
(set (make-local-variable 'indent-region-function) #'python-indent-region)
-
+ ;; Because indentation is not redundant, we cannot safely reindent code.
+ (setq-local electric-indent-inhibit t)
+
(set (make-local-variable 'paragraph-start) "\\s-*$")
(set (make-local-variable 'fill-paragraph-function)
'python-fill-paragraph)