[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backward-delete-word function (not backward-kill-word)
From: |
gg44060 |
Subject: |
Re: backward-delete-word function (not backward-kill-word) |
Date: |
26 Feb 2004 07:31:10 -0800 |
"Ehud Karni" wrote in message
news:<mailman.450.1077701652.340.help-gnu-emacs@gnu.org>...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 24 Feb 2004 21:19:44 -0800, gg44060(at)mail.com wrote:
> >
> > Is there a backward-delete-word funtion in emacs? It is very annoying
> > to have the words deleted during a find-file to show up on the kill
> > ring [snip ]
> >
> > I tried defining it as a keyboard macro using delete-region, but of
> > course it doesn't work in the mini-buffer.
>
> Just copy the `kill-word' and `backward-kill-word' functions (from
> simple.el) and replace the string "kill" by "delete" like this:
>
> (defun delete-word (arg)
> "Delete characters forward until encountering the end of a word.
> With argument, do this that many times."
> (interactive "p")
> (delete-region (point) (progn (forward-word arg) (point))))
>
> (defun backward-delete-word (arg)
> "Delete characters backward until encountering the end of a word.
> With argument, do this that many times."
> (interactive "p")
> (delete-word (- arg)))
>
> Assign (globally) keys to these functions and enjoy it.
Thanks! This is exactly what I was looking for and it works like a
charm! I hope to get the full sources installed for emacs once the
download site starts working again.