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

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

Re: Deleting chunks of whitespace


From: Ehud Karni
Subject: Re: Deleting chunks of whitespace
Date: Sat, 16 Nov 2002 17:58:27 +0200

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].

Ehud.


-- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry




reply via email to

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