[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I don't want Ctrl-Backspace to span different lines...
From: |
Jon |
Subject: |
Re: I don't want Ctrl-Backspace to span different lines... |
Date: |
16 May 2003 01:19:14 -0700 |
kai.grossjohann@gmx.net (Kai Großjohann) wrote in message
news:<84llx8whzi.fsf@lucy.is.informatik.uni-duisburg.de>...
> 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.
Well, I don't have a clue about writing Lisp, but fortunately your
samples worked perfectly.
Thanks for the help,
Jon