jed-users mailing list

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

Re: pop_spot(0)


On Sun, Jul 06, 2003 at 10:52:38AM -0400, John E. Davis wrote:
> Dave Kuhlman <dkuhlman@xxxxxxxxxxxxxxx> wrote:
> >What I'd expect to be able to do is the following steps:
> >
> >  1. Set mark
> >  2. Move cursor
> >  3. Perform first operation, e.g. shift right
> >  4. Exchange point and mark
> >  5. Perform second operation on same region, e.g. shift right
> >      again
> 
> You can call "push_mark" twice in the first step.  However, I would
> use one of the narrow functions (narrow, or narrow_to_region):
> 
>   1.  push_mark ()
>   2.  Move cursor to define a region
>   3.  narrow_to_region ();
>   4.  Operate on region, e.g.,
>     
>          bob ();  % Goto top of narrowed region
> 	 do 
> 	   {
> 	      insert ("    ");  % shift line to right
> 	   }
> 	 while (down (1));      % goto next line
> 
> 	 % Do something else
> 	 bob ();
> 	 do 
> 	   {
> 	      do_something_else_to_line ();
> 	   }
> 	 while (down (1));      % goto next line
> 	 
> 	 % Replace all occurrences of foo in region with bar
> 	 bob ();
> 	 replace ("foo", "bar");
> 	 
>   5.  widen_region ();
> 

Ah. Enlightenment.  Following the above SLang code, here is an
example of a *keyboard* solution (in emacs mode):

    1. @-space -- set mark
    2. Move cursor -- region is now selected
    3. ^X-n -- narrow region
    4. ^X-h -- mark buffer (i.e. mark the narrowed region of the buffer)
    5. ^C-> -- shift right (in Python-mode) or do other operation
    6. Repeat steps 4 and 5 as necessary.
    7. ^X-w -- widen region

Lesson: -- Learn how to use and exploit narrow_region and
widen_region.

But, this grasshopper needs to study the code above from John for
more enlightenment.  Perhaps, I will be able to write an SLang
routine that saves some key strokes.

Thanks, John.

  - Dave

-- 
Dave Kuhlman
dkuhlman@xxxxxxxx
http://www.rexx.com/~dkuhlman

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


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