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

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

Re: I don't want Ctrl-Backspace to span different lines...


From: Kai Großjohann
Subject: Re: I don't want Ctrl-Backspace to span different lines...
Date: Thu, 15 May 2003 13:45:53 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

j_del_strother@hotmail.com (Jon) writes:

> Is there any way to prevent Ctrl-Backspace & Ctrl-Delete from spanning
> lines?

You have to write Lisp code.  For example,

(defun jon-kill-word (n)
  "Kill N words or to end of line, whichever comes first."
  (interactive "p")
  (let ((eol (point-at-eol))
        (nwords (save-excursion (forward-word n) (point))))
    (kill-region (point) (min eol nwords))))

(defun jon-backward-kill-word (n)
  "Kill N words backward or to beginning of line, whichever comes first."
  (interactive "p")
  (let ((bol (point-at-bol))
        (nwords (save-excursion (backward-word n) (point))))
    (kill-region (point) (max (bol nwords)))))

If these commands do what you want, you can bind them to keys you like.
-- 
This line is not blank.


reply via email to

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