views:

419

answers:

2

I'd like to bind ctrl-r to 'isearch-backward and bind ctrl-shift-r to 'tags-apropos but I can't distinguish between the two key presses.

Can emacs differentiate between ctrl-r and ctrl-shift-r? What should go into my .emacs file to allow this keybinding?

+4  A: 

Yes -- one is "\C-r", the other is "\C-R". They can easily be bound to separate commands. For example, this should do the trick if placed in your .emacs file:

(global-set-key "\C-R" 'tags-apropos)
Adam Rosenfield
+15  A: 

Yes.

(global-set-key (kbd "C-r") 'isearch-backward)
(global-set-key (kbd "C-S-r") 'tags-apropos)

The way to figure out the answer to this kind of question is to do help on a key C-h k, and type the keystrokes you're interested in. What Emacs shows in the Help buffer is the string you can pass to the macro 'kbd.

Trey Jackson
I like the 'teach a man to fish' answers
justinhj