[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: remove extra whitespace on a line
From: |
David Hansen |
Subject: |
Re: remove extra whitespace on a line |
Date: |
Sat, 02 Dec 2006 20:49:59 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) |
On Sat, 02 Dec 2006 12:40:43 -0500 Greg Bognar wrote:
> So this is what I want, isn't it?
>
> (defun just-one-space-in-current-line ()
> (interactive)
> (save-excursion
> (save-restriction
> (narrow-to-region (line-beginning-position)
> (line-end-position))
> (goto-char (point-min))
> (canonically-space-region
He, nice to see that there is always something one didn't know
about Emacs.
With this command you can forget about the narrowing. It's
doing all you want (well nearly, you still have to mark the
line):
C-a C-SPC C-e M-x canonically-space-region
> (line-beginning-position) (line-end-position)))))
Or your code a bit compressed:
(defun just-one-space-in-current-line ()
(interactive)
(canonically-space-region (point-at-bol) (point-at-eol)))
David