Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs tab not working

Tags:

I have installed Emacs on my FreeBSD 8.2 box. Everything works fine but I cannot use tabs. When I am editing a file with emacs and hit tab, nothing happens.

What could be causing this?

like image 714
Richard Knop Avatar asked Jan 23 '12 14:01

Richard Knop


People also ask

How do I use tabs in Emacs?

To manually insert a tab in Emacs, use ctrl-Q TAB. control-Q causes the next key to be inserted rather than interpreted as a possible command.

How many spaces is a tab in Emacs?

This is because standard tabs are set to eight spaces. Tabs are special characters.


1 Answers

If you're new to Emacs, you might expect pressing TAB to insert a literal \T. For various reasons, that's not the way most Emacs modes work. Most editing modes auto-indent your code as needed (<tab> is bound toindent-for-tab-command rather than self-insert). If the line you're TABbing on is already at the correct indentation level, it might seem that nothing happened.

Auto-indenting like this is easier and more consistent than manually indenting, but doesn't give you as much flexibility when it comes to deciding exactly how much whitespace is going to be present at the beginning of each line (and it also causes some problems when you want to, for example, tab-separate some fields). You can auto-indent a region using C-M-\ (that's Ctrl + Alt + \).

If you absolutely, positively must insert a literal \T into your code somewhere, you can do so using C-q TAB (press and release Ctrl + q and then press TAB). Typically, this is done to align columns in other editors; if that's what you're doing, it's probably a better idea to use align-regexp rather than tab literals.

like image 130
Inaimathi Avatar answered Mar 11 '23 04:03

Inaimathi