aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorGlenn Morris2013-03-30 09:55:47 -0700
committerGlenn Morris2013-03-30 09:55:47 -0700
commit8d3655be5a5c41b1f0a9985bcdb614693fce67e5 (patch)
treec213796b69a9d40c6563c211c20ea815754ad560 /lisp/progmodes/python.el
parent14a581695f7b9c70b8531a41a327a2e01f6125ba (diff)
parentb011a6e8011c51e09f28d528a541509c17d4eed0 (diff)
downloademacs-8d3655be5a5c41b1f0a9985bcdb614693fce67e5.tar.gz
emacs-8d3655be5a5c41b1f0a9985bcdb614693fce67e5.zip
Merge from emacs-24; up to 2012-12-26T16:22:18Z!michael.albinus@gmx.de
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