Hey, I know that emacs supports code completion. But to be honest I have never been a good FAQ reader, at least for something that I'm completely new to. So I wonder what I need to download and how to make so emacs can do some smart code completion for me in C++, and Java. Or is there any package which does code completion for many of major languages?

link|improve this question

62% accept rate
feedback

3 Answers

up vote 4 down vote accepted

The basic way that will work across any sort of buffer in emacs is dynamic abbreviation used by hitting M-/ (aka alt+/)

That will expand text to duplicate other strings already existing in your current buffer or in other buffers currently open.

For more extensive code completion that is language specific for C++ or Java (or others), you'll want to look at a code templating or snippet package. There are some discussed in this related question on StackOverflow. One that is commonly mentioned in these discussions is yasnippet -- there's a screencast demo in this post on an emacs blog.

link|improve this answer
feedback

Short answer: M-/

Long answer: RTFM :-)

link|improve this answer
1  
+1, god i hope the next question i see is "need help using RTFM command" – rownage Jan 10 '11 at 16:38
@rownage: oh, thats ``info-emacs-manual'` (C-h r) – SamB Jan 10 '11 at 18:51
How about C-h k M-/ ? – Doug Harris Jan 10 '11 at 20:07
feedback

Short answer: I know none for emacs that is useful for java. Dynamic expand does not care for the libraries in your class path, it does not know anything about the code you're typing it can only expand to text that already exists in one of the buffers. JDE and emacs-eclim try to provide this functionality but personally I was not impressed.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.