jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: how to indent a region multiple times in python-mode


Hello Joachim,

Joachim Schmitz <js@xxxxxxxxxxxxx> wrote:
> in python-mode I can indent a region for one tab, how to shift the 
> region multiple tabs ? If I use the repeat command before the shift, I get:

Try this patch:
#v+
Index: svn/jed-upstream/lib/pymode.sl
===================================================================
--- svn/jed-upstream/lib/pymode.sl	(Revision 36)
+++ svn/jed-upstream/lib/pymode.sl	(Arbeitskopie)
@@ -260,18 +260,22 @@
 
 define py_shift_line_right()
 {
+   variable times = prefix_argument(1);
    bol_skip_white();
+   loop (times)
    whitespace(Py_Indent_Level);
 }
 
 define py_shift_region_right()
 {
+   variable times = prefix_argument(1);
    variable n;
    check_region (1);		       %  spot_pushed, now at end of region
    n = what_line ();
    pop_mark_1 ();
    loop (n - what_line ())
      {
+        set_prefix_argument(times);
 	py_shift_line_right();
 	go_down_1 ();
      }
@@ -291,16 +295,18 @@
 
 define py_shift_line_left()
 {
+   variable times = prefix_argument(1);
    bol_skip_white();
    if (what_column() > Py_Indent_Level) {
       push_mark();
-      goto_column(what_column() - Py_Indent_Level);
+      goto_column(what_column() - times * Py_Indent_Level);
       del_region();
    }
 }
 
 define py_shift_region_left()
 {
+   variable times = prefix_argument(1);
    variable n;
    
    check_region (1);
@@ -308,6 +314,7 @@
    pop_mark_1 ();
    loop (n - what_line ())
      {
+        set_prefix_argument(times);
 	py_shift_line_left();
 	go_down_1 ();
      }
#v-

^[3^C> should increase the indent level by 3 steps.

Bye, Jörg.
-- 
"UNIX was not designed to stop people from doing stupid things, because
 that would also stop them from doing clever things."
         -- Doug Gwyn

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]