I'm trying to change the key maps in Emacs (for use with cscope). Cscope has bindings like
"C-c s s", "C-c s g", "C-c s G" ... etc
So I'm trying to change the map to C-\ s, C-\ g, C-\ G ... etc
I tried using
(define-key global-map "\C-\\-s" 'cscope-find-this-symbol)
It complains:
error: Key sequence C-\ - a starts with non-prefix key C-\
How do I correct this. I'm new to Emacs and Elisp. I tried using the define-prefix-command function as suggested in the Emacs Wiki. But it did not help may be I did not use it correctly. Can someone let me know of any resource that can help me make this change. An example snippet would also be of great help.
Thanks.
You try to change the definition of C-\ s. However, C-\ is already bound to a different command. (You can find out what a key is bound to with C-h k.)
The basic explanation is: Your command would never be executed. That other command is already executed after the first key stroke. One way to solve this is to undefine the other key first. Then Emacs can turn it into a "prefix key".
(define-key global-map "\C-\\" nil)
You also said "\C-\\-s", but you meant "\C-\\s". The "-" means "at the same time".
(define-key global-map "\C-\\s" 'cscope-find-this-symbol)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With