Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 477607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:36:28+00:00 2026-05-13T00:36:28+00:00

In emacs, I want to bind a command to C-i. So I put (global-set-key

  • 0

In emacs, I want to bind a command to C-i. So I put (global-set-key "\C-i" 'forward-word)

in my .emacs file. This works, except now the TAB key is bound to ‘forward-word as well.

How do I bind a command to C-i without changing TAB?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:36:29+00:00Added an answer on May 13, 2026 at 12:36 am

    In short, this should solve the problem for you:

    (setq local-function-key-map (delq '(kp-tab . [9]) local-function-key-map))
    (global-set-key (kbd "C-i") 'forward-word)
    

    Longer version:

    From the emacs lisp documentation on function keys:

    In ASCII, C-i and <TAB> are the same
    character. If the terminal can
    distinguish between them, Emacs
    conveys the distinction to Lisp
    programs by representing the former as
    the integer 9, and the latter as the
    symbol tab.

    Most of the time, it’s not useful to
    distinguish the two. So normally
    local-function-key-map (see
    Translation Keymaps) is set up to map
    tab into 9. Thus, a key binding for
    character code 9 (the character C-i)
    also applies to tab. Likewise for the
    other symbols in this group. The
    function read-char likewise converts
    these events into characters.

    So, once you do the following, you can see the difference in the key bindings:

    (setq local-function-key-map (delq '(kp-tab . [9]) local-function-key-map))
    
    ;; this is C-i
    (global-set-key (kbd "C-i") (lambda () (interactive) (message "C-i"))) 
    ;; this is <tab> key
    (global-set-key (kbd "<tab>") (lambda () (interactive) (message "<tab>")))
    

    Note, each mode sets up the various TAB bindings differently, so you may need to do customization per mode that you care about.

    Version Dependency:

    The above works for Emacs 23.1. From the NEWS file:

    Function key sequences are now mapped using `local-function-key-map’,
    a new variable. This inherits from the global variable function-key-map,
    which is not used directly any more.

    Which means, in versions 22 and earlier, you can get the same effect by using the variable function-key-map. I tested this and found it to work with Emacs 21.

    (setq local-function-key-map (delq '(kp-tab . [9]) function-key-map))
    (global-set-key (kbd "C-i") 'forward-word)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to set a key in emacs to perform a shell command on
I'd like to map a command in emacs to a key-binding. I want the
I want my emacs buffer to have a different name than the file name.
Working with Python in Emacs if I want to add a try/except to a
In emacs, I want to bind C-k to kill-region if region selected; else kill-line
I want to have a command in Emacs to make it as opaque/transparent as
I want to be able to make the changes to my .emacs file without
Im emacs, I want to run touch on the file referenced by the current
Could you suggest the key bind in emacs to do the following: Steps: for
This is a follow up to How do I bind latexmk to one key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.