New proposed function doesn't do what I want
Rodney Sparapani
rsparapa at post.its.mcw.edu
Mon Aug 16 17:30:18 CEST 2004
>
> the found search-string is an empty string (= (match-beginning)
> (match-end)), so the COUNT argument will automatically be
> satisfied, cf.,
>
>(re-search-forward "" nil t 30)
>
> which will return the current point.
>
> the function removes the single blank lines because a single
> blank line satisfies the search conditions. I'd go for two
> explicit lines, and go to the beginning of the found regular
> expression in case I'm at the beginning of a non-blank line
> (`delete-blank-lines' will do nothing in that case):
>
>
>(defun ess-delete-blank-lines ()
> "Convert 2 or more lines of white space into one."
> (interactive)
> (save-excursion
> (goto-char (point-min))
> (save-match-data
> (while (search-forward-regexp "^[ \t]*\n[ \t]*\n" nil t)
> (goto-char (match-beginning 0))
> (delete-blank-lines)))))
>
>
>
>/Tom
Tom:
How the counting worked was what I was missing. Thanks.
Rodney Sparapani Medical College of Wisconsin
Sr. Biostatistician Patient Care & Outcomes Research
rsparapa at mcw.edu http://www.mcw.edu/pcor
Was 'Name That Tune' rigged? WWLD -- What Would Lombardi Do
More information about the ESS-help
mailing list