Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ucbcad!ucbvax!GRIN1.BITNET!MCGUIRE From: MCGUIRE@GRIN1.BITNET ("McGuire,Ed") Newsgroups: comp.os.vms Subject: Re: rfi edit in line editing mode Message-ID: <8712230526.AA08018@ucbvax.Berkeley.EDU> Date: 21 Dec 87 17:28:30 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 32 > 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