Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs auto-complete

since I can't get CEDET to work for automatic code-completion (aka intelli-sense in the MS-world), after trying several times (no, it's just not working!), I've decided to use auto-complete, which works "quite fine" for me.

Unfortunately, auto-complete has an annoying behaviour when it comes to quit the imenu with its suggestions.

  1. auto-complete starts imenu, no matter how many suggestions it has. So, if there's only one suggestion, the menu appears. 1.
  2. To exit the imenu, I have to use the LEFT or RIGHT keys in order to make the menu disappear. ESC-ESC-ESC does not have any effect.

Is there any way, to modify these two behaviors?

Here's an excerpt of my .emacs file showing the auto-complete relevant stuff:

(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(setq ac-delay 0.5) ;; eclipse uses 500ms

Kind regards, mefiX

like image 611
mefiX Avatar asked Nov 04 '10 09:11

mefiX


People also ask

How do I Autocomplete in Emacs?

The key to triggering the auto-completion in emacs is the Tab key. You will get a list of suggestions from the compiler. To select something from the list of suggestions, we recommend you to use C-n and C-p, but the down and up arrow keys can be used as well.

Does Emacs have auto-completion?

Auto-Complete is an intelligent auto-completion extension for Emacs. It extends the standard Emacs completion interface and provides an environment that allows users to concentrate more on their own work. Its features are: a visual interface, reduce overhead of completion by using statistic method, extensibility.

What is autocomplete feature?

Autocomplete is a feature within Google Search that makes it faster to complete searches that you start to type. Our automated systems generate predictions that help people save time by allowing them to quickly complete the search they already intended to do.

What is Emacs company mode?

About. Company is a text completion framework for Emacs. The name stands for "complete anything". It uses pluggable back-ends and front-ends to retrieve and display completion candidates.


1 Answers

'Stop autocompleting' can be set by adding the following to your .emacs:

(define-key ac-completing-map "\ESC/" 'ac-stop)

...or alternatively you can use C-g as the default Emacs StopSomething command :)

As for showing the completion in a menu when there's only one candidate, I'm not really sure what other behaviour you'd want?

like image 108
David Miller Avatar answered Sep 20 '22 02:09

David Miller