Skip navigation

I just wanted to free a shortcut I had for “C-1″ to let it behave the way it was meant with the command “digit-arguments”. This answer http://stackoverflow.com/questions/7549259/is-there-a-quick-way-to-unbind-keys-in-emacs came in handy.

(global-unset-key (kbd “C-1″))
(define-key global-map (kbd “C-1″) ‘digit-argument)

By the way (a little tip) you can go: C-<digit ARG) instead of the C-u method; say to move 11 characters back, “C-11 C-b” is quicker than “C-u 11 C-b”, one less hit!

About these ads

7 Comments

  1. didn’t you mean M- ?

    • @loquehumaine, not sure about your question but I did not mean “M-?” As far as I know that is not an already defined key-binding

  2. You know about the emacs manual, right? {global,local}-unset-key are documented in the emacs texinfo manual under “Customization > Key Bindings > Rebinding”. If you find that it is difficult to find a useful piece of information in the manual, consider reporting it as a bug to the emacs developers, so that the manual can be improved.

    • Anon, you are right, though maybe it’s me but it’s sometimes hard to find a piece of info in the documentation (nothing was returned with “M-x apropos rebind” RET, nor “C-h a rebind RET” ) What can you suggest to ease searches there?
      Oh, never mind, I see that “info-apropos” does actually find stuff. Thanks!

        • Phil
        • Posted May 20, 2012 at 9:27 pm
        • Permalink

        Most of the time you will be looking in either the (elisp) or (emacs) manuals, so switch to whichever seems appropriate, and then you have direct access to its index by typing upper- or lower-case ‘i’ (I find the former more useful), or alternatively you can use C-s to isearch throughout the manual as well. info-apropos is important to have available, but usually not needed in my experience.

  3. If you use an alias as the permanent binding: (define-key global-map (kbd “C-1″) ‘my-Ctrl-1), you can then change the function your alias points to at any time with a single defalias call. A tiny saving.

  4. @Phil, thanks too for your tip!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: