Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind C-` (backquote) in emacs

I would like to bind C-` (control-backquote) but I could not do it.

The sexp

(global-set-key "\M-`" 'other-window)

works, whereas

(global-set-key "\C-`" 'other-window)

doesn't. It fails with the "Invalid modifier in string" error.

like image 360
HMM Avatar asked Mar 20 '10 14:03

HMM


2 Answers

"\C-a" and similar do work because there is a ASCII code for them. There is none for C-`, simply use

(kbd "C-`")

By the way, this often more portable from one emacsen to another.

like image 143
Rémi Avatar answered Sep 16 '22 17:09

Rémi


Since it is fair to answer my own question:

(global-set-key [?\C-`] 'other-window)

But I don't know the meaning of that extra question mark.

like image 32
HMM Avatar answered Sep 18 '22 17:09

HMM