www.delorie.com/gnu/docs/elisp-manual-21/elisp_274.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.5 Completion

Completion is a feature that fills in the rest of a name starting from an abbreviation for it. Completion works by comparing the user's input against a list of valid names and determining how much of the name is determined uniquely by what the user has typed. For example, when you type C-x b (switch-to-buffer) and then type the first few letters of the name of the buffer to which you wish to switch, and then type TAB (minibuffer-complete), Emacs extends the name as far as it can.

Standard Emacs commands offer completion for names of symbols, files, buffers, and processes; with the functions in this section, you can implement completion for other kinds of names.

The try-completion function is the basic primitive for completion: it returns the longest determined completion of a given initial string, with a given set of strings to match against.

The function completing-read provides a higher-level interface for completion. A call to completing-read specifies how to determine the list of valid names. The function then activates the minibuffer with a local keymap that binds a few keys to commands useful for completion. Other functions provide convenient simple interfaces for reading certain kinds of names with completion.

20.5.1 Basic Completion Functions  Low-level functions for completing strings.
                             (These are too low level to use the minibuffer.)
20.5.2 Completion and the Minibuffer  Invoking the minibuffer with completion.
20.5.3 Minibuffer Commands that Do Completion  Minibuffer commands that do completion.
20.5.4 High-Level Completion Functions  Convenient special cases of completion
                             (reading buffer name, file name, etc.)
20.5.5 Reading File Names  Using completion to read file names.
20.5.6 Programmed Completion  Finding the completions for a given file name.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003