# HG changeset patch # User Richard M. Stallman # Date 1060795176 0 # Node ID b047788c0a9ccc996649bb904efa26dd9e23d1fd # Parent 2d0c2b7dbf3f415c4eb50f2d9d4bb456e08c118e (Interactive Call): commandp has new arg. (Command Loop Info): Add this-original-command. diff -r 2d0c2b7dbf3f -r b047788c0a9c lispref/commands.texi --- a/lispref/commands.texi Wed Aug 13 00:37:24 2003 +0000 +++ b/lispref/commands.texi Wed Aug 13 17:19:36 2003 +0000 @@ -503,7 +503,7 @@ @code{call-interactively}, which reads the arguments and calls the command. You can also call these functions yourself. -@defun commandp object +@defun commandp object &optional for-call-interactively Returns @code{t} if @var{object} is suitable for calling interactively; that is, if @var{object} is a command. Otherwise, returns @code{nil}. @@ -514,11 +514,13 @@ (non-@code{nil} fourth argument to @code{autoload}), and some of the primitive functions. -A symbol satisfies @code{commandp} if its function definition satisfies -@code{commandp}. - -Keys and keymaps are not commands. Rather, they are used to look up -commands (@pxref{Keymaps}). +A symbol satisfies @code{commandp} if its function definition +satisfies @code{commandp}. Keys and keymaps are not commands. +Rather, they are used to look up commands (@pxref{Keymaps}). + +If @var{for-call-interactively} is non-@code{nil}, then +@code{commandp} returns @code{t} only for objects that +@code{call-interactively} could call---thus, not for keyboard macros. See @code{documentation} in @ref{Accessing Documentation}, for a realistic example of using @code{commandp}. @@ -731,6 +733,14 @@ restore the old value in case of error---a feature of @code{let} which in this case does precisely what we want to avoid. +@defvar this-original-command +This has the same value as @code{this-command} except when command +remapping occurs (@pxref{Remapping Commands}). In that case, +@code{this-command} gives the command actually run (the result of +remapping), and @code{this-original-command} gives the command that +was specified to run but remapped into another command. +@end defvar + @defun this-command-keys This function returns a string or vector containing the key sequence that invoked the present command, plus any previous commands that