auto-complete-mode

Recently, we discussed CEDET in the interview with Eric Ludlam. CEDET has a deep
understanding of the source code, and assists the development process by
exploiting that knowledge. For example by drawing class diagrams (COGRE) or
providing auto-completion for function names and parameters.



Currently, however, CEDET is also be a bit hard to set up effectively, and may
also not support your programming language yet. Therefore, it's still useful to
look at some other packages that can substitute (part of) the functionality.



For me, auto-complete-mode has been very useful for that. It's not as fancy as
CEDET in the sense that it does not really understand the code – but in
practice I found it to work quite well for both C/C++, Elisp and shell scripts.
It can even display the docstrings of functions. And when editing shell-scripts,
it can complete path names as you are editing the scripts; very nice.



To install, follow the instructions. Then, in your .emacs, have something
like:




(when (require 'auto-complete-config nil 'noerror) ;; don't break if not installed 
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(setq ac-comphist-file "~/.emacs.d/ac-comphist.dat")
(ac-config-default))





After that, M-x auto-complete-mode to start using it. Alternatively, there's a
YouTube-video explaining how to install and use auto-complete-mode;
recommended. In any case, it is fully documented.



auto-complete-mode uses a configurable set of sources from which it takes it
knowledge about what can be completed. For example, when writing in org-mode,
it takes its input from




(ac-source-filename ac-source-abbrev ac-source-dictionary
ac-source-words-in-same-mode-buffers)




while in a c-mode buffer it is (in my case):




(ac-source-filename ac-source-yasnippet ac-source-gtags ac-source-abbrev
ac-source-dictionary ac-source-words-in-same-mode-buffers)




You can customize this, and (for the more ambitious), it's possible to add your
own sources as well.

Followers

Popular Posts