I would like the "delete to end of word" command to delete the word, regardless of cursor position.
+4
A:
(defun my-kill-word ()
(interactive)
(backward-word)
(kill-word 1))
(global-set-key (kbd "M-d") 'my-kill-word)
Matthew Flaschen
2010-05-19 20:52:48
But what if you're at the beginning of the word? Then it will delete the previous word, won't it?
Thomas Kappler
2010-05-20 09:33:29
+1
A:
A better code could be:
(defun my-kill-word ()
(interactive)
(unless (looking-at "\\<")
(backward-word))
(kill-word 1))
(global-set-key (kbd "M-d") 'my-kill-word)
So we move backward only if we are not at the beginning of the word yet.
Rémi
2010-05-20 09:52:10
Thank you for this one. I've switched over to it. I'm enjoying my conversion to Emacs, but elisp is still gibberish.
Fletcher Moore
2010-05-20 14:03:42