views:

137

answers:

4

I've checked my elisp files to make sure that I do not have any bindings that contain Shift+R (and I have not found any). I expect SHIFT+R to print an uppercase character, but instead I get R R undefined inside of the Emacs command line. This is only in C/C++ major modes.

Any suggestions?

Update: Describing the key shows that it is undefined. How would I define it for the normal, expected use (capitalizing the letter R)?

+1  A: 

Try C-h k (describe-key), then press Shift-R. describe-key will then tell you what is bound to that key. At least that will give you a hint as to whether or not there is an active binding. If there's a binding, perhaps it will give you a hint of something else to search for in your startup files.

Bryan Oakley
It says that the key is undefined.
John Bellone
+2  A: 

I assume by the 'expected use' you mean to insert the 'R' character. For this, you'd need to bind the key to 'self-insert-command':

M-x global-set-key R self-insert-command

Or, in your .emacs or .emacs.d/init.el file:

(global-set-key "R" 'self-insert-command)

Of course, this should be the default....

Peter Hart
Did this work for you?
Noufal Ibrahim
No, when I press Shift+R, "R" appears as if I am going to type a command (similar to M-x).
John Bellone
The problem was actually fixed by this answer, but the root of the problem came from the X Window software I was using. Apparently it was binding the left ALT key to something other than ALT. After a little searching it seems this has to do with legacy support for older keyboards.
John Bellone
+2  A: 

I'm getting a little deja-vu here and if memory serves the behavior I encountered some years ago was that (on Windows) certain accessibility settings unset or changed the keycode for the right shift key. Sorry I cannot be more specific but maybe this will stimulate someone else to come up with the real answer. A test you can make: does the behavior work with both shift keys or just one? If the answer is just one shows the bad behavior, is that bad behavior shown with all keys?

pajato0
Just the left shift key, but this is through X forwarding (and sticky keys are off).
John Bellone
A: 

You sound like you're having the same problem I had. Typing Re... in any html buffer would try to execute an R- command, when every single R-* command was undefined. Turned out that I had a typo in my .emacs file. I had a global-key-map set to (kbd "REF") instead of (kbd "RET"), and fixing it made the problem immediately vanish. So I'd recommend checking for anything similar in your .emacs file.

monksp