Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making sense out of Emacs completion mode choices

There appears to be many alternative Emacs auto completion mechanisms. Without an exhaustive search, the following come to mind: ido, auto-complete, icicles, in buffer completion, minibuffer completion and standard out of the box completion. And then there is code completion. Lots of it. And much of it language dependent. It would be very useful to have an Emacs guru, or three, summarize the benefits of the major players in both code and non-code auto-completion. And this being Stack Overflow, it goes without saying that it would be good to identify the auto completion modes that work best for Emacs's IDE-like mechanisms.

Update: I just discovered the Emacs Wiki completion page which amplifies my basic question: of all these choices, what's good, what's less good and if you could only play with 2-3 which would you recommend?

like image 871
pajato0 Avatar asked Jan 20 '10 09:01

pajato0


1 Answers

Wrt Icicles --

For the most part, Icicles is about minibuffer completion. There are a few cases where it offers something for in-buffer (e.g. code) completion, but it is mainly about minibuffer completion.

When most people think about minibuffer completion they think of file-name completion, buffer-name completion, and command-name completion. But there is a lot more to it.

As an Emacs-Lisp programmer, you can use completion wherever you want to give users a choice interactively. That's pretty general!

Completion is really about pattern-matching to define sets, which you can then manipulate.

Most people think that the only aim of minibuffer completion is to choose a single name (file, buffer, command, variable,...). But the power of completion is really to filter and possibly sort the complete set of file names, buffer names, etc. in different ways, and then to let users do something to or with the resulting set (not necessarily a single object).

That's what Icicles is about: letting you dynamically (incrementally) define sets using pattern-matching, and then act on selected members or all members of those sets.

This is not so much the aim of Ido or the other completion packages, with the possible exception of Helm (Anything).

Unlike Helm (Anything), which privileges object names over object types and actions as its starting point, in Icicles you typically invoke a command to do something to one or more objects of a given type (e.g. buffers), and then you narrow down the set of those objects, typically by name-matching. It is often the case in Icicles that you can act on those objects in multiple but related ways within the same command.

In Helm (Anything), in general your input is matched first by object name against the entire universe of objects of all types, and afterward you narrow down to pick some operation(s) to perform.

Finally, keep in mind that each of the various completion approaches offers both something (e.g. commands) for end users and something (e.g. completion features) for programmers.

If you are doing code completion then you generally just want to complete the name at point. The main thing interesting about code completion is determining what the appropriate candidates are. For that, the textual (e.g. code) context is typically all-important. To offer smart choices, the completion feature needs to analyze the context (code), including any encompassing context (e.g. project code).

Minibuffer completion on the other hand can be used for any kind of choice and action, including multiple choice with multiple actions. Here, all parts are interesting: what candidates to offer, what you can do with them, etc.

Dunno whether that helps, but that's my take anyway.

like image 56
Drew Avatar answered Sep 19 '22 20:09

Drew