[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: What completion mechanisms are you using?

From: Drew Adams
Subject: RE: What completion mechanisms are you using?
Date: Sun, 1 Feb 2009 12:58:32 -0800

> > > > > ask you what extensions you are using and how they help you
> > > > > to optimize your day to day work.
> > > > 
> > > > I'm a big fan icicles. It adds completion for pretty much 
> > > > any minibuffer related activity you can think of (and 
> > > > then some).
> > > >
> > > > I still haven't come close to really utilizing it to it's full
> > > > potential (but then, with emacs in general that is a rather
> > > > normal state of affairs for me!)
> > > > 
> > > > Features that I use often would include:
> > > >  * Regex and Fuzzy matching.  These are great when I have a 
> > > >    general idea what something I'm looking for is named but not
> > > >    exactly. Also good for exploring possibilities within a
> > > >    subset of functionality.
> > > > 
> > > >  * Saving completion lists to act as de facto file listings for
> > > >    projects.
> > > >  
> > > >  * Using it's completion to enhance the discoverability of emacs
> > > >    commands for myself.
> > > 
> > > At the moment i use ido and icomplete. But icicles seems 
> > > really nice for completion. The only problem i have is, that 
> > > it doesn't work well with ido.
> > 
> > Icicles and Ido are incompatible. They use the minibuffer 
> > in different ways. Icicles stays closer to the vanilla Emacs
> > behavior, extending it by using additional keys.
> > 
> > > Why i want this weird setup is easy. I think ido is perfect 
> > > for files with the way it shows them to me on selecting and 
> > > the way you can browse through directories.
> > 
> > You would need to be more specific for me to be helpful 
> > about this wrt Icicles. What do you mean by "shows them to me
> > on selecting"?
> > 
> > If you mean that the file is visited as soon as you type 
> > enough characters to get a match, then you can get similar
> > behavior with Icicles (see links below).
> No, what i mean is the following behaviour. If i type C-x C-f 
> i get right away a list of possible matches in the minibuffer.

OK, so you want to see the possibile completions immediately. 

To get that behavior with Icicles, customize option
`icicle-show-Completions-initially-flag' to t. But in Icicles, like in vanilla
Emacs, the candidates are shown in buffer *Completions*, not in the minibuffer.
If you set the option to a non-nil, non-t value, then *Completions* is not
displayed until you type or delete some input; otherwise, non-nil shows the
candidates immediately.

I know that some Icicles users prefer the show-initially behavior, but most do
not. It's easy for an Icicles user to try the different behaviors in various
contexts, to see which s?he prefers overall.

One thing to keep in mind: Icicles completion is available in *every*
minibuffer-completion context, not just for file and buffer names. What might
seem like a good idea at first for file names or buffer names is not necessarily
a great idea for other contexts also.

Rather than customizing `icicle-show-Completions-initially-flag' to non-nil, it
is more typical, for a particular context in which initial display of candidates
makes sense, to temporarily bind the option to non-nil. That can be done to make
use of *Completions* as a menu, for instance. (A special case is a
multiple-choice menu, where you can choose more than one item or choose an item
any number of times.)

> This get more refined if i add letters.

Such incremental completion is also standard behavior for Icicles. But you can
toggle it at any time, using `C-#' in the minibuffer. It can be time-consuming
or annoying in some contexts (e.g. zillions of candidates, such as all of the
files in your file system).

Besides toggling this, you can customize its behavior, using options
`icicle-incremental-completion-flag', `icicle-incremental-completion-delay' and

> For example if i am in a directory with the files aa.txt aac.txt b.txt
> after ido-find-file i get the following line in the minibuffer:
> find file: ~/{aa.txt | aac.txt | b.txt}
> If i now type a it looks like:
> find file: ~/a[a]{aa.txt | aac.txt}
> If i now hit Return i get aa.txt and if i hit right cursor it changes to
> find file: ~/{aac.txt | b.txt | aa.txt}.

Similarly, in Icicles.

But Icicles uses regexp matching for this, by default. AFAIK, Ido uses substring
matching here, which is a proper subset of regexp matching.

If you want only substring matching in Icicles, you can customize option
`icicle-regexp-quote-flag' to non-nil. That escapes any regexp special
characters in your input. Or you can just use `C-`' in the minibuffer at any
time, to toggle this option (hence toggle substring/regexp completion).

> I hope this gets clearer.
> > > For example with ido you just have to hit Backspace to go one
> > > directory up.
> > 
> > Icicles is like vanilla Emacs wrt editing in the minibuffer:
> > Backspace just back-spaces, etc. To go up a directory, you
> > need to hit 3 keys, `M-k ..', instead of one. That's the same
> > as vanilla Emacs - Icicles justs adds a `M-k' binding to clear
> > the minibuffer.
> > 
> > IOW, Icicles does not have separate editing and command 
> > modes in the minibuffer. Like vanilla Emacs, Icicles minibuffer
> > interaction is not modal. Backspace is always an editing key.
> > 
> > You could of course bind some key in the minibuffer keymaps 
> > to go up a directory.
> I didn't know that, thanks for the advice but binding a key 
> will not really help.
> Again an example of ido's behaviour:
> find file: a{ aa.txt | aac.txt | b.txt}
> If i now hit Backspace i get
> find file: /tmp/{ aa.txt | aac.txt | b.txt}
> If i now hit backspace again i get
> find file: /{ $list of files}
> Is this possible with a keybinding?

That's already the same in Icicles - no need to change any key bindings. That's
just incremental completion - see above.

That simply shows the completion candidates that correspond to whatever is
currently in the minibuffer. If the minibuffer has `/tmp/' as content, then the
candidates are the files in directory `/tmp/'.

Even vanilla Emacs works this way. But vanilla Emacs doesn't have incremental
completion - you must hit TAB to see the completions of the new (edited)
minibuffer input. (But as I mentioned, that's not always a drawback - sometimes
it's an advantage to complete only on demand. It depends on the context.)

> > > So has somebody a clue how i can setup icicles that it gets 
> > > used for everything except the things ido uses?
> > 
> > As I said, their use of the minibuffer conflicts. This makes
> > them incompatible - each tries to control the minibuffer UI.
> > Icicles generally plays along with vanilla Emacs minibuffer
> > bindings; Ido does not.
> > 
> > That said, there are some Icicles options you can use to 
> > make some of the behavior more Ido-like. See:
> > and
> >
> > 
> > But overall, do not look to reproducing the Ido UI in Icicles.
> > That's a bit like trying to reproduce vi-like behavior in Emacs:
> > You can do it to some extent, but an Ido or VI diehard will
> > likely be disappointed with the compromise.
> > 
> > On the other hand, Icicles is compatible with Iswitchb, 
> > which is similar to Ido for buffer-switching.
> > 
> > BTW, someone mentioned Ido's "flex" matching. That is also 
> > available with Icicles (I call it "scatter" matching).
> > You can switch matching methods at any time by hitting
> > `C-(' or `M-(' in the minibuffer:
> > 
> > * `C-(' cycles between fuzzy and prefix completion (for TAB)
> > * `M-(' cycles between regexp/substring, scatter (flex), and
> >   Levenshtein completion (for S-TAB)
> > 
> > HTH.
> The above features of ido i mentioned are basically the daily 
> stuff i use and really missed when i tried icicles for some minutes.

IIUC, the things you mentioned are available in Icicles as well.

I would say, however, that if you are happy with Ido (or with vanilla Emacs, for
that matter), then why change? I meant it when I said that it's probably a
mistake to look for a reproduction of Ido behavior in Icicles; you're bound to
be disappointed at some point.

We each have our own preferences and habits. The old saying that "if all you
have is a hammer then everything looks like a nail" is apt here. If someone is
quite used to a hammer (whether that's Ido or vanilla Emacs or Icicles), then,
when trying out a different tool, there is often a tendency to find it lacking
in hammerness. ;-) Each tool has its advantages - no sense using a wrench only
to pound on things. Instead, find out how a wrench might be useful to you (or

People are different. It's a good thing that there are multiple UIs available to
choose from and experiment with. There is no single best answer.

Just wanted to offer some general clarification, in case it helps someone.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]