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))))
kill-region
の代わりに delete-region
を使って同じことをする関数を書くと、目的の結果が得られます。新しい 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))))
次のように、 backward-kill-work
を使用して独自の backward-delete-word
を書くことができます。
(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
!
ご質問がありましたら、私にお知らせください!