This function returns non-@code{nil} if @var{object} is an input event
or event type.
-Note that any symbol might be used as an event or an event type.
-@code{eventp} cannot distinguish whether a symbol is intended by Lisp
-code to be used as an event. Instead, it distinguishes whether the
-symbol has actually been used in an event that has been read as input in
-the current Emacs session. If a symbol has not yet been so used,
-@code{eventp} returns @code{nil}.
+Note that any non-@code{nil} symbol might be used as an event or an
+event type; @code{eventp} cannot distinguish whether a symbol is
+intended by Lisp code to be used as an event.
@end defun
@menu
@subsection Recording Input
@cindex recording input
-@defun recent-keys
+@defun recent-keys &optional include-cmds
This function returns a vector containing the last 300 input events from
the keyboard or mouse. All input events are included, whether or not
they were used as parts of key sequences. Thus, you always get the last
(These are excluded because they are less interesting for debugging; it
should be enough to see the events that invoked the macros.)
+If @var{include-cmds} is non-@code{nil}, complete key sequences in the
+result vector are interleaved with pseudo-events of the form
+@code{(nil . @var{COMMAND})}, where @var{COMMAND} is the binding of
+the key sequence (@pxref{Command Overview}).
+
A call to @code{clear-this-command-keys} (@pxref{Command Loop Info})
causes this function to return an empty vector immediately afterward.
@end defun
** 'make-process' no longer accepts a non-nil ':stop' key. This has
never worked reliably, and now causes an error.
++++
+** 'eventp' no longer returns non-nil for lists whose car is nil.
+This is consistent with the fact that nil, though a symbol, is not a
+valid event type.
+
\f
* Lisp Changes in Emacs 27.1
c)))
key)))
-(defun eventp (obj)
- "True if the argument is an event object."
- (when obj
- (or (integerp obj)
- (and (symbolp obj) obj (not (keywordp obj)))
- (and (consp obj) (symbolp (car obj))))))
+(defun eventp (object)
+ "Return non-nil if OBJECT is an input event or event object."
+ (or (integerp object)
+ (and (if (consp object)
+ (setq object (car object))
+ object)
+ (symbolp object)
+ (not (keywordp object)))))
(defun event-modifiers (event)
"Return a list of symbols representing the modifier keys in event EVENT.
DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 1, 0,
doc: /* Return vector of last few events, not counting those from keyboard macros.
If INCLUDE-CMDS is non-nil, include the commands that were run,
-represented as events of the form (nil . COMMAND). */)
+represented as pseudo-events of the form (nil . COMMAND). */)
(Lisp_Object include_cmds)
{
bool cmds = !NILP (include_cmds);