From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:03:42 +0000 (-0300) Subject: Enhancements to `python-indent-post-self-insert-function' X-Git-Tag: emacs-24.2.90~1199^2~489 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cd05d2a6b0a1b94ae88b0f1acc45bb857d0c9e86;p=emacs.git Enhancements to `python-indent-post-self-insert-function' Fixed case where the paren base indentation is not 0. --- 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 adding a char before it, the line will be re-indented automatically if needed." (when (and (eq (char-before) last-command-event) - (= (current-indentation) 0) (not (bolp)) (memq (char-after) '(?\) ?\] ?\}))) - (let ((indentation (save-excursion - ;; If after going to the beginning of line the point - ;; is still inside a paren it's ok to do the trick - (goto-char (line-beginning-position)) - (when (python-info-ppss-context 'paren) - (python-indent-calculate-indentation))))) - (when (and indentation - (< (current-indentation) indentation)) - (save-excursion - (indent-line-to indentation)))))) + (save-excursion + (goto-char (line-beginning-position)) + ;; If after going to the beginning of line the point + ;; is still inside a paren it's ok to do the trick + (when (python-info-ppss-context 'paren) + (let ((indentation (python-indent-calculate-indentation))) + (when (< (current-indentation) indentation) + (indent-line-to indentation))))))) ;;; Navigation