unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* I don't want Ctrl-Backspace to span different lines...
@ 2003-05-15 10:39 Jon
  2003-05-15 11:45 ` Kai Großjohann
  0 siblings, 1 reply; 4+ messages in thread
From: Jon @ 2003-05-15 10:39 UTC (permalink / raw)


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

At the moment, if the cursor is on the last word of a line, and I hit
Ctrl-Delete, it deletes that last word, the carriage-return, and the
first word on the next line...

I'd like it to just delete to the beginning / end of the current word.

I'm using Win-Emacs, with Glide, if that makes any difference...

Thanks,
Jon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I don't want Ctrl-Backspace to span different lines...
  2003-05-15 10:39 I don't want Ctrl-Backspace to span different lines Jon
@ 2003-05-15 11:45 ` Kai Großjohann
  2003-05-16  8:19   ` Jon
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Großjohann @ 2003-05-15 11:45 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I don't want Ctrl-Backspace to span different lines...
  2003-05-15 11:45 ` Kai Großjohann
@ 2003-05-16  8:19   ` Jon
  2003-05-17 19:52     ` Kai Großjohann
  0 siblings, 1 reply; 4+ messages in thread
From: Jon @ 2003-05-16  8:19 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I don't want Ctrl-Backspace to span different lines...
  2003-05-16  8:19   ` Jon
@ 2003-05-17 19:52     ` Kai Großjohann
  0 siblings, 0 replies; 4+ messages in thread
From: Kai Großjohann @ 2003-05-17 19:52 UTC (permalink / raw)


j_del_strother@hotmail.com (Jon) writes:

> Well, I don't have a clue about writing Lisp,

It's not difficult :-)

> but fortunately your samples worked perfectly.

Amazing.  I didn't test them.
-- 
This line is not blank.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-17 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-15 10:39 I don't want Ctrl-Backspace to span different lines Jon
2003-05-15 11:45 ` Kai Großjohann
2003-05-16  8:19   ` Jon
2003-05-17 19:52     ` Kai Großjohann

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