Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the relation C-i and tab in Emacs?

Tags:

emacs

When I bind a function to C-i. It seems that tab is bound to the function. Why does it happens? Is it recognized same key in Emacs?

like image 774
ironsand Avatar asked Jul 25 '13 08:07

ironsand


2 Answers

They happen to be linked in the default setup, but it doesn't have to be this way:

(keyboard-translate ?\C-i ?\C-j)

Now C-i will do a newline, while tab will still indent.

like image 74
abo-abo Avatar answered Oct 13 '22 10:10

abo-abo


Hitting TAB on a text terminal sends the C-i code (which is the ascii char named TAB) to the application, so under a tty C-i and TAB are usually indistinguishable. Emacs by default preserves this equivalence in GUI environments by mapping the tab event to C-i when there's no binding for tab (this is done in function-key-map). So most packages should bind their commands to the TAB char (i.e. C-i) rather than to the tab event, so that it works equally well under a tty or under a GUI. But if you want to distinguish the two, it's very easy: just bind the command you want to the tab event and the mapping from tab to C-i won't happen any more.

like image 41
Stefan Avatar answered Oct 13 '22 09:10

Stefan