File: util.sl

package info (click to toggle)
jed 0.98.7-14
  • links: PTS
  • area: main
  • in suites: slink
  • size: 3,088 kB
  • ctags: 3,851
  • sloc: ansic: 29,315; makefile: 257; sh: 248
file content (32 lines) | stat: -rw-r--r-- 546 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%%
%%  utility functions which Must be available (e.g., autoload)
%%

%%
%%  A routine that trims the buffer by:  removing excess whitespace at the
%%  end of lines and removing excess newlines
%%

define trim_buffer()
{
   push_spot();
   bob();
   do
     {
	eol_trim(); bol();
	if (eolp())
	  {
	     go_down_1 ();
	     while (eol_trim(), bol(), 
		    eolp() and not(eobp())) del();
	  } 
     }
   while (down_1 ());

   bob(); eol_trim(); bol(); 
   if (eolp() and not(eobp ())) del();
   pop_spot();
   !if (BATCH) message ("done.");
}