[comp.os.vms] Trimming away trailing spaces

TOLLIVER%ORN.MFENET@NMFECC.ARPA (07/28/87)

Eve has a little-known line trimming function built right in.  Use it as
follows.
        1. Press the DO key
        2. At the prompt type: tpu eve$trim_buffer(current_buffer)
        3. Press the RETURN key
        4. Press ^Z to exit Eve
The new file will have been trimmed of trailing spaces.

You can also set up Eve so that it will automatically trim trailing spaces
from all modified files as it exits.
        1. Press the DO key
        2. At the prompt type: tpu eve$x_trimming := 1
        3. Make any small change so that Eve will know that the file has
        been modified--for example, insert and delete some character.
        4. Make any other editing changes you please
        5. Press ^Z to exit
The file will be trimmed of trailing spaces as Eve exits.

The command "eve$x_trimming := 1;" can be easily placed in a TPUINI.TPU
file that will automatically be executed each time Eve is started.  Then
all you have to do is make some change in the file and exit.  Trimming will
happen automatically as Eve exits.

Alternatively, you can put the command "eve$trim_buffer(current_buffer)"
in a TPUINI.TPU file so that all files will always be trimmed of any
trailing spaces each time Eve starts up.

With only slightly more effort, one can define a new Eve command, call it
TRIM BUFFER, for example, as follows:

        procedure eve_trim_buffer
        eve$trim_buffer(current_buffer);
        endprocedure

This can be put in a TPUINI.TPU file or built right in to the EVE section
file (see commands EXTEND TPU and SAVE EXTENDED TPU) so that all you have
to do is press DO, type TRIM BUFFER (or a unique abbreviation), and exit.

I once had a painfully slow DCL procedure to do this.  Then I had a long
and complicated Fortran program, using STR$TRIM.  But this is the easiest
method I know of to trim trailing spaces--and it's fast too.

John Tolliver (Tolliver%orn.mfenet@nmfecc.arpa)