Go to the first, previous, next, last section, table of contents.


Minibuffer History

A minibuffer history list records previous minibuffer inputs so the user can reuse them conveniently. A history list is actually a symbol, not a list; it is a variable whose value is a list of strings (previous inputs), most recent first.

There are many separate history lists, used for different kinds of inputs. It's the Lisp programmer's job to specify the right history list for each use of the minibuffer.

The basic minibuffer input functions read-from-minibuffer and completing-read both accept an optional argument named hist which is how you specify the history list. Here are the possible values:

variable
Use variable (a symbol) as the history list.
(variable . startpos)
Use variable (a symbol) as the history list, and assume that the initial history position is startpos (an integer, counting from zero which specifies the most recent element of the history). If you specify startpos, then you should also specify that element of the history as the initial minibuffer contents, for consistency.

If you don't specify hist, then the default history list minibuffer-history is used. For other standard history lists, see below. You can also create your own history list variable; just initialize it to nil before the first use.

Both read-from-minibuffer and completing-read add new elements to the history list automatically, and provide commands to allow the user to reuse items on the list. The only thing your program needs to do to use a history list is to initialize it and to pass its name to the input functions when you wish. But it is safe to modify the list by hand when the minibuffer input functions are not using it.

Here are some of the standard minibuffer history list variables:

Variable: minibuffer-history
The default history list for minibuffer history input.

Variable: query-replace-history
A history list for arguments to query-replace (and similar arguments to other commands).

Variable: file-name-history
A history list for file-name arguments.

Variable: buffer-name-history
A history list for buffer-name arguments.

Variable: regexp-history
A history list for regular expression arguments.

Variable: extended-command-history
A history list for arguments that are names of extended commands.

Variable: shell-command-history
A history list for arguments that are shell commands.

Variable: read-expression-history
A history list for arguments that are Lisp expressions to evaluate.


Go to the first, previous, next, last section, table of contents.