Next: Completion, Previous: Object from Minibuffer, Up: Minibuffers [Contents][Index]
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:
Use variable (a symbol) as the history list.
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:
The default history list for minibuffer history input.
A history list for arguments to query-replace
(and similar
arguments to other commands).
A history list for file name arguments.
A history list for regular expression arguments.
A history list for arguments that are names of extended commands.
A history list for arguments that are shell commands.
A history list for arguments that are Lisp expressions to evaluate.
A history list for Info mode’s minibuffer.
A history list for manual-entry
.
There are many other minibuffer history lists, defined by various libraries. An M-x apropos search for ‘history’ should prove fruitful in discovering them.
Next: Completion, Previous: Object from Minibuffer, Up: Minibuffers [Contents][Index]