aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorEli Zaretskii2013-03-30 20:37:57 +0300
committerEli Zaretskii2013-03-30 20:37:57 +0300
commitf1aa11971a74b7b2fa0f5baaaaf21dfbd388de6b (patch)
tree48e20bfab4262d7171593d4ef98309ae717c1cb6 /lisp/progmodes/python.el
parent7c4026b6ad03974a55a175af17c8e76c61931b69 (diff)
parent119b2d43cc40759394cae256c0a38624cacbf776 (diff)
downloademacs-f1aa11971a74b7b2fa0f5baaaaf21dfbd388de6b.tar.gz
emacs-f1aa11971a74b7b2fa0f5baaaaf21dfbd388de6b.zip
Merge from trunk.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f0f67d01845..d1009534e49 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -638,6 +638,12 @@ It makes underscores and dots word constituent chars.")
638These make `python-indent-calculate-indentation' subtract the value of 638These make `python-indent-calculate-indentation' subtract the value of
639`python-indent-offset'.") 639`python-indent-offset'.")
640 640
641(defvar python-indent-block-enders '("return" "pass")
642 "List of words that mark the end of a block.
643These make `python-indent-calculate-indentation' subtract the
644value of `python-indent-offset' when `python-indent-context' is
645AFTER-LINE.")
646
641(defun python-indent-guess-indent-offset () 647(defun python-indent-guess-indent-offset ()
642 "Guess and set `python-indent-offset' for the current buffer." 648 "Guess and set `python-indent-offset' for the current buffer."
643 (interactive) 649 (interactive)
@@ -763,9 +769,13 @@ START is the buffer position where the sexp starts."
763 (save-excursion 769 (save-excursion
764 (goto-char context-start) 770 (goto-char context-start)
765 (current-indentation)) 771 (current-indentation))
766 (if (progn 772 (if (or (save-excursion
767 (back-to-indentation) 773 (back-to-indentation)
768 (looking-at (regexp-opt python-indent-dedenters))) 774 (looking-at (regexp-opt python-indent-dedenters)))
775 (save-excursion
776 (python-util-forward-comment -1)
777 (python-nav-beginning-of-statement)
778 (member (current-word) python-indent-block-enders)))
769 python-indent-offset 779 python-indent-offset
770 0))) 780 0)))
771 ;; When inside of a string, do nothing. just use the current 781 ;; When inside of a string, do nothing. just use the current