3

When using ido, the command ido-restrict-to-matches (bound to C-SPC) is one of my favourite. What it does: instead of completing input against the initial collection of things, it will:

  • restrict that collection to the list of those things that match[*] the current input, and
  • remove the current input.

This allows to narrow down the list incrementally.

I would love to see such a mechanism work with the default completion system of emacs (I'm in particular interested in icomplete-mode). Does it exist, or how to do it ?

[*] Or, with a prefix arg, those that do not match (should be available in emacs-25.1, yet unreleased).

3

AFAIK, the answer is no; it does not exist for vanilla Emacs completion, and likewise for icomplete-mode. (Someone will correct me if I'm wrong.)

This kind of narrowing is a key feature of Icicles, which Icicles calls progressive completion.

Some other completion UIs now provide such a feature, including Helm and, as you point out, Ido. Icicles was the first to provide this feature, AFAIK; it has had it for almost a decade now.

A related feature is to narrow, not by matching additional patterns, but by not matching additional patterns. Icicles calls this chipping away the non-elephant.

Here, you match an additional pattern and then subtract those matches from the previous ones. This can be a powerful way to quickly narrow a set of completion candidates by simply weeding out those that match certain patterns.


Note: Unlike Ido completion and Icomplete completion, Icicles completion is very close to "the default completion system of emacs". It uses the minibuffer the same way (you can edit there etc.), and it uses buffer *Completions* the same way.

In fact, if you just use TAB for completion and you do not use any of the Icicles-specific minibuffer keys, the completion behavior is pretty much the same as vanilla Emacs.

So Icicles really does provide something very close to vanilla Emacs completion plus, by hitting S-SPC, progressive completion (incremental narrowing).

| improve this answer | |
  • I totally agree that "chipping away the non-elephant" is a very useful and desirable feature. In fact, I actually use that feature a lot with ido (using a patch waiting to be included in emacs. See emacs bug#15631). – YoungFrog Jun 30 '15 at 10:11
  • Btw I'll accept this answer soon, and later change my mind if someone comes up with an implementation of the feature :) – YoungFrog Jun 30 '15 at 10:12
  • That (chipping away) will be a welcome addition to Ido. – Drew Jun 30 '15 at 14:08
  • 1
    Indeed, AFAIK the answer is no, and it's a feature I'd be happy to see added to minibuffer.el. – Stefan Jun 30 '15 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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