- Subject: Re: [Jed-users-l] Stripping line endings
- From: Guenter Milde <milde@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Jan 2011 14:31:45 +0100
On 12.01.11, Thei Wijnen wrote:
> Hi,
> There is a builtin function "trim_buffer" and also "trim_whitespace"
> that can do the job for you.
However, trim_buffer() also reduces two consecutive blank line to one,
which might not be desired. 
I therefore defined in my local gmisc.sl:
% Trim buffer but keep multiple blank lines:
public define trim_buffer_lines()
{
   % remove whitespace at end of lines
   push_spot_bob();
   do {
      eol_trim();
   }
   while (down_1());
   % remove empty lines at end of buffer
   eob();
   do {
      go_left_1();
      if (bolp() and eolp())
	 del();
   }
   while (bolp());
   pop_spot();
   !if (BATCH) message ("done.");
}
Günter
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l
  [2011 date index]
  [2011 thread index]
  
  [Thread Prev] [Thread Next]
      
  [Date Prev] [Date Next]