[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

20.1 Introduction to Minibuffers

In most ways, a minibuffer is a normal Emacs buffer. Most operations within a buffer, such as editing commands, work normally in a minibuffer. However, many operations for managing buffers do not apply to minibuffers. The name of a minibuffer always has the form ‘ *Minibuf-number*’, and it cannot be changed. Minibuffers are displayed only in special windows used only for minibuffers; these windows always appear at the bottom of a frame. (Sometimes frames have no minibuffer window, and sometimes a special kind of frame contains nothing but a minibuffer window; see Minibuffers and Frames.)

The text in the minibuffer always starts with the prompt string, the text that was specified by the program that is using the minibuffer to tell the user what sort of input to type. This text is marked read-only so you won't accidentally delete or change it. It is also marked as a field (voir la section Defining and Using Fields), so that certain motion functions, including beginning-of-line, forward-word, forward-sentence, and forward-paragraph, stop at the boundary between the prompt and the actual text. (In older Emacs versions, the prompt was displayed using a special mechanism and was not part of the buffer contents.)

The minibuffer's window is normally a single line; it grows automatically if necessary if the contents require more space. You can explicitly resize it temporarily with the window sizing commands; it reverts to its normal size when the minibuffer is exited. You can resize it permanently by using the window sizing commands in the frame's other window, when the minibuffer is not active. If the frame contains just a minibuffer, you can change the minibuffer's size by changing the frame's size.

Use of the minibuffer reads input events, and that alters the values of variables such as this-command and last-command (voir la section Information from the Command Loop). Your program should bind them around the code that uses the minibuffer, if you do not want that to change them.

If a command uses a minibuffer while there is an active minibuffer, this is called a recursive minibuffer. The first minibuffer is named ‘ *Minibuf-0*’. Recursive minibuffers are named by incrementing the number at the end of the name. (The names begin with a space so that they won't show up in normal buffer lists.) Of several recursive minibuffers, the innermost (or most recently entered) is the active minibuffer. We usually call this “the” minibuffer. You can permit or forbid recursive minibuffers by setting the variable enable-recursive-minibuffers or by putting properties of that name on command symbols (voir la section Recursive Minibuffers).

Like other buffers, a minibuffer uses a local keymap (voir la section Keymaps) to specify special key bindings. The function that invokes the minibuffer also sets up its local map according to the job to be done. Voir la section Reading Text Strings with the Minibuffer, for the non-completion minibuffer local maps. Voir la section Minibuffer Commands that Do Completion, for the minibuffer local maps for completion.

When Emacs is running in batch mode, any request to read from the minibuffer actually reads a line from the standard input descriptor that was supplied when Emacs was started.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.