* * ALLPLUS.KEX * * This macro will issue an ALL command using the specified string target * parameter. If this target is followed by a number, N, then the macro also * displays the N lines above and below each selected line. The lines selected * by the ALL command are highlighted by the TAG command. * * Works with: * * KEDIT for Windows 1.5 * KEDIT 5.0 for DOS * KEDIT 5.0 for OS/2 * * To invoke the macro with SET IMPMACRO ON, enter something like this on the * KEDIT command line: * * allplus /hello/ 2 * * This will show all lines of the file containing "Hello" as well as the two * lines above and below each of these lines. The lines containing "Hello" will * be highlighted. * * An alternative would be to add the following in your KEDIT profile: * * if initial() then do * "define allplus.kex" * "set synonym all macro allplus" * end * * Restart KEDIT for Windows to execute your updated profile. This will set a * synonym for the ALL command so that when you issue an ALL command you actually * invoke the ALLPLUS macro. So the above example can be entered like this: * * all /hello/ 2 * * Notes: * * 1. If you issue the ALL command without the number of lines, * a normal ALL command is issued. * 2. You must specify an ending target delimiter on your ALL target * if you specify the number of lines. * (e.g., all/abc/ 2 .... not all/abc 2) * 3. By default, this macro highlights the original lines * selected by the ALL command. If you don't want this * to happen, comment out the TAG commands further down in the file. * 4. Note that CURLINE.6 instead of SELECT.1 is the extract * variable used to get the selection level of the focus line. * This is done for performance reasons. * 5. When you have finished using this macro, to unhighlight the * highlighted lines, type in the command line: TAG * * Original author: Sara Rogers, Mansfield Software Group, 4/93 * Last update: 8/96 by Kent Downs, MSG * * Get rid of any tagged lines 'scope all' 'tag' * Check for a numeric argument numlines = 0 if arg(1) = '' then do 'all' exit end * Test to see if the last argument is a numeric if datatype(word(arg(1),words(arg(1))))='NUM' & words(arg(1)) \= 1 then do numlines = word(arg(1), words(arg(1))) end_of_target=wordindex(arg(1), words(arg(1))) - 1 all_target = substr(arg(1), 1 ,end_of_target) end else do 'all' arg(1) exit end 'all' all_target if rc \= 0 then exit 'preserve' 'set wrap off' * Comment out the following 2 TAG lines if you don't want the lines selected by * your ALL statement to be highlighted to distinguish them from the extra lines * that will be added to either side of them. 'tag' 'tag select 1 1' nowline = line.1() 'top' 'scope all' do forever 'nomsg locate select 1' if rc \= 0 then leave workline = line.1() do numlines if line.1() > 1 then do 'up 1' if curline.6() < 1 then 'set select 2' end end ':'workline do numlines if line.1() < size.1() then do 'down 1' if curline.6() < 1 then 'set select 2' end end ':'workline end ':'nowline 'restore' 'set display 1 2'