%
%  batch_example.sl  : example batch editing using JED.
%
%  Usage: jed -batch filename -l ./batch_example.sl
%

%  This example truncates every line to 72 characters unless the line
%   has something in the first column.  This is useful for processing
%   FORTRAN files.

  bob();                               % goto the beginning of the buffer

  do
    {
       bol ();                         % goto beginning of the line
       if (0 == looking_at(" \t"))     % if no space or tab...
	 {
	    goto_column (72);
	    push_mark();               % begin region definition
	    eol();                     % goto end fo the line
	    del_region ();             % delete between mark and current point
	    trim ();                   % remove any excess whitespace
	 }
    }
  while (down(1));                     % repeat until end of buffer is reached

  save_buffer ();                      % this writes the file creating backup
  exit_jed ();


