Search code examples
emacscompletion

How to make emacs completing-read display *Completions* buffer as soon as I type


In emacs lisp, I expect the following to display a list of options in the completion buffer as I type. It prompts for information but doesn't display choices, either before or after I start typing. For example, I'd expect it to display 'First' after I'd typed 'F'.

(defun reader ()
  (interactive)
  (let ((choices '("First" "Second" "Third")))
    (completing-read "Choose: " choices)))

Essentially I'm looking for something similar to the output described here. But what I get is this (there's nothing below the line, which is the edge of my window):

enter image description here

Can anyone explain where I'm going wrong with completing-read?


Solution

  • That's the way completing-read behaves. You're not doing anything wrong. It just doesn't support any kind of automatic, incremental completion.

    If you want such automatic completion then you either need to write your own code to provide that or use a completion framework that provides it.

    Icicles was the first to provide this incremental-completion behavior. Many other packages now provide the same or similar.