Take the 2-minute tour ×

for example when I am typing int main() it would be nice if I could just hit tab and get the list of keywords (auto completion) I want. How can I do this in Emacs?

share|improve this question
Emacs is too cool for autocomplete :P I use emacs for the reason that it doesnt have autocomplete by default. That way you learn the code better :) just my two e-cents –  Jesus Ramos Jul 24 '11 at 3:32
@Jesus: that is true but my friend is saying emacs is uncool because it doesn't have it. So I am trying to convince him that emacs can do anything :) –  Mark Jul 24 '11 at 3:33
It can, if you want I can refer you to an autocomplete that only works with the stuff in any open buffer (not really language specific stuff) I use it on large projects so I don't misspell things sometimes. –  Jesus Ramos Jul 24 '11 at 3:34
@Jesus: Have you tried "company"? Does that offer language specific auto-completion? –  Mark Jul 24 '11 at 3:38
Sorry not familiar with that. I tend to avoid autocomplete altogether :) who needs an IDE to code –  Jesus Ramos Jul 24 '11 at 3:39
show 1 more comment

4 Answers

up vote 4 down vote accepted

You can autocomplete with M-/. There are also other autocomplete packages available.

share|improve this answer
M-/ is bound to dabbrev-expand by default. Many people rebind this key to the more comprehensive hippie-expand (which incorporates the dabbrev expansion options amongst others). –  phils Jul 24 '11 at 5:09
FWIW, I also wrote the following answer recently which generates all the hippie-expand completions and uses ido-completing-read to let the user select the one they want from the minibuffer: stackoverflow.com/questions/6515009/… –  phils Jul 24 '11 at 5:16
add comment

You need CEDET, it contains many good tools that can be used to make EMACS have many features that you would see in a more modern IDE.

share|improve this answer
You don't need CEDET for simple auto completion. –  Noufal Ibrahim Jul 24 '11 at 5:11
Thanks for telling me about CEDET I am think I am going to be alot more productive from now on. –  Mark Jul 24 '11 at 5:30
add comment

You may use yasnippet. By writing 'main' and then TAB, you get

int main (int argc, char *argv[])

  return 0;

(This is not really auto completion.)

share|improve this answer
@kindahero: sorry, I had not seen your comment. –  mkcs Jul 24 '11 at 4:31
Does yashnippet do more than just autocomplete the main? How could I extend it to do more? could you show more examples? –  Mark Jul 24 '11 at 4:46
The package comes bundled with lots of snippet expansions, e.g., 'if' + TAB gives you an 'if' with parentheses, braces for the block, and point inside the parentheses; writing the condition and pressing TAB puts the point inside the braces. You may also create your own snippets; it is pretty simple (no elisp required), see this –  mkcs Jul 24 '11 at 4:54
add comment

Asher's answer with the list is probably the best but if you want something that gives you a drop down of possible (non semantic) completions which you can select, you can use auto complete mode.

share|improve this answer
add comment

Your Answer


