[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Deleting chunks of whitespace
From: |
Richard V. Molen |
Subject: |
Re: Deleting chunks of whitespace |
Date: |
18 Nov 2002 08:26:55 -0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
"Ehud Karni" <ehud@unix.mvs.co.il> writes:
> On 15 Nov 2002 13:08:48 -0800, rvmolen@bambecksystems.com (Richard V. Molen)
> wrote:
> >
> > This is behavior is similar to alternating between M-SPC & M-d
> > and then doing a C-k if at there's no more on the current line.
> > Two exceptions being the: 1. the cursor doesn't move (not a big
> > deal) 2. M-d would not cut all non-whitespace characters, but
> > only alphanumeric strings.
>
> I think this command will do what you want:
>
> (defun kill-to-non-blank ()
> "kill to 1st non blank (after blank) to right"
> (interactive "*")
> (kill-region (point) (progn (forward-to-non-blank) (point))))
>
> (defun forward-to-non-blank ()
> "go to 1st non blank (after blank) to right"
> (interactive)
> (if (re-search-forward "[ \t\n][^ \t\n]" (point-max) t)
> (backward-char 1)))
>
> I assign it to [C-delete] i.e.
> (define-key global-map '[C-delete] 'kill-to-non-blank)
> One hint: on some X-terminals the keypad delete is [C-kp-decimal].
Thank you Ehud, this works nicely and does 95% of what I want. And
it's done with simple, resuable functions.
The remaining 5% occurs at the end of the buffer when there is still a
word and maybe some extra newlines remaining. Of course, this doesn't
occur often and a couple of C-k's would clean it right up.
--
Richard V. Molen
Warning!!
Signature under construction, safety glasses required.
- Deleting chunks of whitespace, Moore, Mathew L, 2002/11/15
- Re: Deleting chunks of whitespace, Richard V. Molen, 2002/11/15
- Re: Deleting chunks of whitespace, Benjamin Rutt, 2002/11/15
- RE: Deleting chunks of whitespace, Moore, Mathew L, 2002/11/15
- Re: Deleting chunks of whitespace, Benjamin Lewis, 2002/11/15
- Re: Deleting chunks of whitespace, Richard V. Molen, 2002/11/15
- Re: Deleting chunks of whitespace, Benjamin Lewis, 2002/11/15
- Re: Deleting chunks of whitespace, Richard V. Molen, 2002/11/15
- Re: Deleting chunks of whitespace, Ehud Karni, 2002/11/16
- Message not available
- Re: Deleting chunks of whitespace,
Richard V. Molen <=
- Re: Deleting chunks of whitespace, Ehud Karni, 2002/11/18
- Message not available
- Re: Deleting chunks of whitespace, Richard V. Molen, 2002/11/18
Re: Deleting chunks of whitespace, Kai Großjohann, 2002/11/16