Disable Key Binding Prefix

In shell mode in emacs, the current key binding to exit shell mode ( 'comint-interrupt-subjob ) is "\Cc \Cc" , and I want to change it to "\Cc" , as in a regular linux shell. I tried

 (add-hook 'shell-mode-hook '(lambda () (local-set-key "\Cc" 'comint-interrupt-subjob) )) 

But that did not work. I probably need to disable the prefix assigned to "\Cc" . How can i do this?

+1
source share
2 answers

Try the following:

 (eval-after-load "shell" '(define-key shell-mode-map (kbd "Cc") 'comint-interrupt-subjob)) 

In general, when you define keys, you should define them in specific key combinations, and not just hope that local-set-key does what you want.

Note. I prefer to use kbd to describe the keys, your "\Cc" will work fine.

+2
source
 (define-key (current-local-map) "^C" 'comint-interrupt-subjob) 

This will do the job without checking local dialing errors

+2
source

All Articles