Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to use C-c B as a binding, only it seems to be already bound :

C-c b (translated from C-c B) runs the command …
  • How can I see where's the code that binds it ?

  • How to overrule it myself ?


B or S-b, is there a standard for that ?

share|improve this question
    
Re note (1) imho - no, that's not clearer; S (2) standard is to use capitals when you mean capital, just as you have, S is used only with other modifiers, as in C-S-b –  ckhan Nov 16 '12 at 3:16
    
Thanks. Does that mean C-B would be bad practice, or is just for, say, C-S-s and M-S-m, to distinguish them from Control-Shift-forgot-the-letter and so ? Now that I took it apart it looks oh so very much like a second question… Dunno if it deserves posting. –  Nikana Reklawyks Nov 16 '12 at 3:21
add comment

1 Answer

C-h k C-c b to show what command is being run. Click/press space on the .el link in the first paragraph to see the code.

(global-unset-key "\C-cb") in your .emacs to unset the key.

Edit 1:

First find what command is being run with that keypress with describe-key: C-h k C-c B. If emacs reports C-c B is undefined It's probably falling back to the lowercase command, C-c b.

In the case of a fallback like this, binding a capital key with (global-set-key (kbd "C-c B") 'command) will leave the fallback key in place.

Otherwise, the *help* window that describe-key brings up will mention an .el file in the first paragraph, you can bring it up with a click, or space when the point is on it. Your command will likely be being set somewhere in that code.

To find the code try searching for describe-key, set-key, some variations of your kbd string, or if worst comes to worst, key.

share|improve this answer
    
That's the code of the function definition, not the code that binds the key. Also you're unbinding the lower-case key, which I want to stay as it is, I just want to overrule the upper-case one. –  Nikana Reklawyks Nov 30 '12 at 15:51
1  
I meant that the binding will likely be in the library that you've been pointed to. Try doing a search for 'bind', 'set-key', 'defkey' etc, you might have some luck. In my case it was org-mode with org-defkey. –  Daniel Nov 30 '12 at 18:48
    
As for the unset-key, according to this page on emacs bindings the correct way is (global-unset-key (kbd "C-c B")). Just tested it against a quick set-key in scratch, seems to work, but falls back to C-c b if the binding for the capital letter version doesn't exist. –  Daniel Nov 30 '12 at 19:00
    
The search didn't give me results, as I search for C-x <left> in simple.el. As for rebinding, yes, binding the uppercase one scraps the translation, but it's important for my question to keep the lowercase binding intact (but you could edit your answer to take that into account). –  Nikana Reklawyks Dec 7 '12 at 2:35
    
Thanks, my answer's been edited. I take it you're after a few like this? C-x <left> isn't in the original question. It won't have a fallback case, I'm guessing. –  Daniel Dec 7 '12 at 9:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.