emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111368: * progmodes/python.el: Suppo


From: Fabián Ezequiel Gallina
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111368: * progmodes/python.el: Support other commands triggering
Date: Sat, 29 Dec 2012 09:57:49 -0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111368
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Sat 2012-12-29 09:57:49 -0300
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-29 12:33:33 +0000
+++ b/lisp/ChangeLog    2012-12-29 12:57:49 +0000
@@ -1,5 +1,12 @@
 2012-12-29  Fabián Ezequiel Gallina  <address@hidden>
 
+       * 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.
+
+2012-12-29  Fabián Ezequiel Gallina  <address@hidden>
+
        * progmodes/python.el (python-shell-send-region): Add blank lines
        for non sent code so backtraces remain correct.
 

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2012-12-29 12:33:33 +0000
+++ b/lisp/progmodes/python.el  2012-12-29 12:57:49 +0000
@@ -607,6 +607,12 @@
   :group 'python
   :safe 'booleanp)
 
+(defcustom python-indent-trigger-commands
+  '(indent-for-tab-command yas-expand yas/expand)
+  "Commands that might trigger a `python-indent-line' call."
+  :type '(repeat symbol)
+  :group 'python)
+
 (define-obsolete-variable-alias
   'python-indent 'python-indent-offset "24.3")
 
@@ -905,20 +911,21 @@
 indicated by the variable `python-indent-levels' to set the
 current indentation.
 
-When the variable `last-command' is equal to
-`indent-for-tab-command' or FORCE-TOGGLE is non-nil it cycles
-levels indicated in the variable `python-indent-levels' by
-setting the current level in the variable
-`python-indent-current-level'.
+When the variable `last-command' is equal to one of the symbols
+inside `python-indent-trigger-commands' or FORCE-TOGGLE is
+non-nil it cycles levels indicated in the variable
+`python-indent-levels' by setting the current level in the
+variable `python-indent-current-level'.
 
-When the variable `last-command' is not equal to
-`indent-for-tab-command' and FORCE-TOGGLE is nil it calculates
-possible indentation levels and saves it in the variable
-`python-indent-levels'.  Afterwards it sets the variable
-`python-indent-current-level' correctly so offset is equal
-to (`nth' `python-indent-current-level' `python-indent-levels')"
+When the variable `last-command' is not equal to one of the
+symbols inside `python-indent-trigger-commands' and FORCE-TOGGLE
+is nil it calculates possible indentation levels and saves it in
+the variable `python-indent-levels'.  Afterwards it sets the
+variable `python-indent-current-level' correctly so offset is
+equal to (`nth' `python-indent-current-level'
+`python-indent-levels')"
   (or
-   (and (or (and (eq this-command 'indent-for-tab-command)
+   (and (or (and (memq this-command python-indent-trigger-commands)
                  (eq last-command this-command))
             force-toggle)
         (not (equal python-indent-levels '(0)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]