aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-05-17 00:03:42 -0300
committerFabián Ezequiel Gallina2012-05-17 00:03:42 -0300
commitcd05d2a6b0a1b94ae88b0f1acc45bb857d0c9e86 (patch)
treea08bf2c1b1b6a71babb289dcb227a27700b0fa4f /lisp/progmodes/python.el
parentcd7ab092997474f7abba8bff2e0c5df888011ed7 (diff)
downloademacs-cd05d2a6b0a1b94ae88b0f1acc45bb857d0c9e86.tar.gz
emacs-cd05d2a6b0a1b94ae88b0f1acc45bb857d0c9e86.zip
Enhancements to `python-indent-post-self-insert-function'
Fixed case where the paren base indentation is not 0.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el19
1 files changed, 8 insertions, 11 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index e549c477233..4e9c045d184 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -990,19 +990,16 @@ This function is intended to be added to the
990adding a char before it, the line will be re-indented 990adding a char before it, the line will be re-indented
991automatically if needed." 991automatically if needed."
992 (when (and (eq (char-before) last-command-event) 992 (when (and (eq (char-before) last-command-event)
993 (= (current-indentation) 0)
994 (not (bolp)) 993 (not (bolp))
995 (memq (char-after) '(?\) ?\] ?\}))) 994 (memq (char-after) '(?\) ?\] ?\})))
996 (let ((indentation (save-excursion 995 (save-excursion
997 ;; If after going to the beginning of line the point 996 (goto-char (line-beginning-position))
998 ;; is still inside a paren it's ok to do the trick 997 ;; If after going to the beginning of line the point
999 (goto-char (line-beginning-position)) 998 ;; is still inside a paren it's ok to do the trick
1000 (when (python-info-ppss-context 'paren) 999 (when (python-info-ppss-context 'paren)
1001 (python-indent-calculate-indentation))))) 1000 (let ((indentation (python-indent-calculate-indentation)))
1002 (when (and indentation 1001 (when (< (current-indentation) indentation)
1003 (< (current-indentation) indentation)) 1002 (indent-line-to indentation)))))))
1004 (save-excursion
1005 (indent-line-to indentation))))))
1006 1003
1007 1004
1008;;; Navigation 1005;;; Navigation