Otherwise, the command is added only if it uses the minibuffer to read
an argument. @xref{Command History}.
-The argument @var{keys}, if given, specifies the sequence of events to
-supply if the command inquires which events were used to invoke it.
-If @var{keys} is omitted or @code{nil}, the return value of
-@code{this-command-keys} is used. @xref{Definition of this-command-keys}.
+The argument @var{keys}, if given, should be a vector which specifies
+the sequence of events to supply if the command inquires which events
+were used to invoke it. If @var{keys} is omitted or @code{nil}, the
+default is the return value of @code{this-command-keys-vector}.
+@xref{Definition of this-command-keys-vector}.
@end defun
@defun command-execute command &optional record-flag keys special
@end defvar
@defun this-command-keys
-@anchor{Definition of this-command-keys}
This function returns a string or vector containing the key sequence
that invoked the present command, plus any previous commands that
-generated the prefix argument for this command. However, if the
-command has called @code{read-key-sequence}, it returns the last read
-key sequence. @xref{Key Sequence Input}. The value is a string if
-all events in the sequence were characters that fit in a string.
-@xref{Input Events}.
+generated the prefix argument for this command. Any events read by the
+command using @code{read-event} without a timeout get tacked on to the end.
+
+However, if the command has called @code{read-key-sequence}, it
+returns the last read key sequence. @xref{Key Sequence Input}. The
+value is a string if all events in the sequence were characters that
+fit in a string. @xref{Input Events}.
@example
@group
@end defun
@defun this-command-keys-vector
+@anchor{Definition of this-command-keys-vector}
Like @code{this-command-keys}, except that it always returns the events
in a vector, so you don't need to deal with the complexities of storing
input events in a string (@pxref{Strings of Events}).
parameters are used to display the help-echo text are described in
@ref{Text help-echo}.
-@cindex @code{usr1-signal} event
-@cindex @code{usr2-signal} event
-@item usr1-signal
-@itemx usr2-signal
-These events are generated when the Emacs process receives the signals
-@code{SIGUSR1} and @code{SIGUSR2}. They contain no additional data
-because signals do not carry additional information.
+@cindex @code{signal usr1} event
+@cindex @code{signal usr2} event
+@cindex user signals
+@item signal usr1
+@itemx signal usr2
+These event sequences are generated when the Emacs process receives
+the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no
+additional data because signals do not carry additional information.
@end table
If one of these events arrives in the middle of a key sequence---that
-453816))
@end smallexample
+To handle a SIGUSR1 signal, define an interactive function, and
+bind it to the @code{signal usr1} event sequence:
+
+@smallexample
+(defun usr1-handler ()
+ (interactive)
+ (message "Got USR1 signal"))
+(global-set-key [signal usr1] 'usr1-handler)
+@end smallexample
+
@node Classifying Events
@subsection Classifying Events
@cindex event type
If @var{seconds} is @code{nil}, Emacs is considered idle while waiting
for user input to arrive. Idle timers---those created with
-@code{run-with-idle-timer} (@pxref{Timers})---can run during this
+@code{run-with-idle-timer} (@pxref{Idle Timers})---can run during this
period. However, if @var{seconds} is non-@code{nil}, the state of
idleness remains unchanged. If Emacs is non-idle when
@code{read-event} is called, it remains non-idle throughout the
Normally you add events to the front of this list, so that the events
most recently unread will be reread first.
+
+Events read from this list are not normally added to the current
+command's key sequence (as returned by e.g. @code{this-command-keys}),
+as the events will already have been added once as they were read for
+the first time. An element of the form @code{(@code{t} . @var{event})}
+forces @var{event} to be added to the current command's key sequence.
+
@end defvar
@defun listify-key-sequence key
editing. When called from a Lisp program, it enters a recursive editing
level.
- In the following example, the function @code{simple-rec} first
+If the current buffer is not the same as the selected window's buffer,
+@code{recursive-edit} saves and restores the current buffer. Otherwise,
+if you switch buffers, the buffer you switched to is current after
+@code{recursive-edit} returns.
+
+In the following example, the function @code{simple-rec} first
advances point one word, then enters a recursive edit, printing out a
message in the echo area. The user can then do any editing desired, and
then type @kbd{C-M-c} to exit and continue executing @code{simple-rec}.