help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove extra whitespace on a line


From: Markus Triska
Subject: Re: remove extra whitespace on a line
Date: Sat, 02 Dec 2006 13:15:33 +0100

"Herbert Euler" <address@hidden> writes:

> How about this?
>
> (defun just-one-space-in-current-line (&optional n)
>  (interactive "*p")
>  (save-excursion
>    (save-restriction
>      (narrow-to-region (line-beginning-position)
>                       (line-end-position))
>      (goto-char (point-min))
>      (while (re-search-forward "[ \t]" nil t)
>       (just-one-space n)))))

Or this:

(defun just-one-space-in-current-line (&optional n)
 (interactive "*p")
 (save-excursion
   (beginning-of-line)
   (while (re-search-forward "[ \t]" (line-end-position) t)
     (just-one-space n))))


All the best,
Markus Triska



reply via email to

[Prev in Thread] Current Thread [Next in Thread]