diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 939553608ba..70e5ade2eee 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-09-01 Fabián Ezequiel Gallina <fgallina@gnu.org> + + * progmodes/python.el (python-indent-post-self-insert-function): + Avoid electric colon at beginning-of-defun. (Bug#18228) + 2014-09-01 Glenn Morris <rgm@gnu.org> * tutorial.el (tutorial--display-changes): 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))))) |