[comp.os.vms] rfi edit in line editing mode

kieffer%Ucnet.UNCA.AdhocNet.CA@UNCAEDU.BITNET (12/19/87)

Greetings,

I decided to automate some of my mail editing functions, and created a
number of definitions that will insert a paragraph containing name and
address at the end, etc, the usual things.
I ran into a problem though when I tried to  have a "> " placed in front
of the text to which I am replying.
I have associated a sequence of line editing commands to a sequence
of keystrokes like:
 define key gold control a as 'I> ^Z nl'
but it seems I cannot tell the command to repeat from begin:end, I can of
course use 100(I> ^Z nl), but then if there are only 10 lines of text, the
editor creates another 90. Not quite what I intended....

help! please

Rom Kieffer
University of Calgary
Calgary, Alberta
Canada

MCGUIRE@GRIN1.BITNET ("McGuire,Ed") (12/22/87)

> Date:         Fri, 18 Dec 87 11:50:17 MST
> From:         kieffer%Ucnet.UNCA.AdhocNet.CA%UNCAEDU.BITNET@CUNYVM.CUNY.EDU
> Subject:      rfi edit in line editing mode
>
> I decided to automate some of my mail editing functions, and created a
> number of definitions that will insert a paragraph containing name and
> address at the end, etc, the usual things.
> I ran into a problem though when I tried to  have a "> " placed in front
> of the text to which I am replying.
> I have associated a sequence of line editing commands to a sequence
> of keystrokes like:
>  define key gold control a as 'I> ^Z nl'
> but it seems I cannot tell the command to repeat from begin:end, I can of
> course use 100(I> ^Z nl), but then if there are only 10 lines of text, the
> editor creates another 90. Not quite what I intended....

One trick is to start from the end of the buffer instead of the beginning:

        DEFINE KEY GOLD CONTROL A AS 'BACK ER 100(-L I> ^Z -L)'

Now I'd better explain this:

BACK    direction = back-up;                    /* set EDT direction back-up  */
ER      pointer = end-of-buffer;                /* point at end of buffer     */
100(    repeat 100 {
-L              move-by-line (direction);       /* move up one line           */
I> ^Z           insert ('> ');                  /* insert `> '                */
-L)             move-by-line (direction)}       /* move to beginning of line  */

When you reach the top of the buffer, `-L' will generate an error and abort
the loop, just what you want.

Ed