1
votes

Clicking Ctrl-h k Alt-z gives this:

M-z runs the command zap-to-char, which is an interactive compiled Lisp function in `simple.el'.

It is bound to M-z.

(zap-to-char ARG CHAR)

Kill up to and including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. Goes backward if ARG is negative; error if CHAR not found.


I never use this function, but the keys are located in a very good position. So I wanted to redefine this sequence. But I couldn't. Even when I execute this command in .emacs:

(global-set-key (kbd "\M-z") 'backward-delete-word) M-z is still bound to zap-to-char.

Approach, suggested here, didn't help:

Emacs can't reset Ctrl-d key behaviour

1
Don't forget to reload the .emacs file, M-x load-file ~/.emacs.Patrick
@Patrick I used C-x C-e to compile the expression.user4035

1 Answers

4
votes

You don't need a \ in 'kbd'. Also, I think you're looking for backward-kill-word:

(global-set-key (kbd "M-z") 'backward-kill-word)

EDIT: I didn't notice that the page you linked to defines backward-delete-word. If you have that function defined, you can use it instead of backward-kill-word here.