aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-12-31 16:27:20 -0300
committerFabián Ezequiel Gallina2012-12-31 16:27:20 -0300
commitdf4758b82ea93b13bb659fb0084a951b3bd19190 (patch)
tree1270df5a5d3cbf2eddb4f6550878ab5ad96169a6
parentbdcad781aaa4ea4b5e63e6118bddab964acf77e4 (diff)
downloademacs-df4758b82ea93b13bb659fb0084a951b3bd19190.tar.gz
emacs-df4758b82ea93b13bb659fb0084a951b3bd19190.zip
Backported revisions 2012-12-29T12:33:33Z!fgallina@gnu.org and 2012-12-29T12:57:49Z!fgallina@gnu.org from trunk.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/progmodes/python.el42
2 files changed, 40 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0bf336cfbe1..6a1ebc7e0e6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12012-12-31 Fabián Ezequiel Gallina <fgallina@cuca>
2
3 * progmodes/python.el: Support other commands triggering
4 python-indent-line so indentation cycling continues to work.
5 (python-indent-trigger-commands): New defcustom.
6 (python-indent-line): Use it.
7
82012-12-31 Fabián Ezequiel Gallina <fgallina@cuca>
9
10 * progmodes/python.el (python-shell-send-region): Add blank lines
11 for non sent code so backtraces remain correct.
12
12012-12-31 Andreas Schwab <schwab@linux-m68k.org> 132012-12-31 Andreas Schwab <schwab@linux-m68k.org>
2 14
3 * emacs-lisp/byte-run.el (defmacro): Don't lose final nil if 15 * emacs-lisp/byte-run.el (defmacro): Don't lose final nil if
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 98ba437d4ef..89b85e10351 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -597,6 +597,12 @@ It makes underscores and dots word constituent chars.")
597 :group 'python 597 :group 'python
598 :safe 'booleanp) 598 :safe 'booleanp)
599 599
600(defcustom python-indent-trigger-commands
601 '(indent-for-tab-command yas-expand yas/expand)
602 "Commands that might trigger a `python-indent-line' call."
603 :type '(repeat symbol)
604 :group 'python)
605
600(define-obsolete-variable-alias 606(define-obsolete-variable-alias
601 'python-indent 'python-indent-offset "24.3") 607 'python-indent 'python-indent-offset "24.3")
602 608
@@ -895,20 +901,21 @@ Uses the offset calculated in
895indicated by the variable `python-indent-levels' to set the 901indicated by the variable `python-indent-levels' to set the
896current indentation. 902current indentation.
897 903
898When the variable `last-command' is equal to 904When the variable `last-command' is equal to one of the symbols
899`indent-for-tab-command' or FORCE-TOGGLE is non-nil it cycles 905inside `python-indent-trigger-commands' or FORCE-TOGGLE is
900levels indicated in the variable `python-indent-levels' by 906non-nil it cycles levels indicated in the variable
901setting the current level in the variable 907`python-indent-levels' by setting the current level in the
902`python-indent-current-level'. 908variable `python-indent-current-level'.
903 909
904When the variable `last-command' is not equal to 910When the variable `last-command' is not equal to one of the
905`indent-for-tab-command' and FORCE-TOGGLE is nil it calculates 911symbols inside `python-indent-trigger-commands' and FORCE-TOGGLE
906possible indentation levels and saves it in the variable 912is nil it calculates possible indentation levels and saves it in
907`python-indent-levels'. Afterwards it sets the variable 913the variable `python-indent-levels'. Afterwards it sets the
908`python-indent-current-level' correctly so offset is equal 914variable `python-indent-current-level' correctly so offset is
909to (`nth' `python-indent-current-level' `python-indent-levels')" 915equal to (`nth' `python-indent-current-level'
916`python-indent-levels')"
910 (or 917 (or
911 (and (or (and (eq this-command 'indent-for-tab-command) 918 (and (or (and (memq this-command python-indent-trigger-commands)
912 (eq last-command this-command)) 919 (eq last-command this-command))
913 force-toggle) 920 force-toggle)
914 (not (equal python-indent-levels '(0))) 921 (not (equal python-indent-levels '(0)))
@@ -1998,7 +2005,14 @@ Returns the output. See `python-shell-send-string-no-output'."
1998(defun python-shell-send-region (start end) 2005(defun python-shell-send-region (start end)
1999 "Send the region delimited by START and END to inferior Python process." 2006 "Send the region delimited by START and END to inferior Python process."
2000 (interactive "r") 2007 (interactive "r")
2001 (python-shell-send-string (buffer-substring start end) nil t)) 2008 (python-shell-send-string
2009 (concat
2010 (let ((line-num (line-number-at-pos start)))
2011 ;; When sending a region, add blank lines for non sent code so
2012 ;; backtraces remain correct.
2013 (make-string (1- line-num) ?\n))
2014 (buffer-substring start end))
2015 nil t))
2002 2016
2003(defun python-shell-send-buffer (&optional arg) 2017(defun python-shell-send-buffer (&optional arg)
2004 "Send the entire buffer to inferior Python process. 2018 "Send the entire buffer to inferior Python process.