diff options
| author | Fabián Ezequiel Gallina | 2012-12-29 09:57:49 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-12-29 09:57:49 -0300 |
| commit | ccb1c17e8bf1aa0d21bddd9fa37154a120657f52 (patch) | |
| tree | 214f461e906c46adc43c49d80b221afd99feb113 | |
| parent | 16768034b209fe12a6408866ac31688604b97375 (diff) | |
| download | emacs-ccb1c17e8bf1aa0d21bddd9fa37154a120657f52.tar.gz emacs-ccb1c17e8bf1aa0d21bddd9fa37154a120657f52.zip | |
* progmodes/python.el: Support other commands triggering
python-indent-line so indentation cycling continues to work.
(python-indent-trigger-commands): New defcustom.
(python-indent-line): Use it.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 33 |
2 files changed, 27 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9a54639a30b..b79d174d35e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2012-12-29 Fabián Ezequiel Gallina <fgallina@cuca> | 1 | 2012-12-29 Fabián Ezequiel Gallina <fgallina@cuca> |
| 2 | 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 | |||
| 8 | 2012-12-29 Fabián Ezequiel Gallina <fgallina@cuca> | ||
| 9 | |||
| 3 | * progmodes/python.el (python-shell-send-region): Add blank lines | 10 | * progmodes/python.el (python-shell-send-region): Add blank lines |
| 4 | for non sent code so backtraces remain correct. | 11 | for non sent code so backtraces remain correct. |
| 5 | 12 | ||
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a427e95c037..54a657a2593 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -607,6 +607,12 @@ It makes underscores and dots word constituent chars.") | |||
| 607 | :group 'python | 607 | :group 'python |
| 608 | :safe 'booleanp) | 608 | :safe 'booleanp) |
| 609 | 609 | ||
| 610 | (defcustom python-indent-trigger-commands | ||
| 611 | '(indent-for-tab-command yas-expand yas/expand) | ||
| 612 | "Commands that might trigger a `python-indent-line' call." | ||
| 613 | :type '(repeat symbol) | ||
| 614 | :group 'python) | ||
| 615 | |||
| 610 | (define-obsolete-variable-alias | 616 | (define-obsolete-variable-alias |
| 611 | 'python-indent 'python-indent-offset "24.3") | 617 | 'python-indent 'python-indent-offset "24.3") |
| 612 | 618 | ||
| @@ -905,20 +911,21 @@ Uses the offset calculated in | |||
| 905 | indicated by the variable `python-indent-levels' to set the | 911 | indicated by the variable `python-indent-levels' to set the |
| 906 | current indentation. | 912 | current indentation. |
| 907 | 913 | ||
| 908 | When the variable `last-command' is equal to | 914 | When the variable `last-command' is equal to one of the symbols |
| 909 | `indent-for-tab-command' or FORCE-TOGGLE is non-nil it cycles | 915 | inside `python-indent-trigger-commands' or FORCE-TOGGLE is |
| 910 | levels indicated in the variable `python-indent-levels' by | 916 | non-nil it cycles levels indicated in the variable |
| 911 | setting the current level in the variable | 917 | `python-indent-levels' by setting the current level in the |
| 912 | `python-indent-current-level'. | 918 | variable `python-indent-current-level'. |
| 913 | 919 | ||
| 914 | When the variable `last-command' is not equal to | 920 | When the variable `last-command' is not equal to one of the |
| 915 | `indent-for-tab-command' and FORCE-TOGGLE is nil it calculates | 921 | symbols inside `python-indent-trigger-commands' and FORCE-TOGGLE |
| 916 | possible indentation levels and saves it in the variable | 922 | is nil it calculates possible indentation levels and saves it in |
| 917 | `python-indent-levels'. Afterwards it sets the variable | 923 | the variable `python-indent-levels'. Afterwards it sets the |
| 918 | `python-indent-current-level' correctly so offset is equal | 924 | variable `python-indent-current-level' correctly so offset is |
| 919 | to (`nth' `python-indent-current-level' `python-indent-levels')" | 925 | equal to (`nth' `python-indent-current-level' |
| 926 | `python-indent-levels')" | ||
| 920 | (or | 927 | (or |
| 921 | (and (or (and (eq this-command 'indent-for-tab-command) | 928 | (and (or (and (memq this-command python-indent-trigger-commands) |
| 922 | (eq last-command this-command)) | 929 | (eq last-command this-command)) |
| 923 | force-toggle) | 930 | force-toggle) |
| 924 | (not (equal python-indent-levels '(0))) | 931 | (not (equal python-indent-levels '(0))) |