diff options
author | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2014-09-01 19:51:46 -0300 |
---|---|---|
committer | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2014-09-01 19:51:46 -0300 |
commit | 0e4c8f1856c46900f9530977e5ac9f83ca13bbfd (patch) | |
tree | 529ec7bc3cad3c868e1662d3e8ff6e83c29323ce /lisp/progmodes/python.el | |
parent | ad5c82a8cc3f78172dc872c7fe3c6e774f50fe15 (diff) | |
download | emacs-0e4c8f1856c46900f9530977e5ac9f83ca13bbfd.tar.gz emacs-0e4c8f1856c46900f9530977e5ac9f83ca13bbfd.tar.bz2 emacs-0e4c8f1856c46900f9530977e5ac9f83ca13bbfd.zip |
* lisp/progmodes/python.el (python-indent-post-self-insert-function):
Avoid electric colon at beginning-of-defun.
* test/automated/python-tests.el:
(python-indent-electric-colon-1): New test. (Bug#18228)
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a51cff8529e..740dfee5870 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1155,9 +1155,15 @@ the line will be re-indented automatically if needed." ((and (eq ?: last-command-event) (memq ?: electric-indent-chars) (not current-prefix-arg) + ;; Trigger electric colon only at end of line (eolp) + ;; Avoid re-indenting on extra colon (not (equal ?: (char-before (1- (point))))) - (not (python-syntax-comment-or-string-p))) + (not (python-syntax-comment-or-string-p)) + ;; Never re-indent at beginning of defun + (not (save-excursion + (python-nav-beginning-of-statement) + (python-info-looking-at-beginning-of-defun)))) (python-indent-line))))) |