- Heres a macro that I am using a lot these days, called
"spotless". It's a varient of "clean" but it also reduces
multiple blank lines to a single blank line.
May be useful - should it be added to the standard macros ??
Add to your <user>.emf to use.
; Prepare to clean up file.
; Remember line & magic mode
set-variable #l0 $window-line
set-variable #l1 ¬ &bmod magic
1 buffer-mode "magic"
; Get rid of trailing white space on EOL
replace-string "[\t ]+$" ""
replace-string "[ ]+\t" "\t"
; Strip trailing blank lines.
!while &and &gre $window-line 1 &sequal @wc "\n"
; Reduce multiple blank lines to single blanks.
replace-string "\n\n\n" "\n\n"
!force search-forward "\n\n\n"
!until ¬ $status
; Clean up - restore buffer modes etc.
; Move back to starting line & restore original magic mode
!force goto-line #l0
-1 buffer-mode "magic"
ml-write "[Cleaned up buffer]"