If you look at what M-backspace
calls using C-h
you see that it calls backward-kill-word
that function simply calls kill-word
with a negative argument. The kill-word
function is coded as:
(defun kill-word (arg)
"Kill characters forward until encountering the end of a word.
With argument ARG, do this that many times."
(interactive "p")
(kill-region (point) (progn (forward-word arg) (point))))
Als we een functie schrijven die hetzelfde doet met behulp van delete-regio
in plaats van kill-regio
, krijgen we het gewenste resultaat. Hier is onze nieuwe functie delete-word
:
(defun delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument ARG, do this that many times."
(interactive "p")
(delete-region (point) (progn (forward-word arg) (point))))
We kunnen nu ons eigen backward-delete-word
schrijven met backward-kill-work
als een voorbeeld als dit:
(defun backward-delete-word (arg)
"Delete characters backward until encountering the beginning of a word.
With argument ARG, do this that many times."
(interactive "p")
(delete-word (- arg)))
afterwards all we need to do is bind this new function to
!
Laat het me weten als je vragen hebt!