New proposed function doesn't do what I want

Stephen Eglen stephen at
Mon Aug 16 14:08:54 CEST 2004

hi Rodney,

As well as the code that Tom posted, have you seen the function 
delete-blank-lines bound to C-x C-o in Emacs?


C-x C-o runs the command delete-blank-lines
   which is an interactive compiled Lisp function in `simple'.

On blank line, delete all surrounding blank lines, leaving just one.
On isolated blank line, delete that one.
On nonblank line, delete any immediately following blank lines.

Rodney Sparapani writes:
 > Does anyone know why this function doesn't quite work?  I want to change all 
 > multiple blank lines into one blank line.
 > (defun ess-delete-blank-lines ()
 > "Convert 2 or more lines of white space into one.  This function
 > works as you might expect, except that it must be terminated by C-g
 > for some reason and it also removes single blank lines?!?"
 >     (interactive)
 >     (save-excursion
 > 	(goto-char (point-min))
 > 	(save-match-data
 > 	    (while (search-forward-regexp "^[ \t]*$" nil 'eof 2)
 > 		    (delete-blank-lines)))))
 > Rodney Sparapani              Medical College of Wisconsin
 > Sr. Biostatistician           Patient Care & Outcomes Research
 > rsparapa at    
 > Was 'Name That Tune' rigged?  WWLD -- What Would Lombardi Do
 > ______________________________________________
 > ESS-help at mailing list

More information about the ESS-help mailing list