[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
The first thing the command loop must do is read a key sequence, which is a
sequence of events that translates into a command. It does this by calling
the function read-key-sequence
. Your Lisp code can also call this
function (voir la section Key Sequence Input). Lisp programs can also do input at a
lower level with read-event
(voir la section Reading One Event) or discard
pending input with discard-input
(voir la section Miscellaneous Event Input Features).
The key sequence is translated into a command through the currently active
keymaps. Voir la section Key Lookup, for information on how this is done. The
result should be a keyboard macro or an interactively callable function. If
the key is M-x, then it reads the name of another command, which it
then calls. This is done by the command execute-extended-command
(voir la section Interactive Call).
To execute a command requires first reading the arguments for it. This is
done by calling command-execute
(voir la section Interactive Call). For
commands written in Lisp, the interactive
specification says how to
read the arguments. This may use the prefix argument (voir la section Prefix Command Arguments) or may read with prompting in the minibuffer
(voir la section Minibuffers). For example, the command find-file
has an
interactive
specification which says to read a file name using the
minibuffer. The command's function body does not use the minibuffer; if you
call this command from Lisp code as a function, you must supply the file
name string as an ordinary Lisp function argument.
If the command is a string or vector (i.e., a keyboard macro) then
execute-kbd-macro
is used to execute it. You can call this function
yourself (voir la section Keyboard Macros).
To terminate the execution of a running command, type C-g. This character causes quitting (voir la section Quitting).
The editor command loop runs this normal hook before each command. At that
time, this-command
contains the command that is about to run, and
last-command
describes the previous command. Voir la section Information from the Command Loop.
The editor command loop runs this normal hook after each command (including
commands terminated prematurely by quitting or by errors), and also when the
command loop is first entered. At that time, this-command
refers to
the command that just ran, and last-command
refers to the command
before that.
Quitting is suppressed while running pre-command-hook
and
post-command-hook
. If an error happens while executing one of these
hooks, it terminates execution of the hook, and clears the hook variable to
nil
so as to prevent an infinite loop of errors.
A request coming into the Emacs server (voir (emacs)Emacs Server section `Emacs Server' dans The GNU Emacs Manual) runs these two hooks just as a keyboard command does.
[ < ] | [ > ] | [ << ] | [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.