home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 19759 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.2 KB  |  41 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!gatech!hubcap!rsimms
  3. From: rsimms@hubcap.clemson.edu (Robert Simms)
  4. Subject: TPU:  proc to delete trailing spaces
  5. Message-ID: <1992Dec23.062138.3034@hubcap.clemson.edu>
  6. Keywords: tpu procedure
  7. Organization: Clemson University
  8. Date: Wed, 23 Dec 1992 06:21:38 GMT
  9. Lines: 30
  10.  
  11. Together with a friend, I came up with the following procedure
  12. that I keep in my tpu$command file:
  13.  
  14. procedure eve_erase_trailing_spaces
  15.    local count, kill_range;
  16.    count := 0;
  17.    loop exitif 0 = search_quietly ( (span(" ")@ kill_range) & line_end,
  18.                         forward);
  19.         position (kill_range);
  20.         erase (kill_range);
  21.         count := count +1;
  22.    endloop;
  23.    if count = 0
  24.    then
  25.       message('No trailing spaces found.');
  26.    else
  27.       message('Trailing spaces removed from '+str(count)+' lines.');
  28.    endif;
  29. endprocedure;
  30.  
  31.  
  32. I also assign it to the Ctrl-P key for easy execution:
  33.  
  34. define_key ('eve_erase_trailing_spaces'    ,CTRL_P_KEY);
  35.  
  36.                         - Rob
  37. -- 
  38. Robert Simms                             |           rsimms@hubcap.clemson.edu
  39. Department of Math Sciences              |       or  rsimms@gemini.clemson.edu
  40. Clemson University, Clemson, SC 29634    |       or  rsimms@math.clemson.edu
  41.