diff options
| author | Richard M. Stallman | 2003-08-13 17:19:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-08-13 17:19:36 +0000 |
| commit | 041b0e7bd7df98929d9bf3e035bc3a1da0916a30 (patch) | |
| tree | ba1c0e3ca7bdf7bc6b6c63ce9c2f52c604fc4013 | |
| parent | 1002b9b5d9bf444804b1e1de5b28cbf9889cb18a (diff) | |
| download | emacs-041b0e7bd7df98929d9bf3e035bc3a1da0916a30.tar.gz emacs-041b0e7bd7df98929d9bf3e035bc3a1da0916a30.zip | |
(Interactive Call): commandp has new arg.
(Command Loop Info): Add this-original-command.
| -rw-r--r-- | lispref/commands.texi | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lispref/commands.texi b/lispref/commands.texi index f749ec21d5c..d032f7caf10 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi | |||
| @@ -503,7 +503,7 @@ command is a function, @code{command-execute} calls | |||
| 503 | @code{call-interactively}, which reads the arguments and calls the | 503 | @code{call-interactively}, which reads the arguments and calls the |
| 504 | command. You can also call these functions yourself. | 504 | command. You can also call these functions yourself. |
| 505 | 505 | ||
| 506 | @defun commandp object | 506 | @defun commandp object &optional for-call-interactively |
| 507 | Returns @code{t} if @var{object} is suitable for calling interactively; | 507 | Returns @code{t} if @var{object} is suitable for calling interactively; |
| 508 | that is, if @var{object} is a command. Otherwise, returns @code{nil}. | 508 | that is, if @var{object} is a command. Otherwise, returns @code{nil}. |
| 509 | 509 | ||
| @@ -514,11 +514,13 @@ expressions, autoload objects that are declared as interactive | |||
| 514 | (non-@code{nil} fourth argument to @code{autoload}), and some of the | 514 | (non-@code{nil} fourth argument to @code{autoload}), and some of the |
| 515 | primitive functions. | 515 | primitive functions. |
| 516 | 516 | ||
| 517 | A symbol satisfies @code{commandp} if its function definition satisfies | 517 | A symbol satisfies @code{commandp} if its function definition |
| 518 | @code{commandp}. | 518 | satisfies @code{commandp}. Keys and keymaps are not commands. |
| 519 | Rather, they are used to look up commands (@pxref{Keymaps}). | ||
| 519 | 520 | ||
| 520 | Keys and keymaps are not commands. Rather, they are used to look up | 521 | If @var{for-call-interactively} is non-@code{nil}, then |
| 521 | commands (@pxref{Keymaps}). | 522 | @code{commandp} returns @code{t} only for objects that |
| 523 | @code{call-interactively} could call---thus, not for keyboard macros. | ||
| 522 | 524 | ||
| 523 | See @code{documentation} in @ref{Accessing Documentation}, for a | 525 | See @code{documentation} in @ref{Accessing Documentation}, for a |
| 524 | realistic example of using @code{commandp}. | 526 | realistic example of using @code{commandp}. |
| @@ -731,6 +733,14 @@ We do not bind @code{this-command} with @code{let} because that would | |||
| 731 | restore the old value in case of error---a feature of @code{let} which | 733 | restore the old value in case of error---a feature of @code{let} which |
| 732 | in this case does precisely what we want to avoid. | 734 | in this case does precisely what we want to avoid. |
| 733 | 735 | ||
| 736 | @defvar this-original-command | ||
| 737 | This has the same value as @code{this-command} except when command | ||
| 738 | remapping occurs (@pxref{Remapping Commands}). In that case, | ||
| 739 | @code{this-command} gives the command actually run (the result of | ||
| 740 | remapping), and @code{this-original-command} gives the command that | ||
| 741 | was specified to run but remapped into another command. | ||
| 742 | @end defvar | ||
| 743 | |||
| 734 | @defun this-command-keys | 744 | @defun this-command-keys |
| 735 | This function returns a string or vector containing the key sequence | 745 | This function returns a string or vector containing the key sequence |
| 736 | that invoked the present command, plus any previous commands that | 746 | that invoked the present command, plus any previous commands that |