[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why not allow an argument to just-one-space?
From: |
Dan Jacobson |
Subject: |
Re: why not allow an argument to just-one-space? |
Date: |
Thu, 13 Jan 2005 07:29:48 +0800 |
OK
>>>>> "rms" == Richard Stallman <rms@gnu.org> writes:
rms> Does this do the job well?
rms> (defun just-one-space (n)
rms> "Delete all spaces and tabs around point, leaving one space (or N
spaces)."
rms> (interactive "*p")
rms> (let ((orig-pos (point)))
rms> (skip-chars-backward " \t")
rms> (constrain-to-field nil orig-pos)
rms> (dotimes (i n)
rms> (if (= (following-char) ?\ )
rms> (forward-char 1)
rms> (insert ?\ )))
rms> (delete-region
rms> (point)
rms> (progn
rms> (skip-chars-forward " \t")
rms> (constrain-to-field nil orig-pos t)))))