From: Greg Bognar <greg.bognar@gmail.com>
Subject: Re: remove extra whitespace on a line
Date: Sat, 02 Dec 2006 12:40:43 -0500 [thread overview]
Message-ID: <pan.2006.12.02.17.40.42.337256@gmail.com> (raw)
In-Reply-To: mailman.1428.1165064915.2155.help-gnu-emacs@gnu.org
On Sat, 02 Dec 2006 13:55:42 +0100, David Hansen wrote:
> On Sat, 02 Dec 2006 13:15:33 +0100 Markus Triska wrote:
>
>> "Herbert Euler" <herberteuler@hotmail.com> 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))))
>
> Both will convert two (or more) spaces after the end of a sentence into
> one space. Narrowing and filling seems to be the right way to me.
>
> David
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
(line-beginning-position) (line-end-position)))))
next prev parent reply other threads:[~2006-12-02 17:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1421.1165042886.2155.help-gnu-emacs@gnu.org>
2006-12-02 12:15 ` remove extra whitespace on a line Markus Triska
2006-12-02 12:55 ` David Hansen
[not found] ` <mailman.1428.1165064915.2155.help-gnu-emacs@gnu.org>
2006-12-02 17:40 ` Greg Bognar [this message]
2006-12-02 17:58 ` Markus Triska
2006-12-02 19:49 ` David Hansen
2006-12-02 20:52 ` Dieter Wilhelm
2006-12-02 6:27 Greg Bognar
2006-12-02 6:46 ` Chris Menzel
2006-12-02 7:01 ` Herbert Euler
2006-12-02 7:02 ` Eric Hanchrow
2006-12-02 8:43 ` Dieter Wilhelm
2006-12-02 13:50 ` Perry Smith
[not found] ` <mailman.1429.1165067469.2155.help-gnu-emacs@gnu.org>
2006-12-02 15:26 ` B. T. Raven
2006-12-02 8:20 ` roodwriter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pan.2006.12.02.17.40.42.337256@gmail.com \
--to=greg.bognar@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).