comparison lispref/commands.texi @ 88123:375f2633d815

New directory
author Kenichi Handa <handa@m17n.org>
date Mon, 08 Sep 2003 11:56:09 +0000
parents 695cf19ef79e
children 548375b6b1f8
comparison
equal deleted inserted replaced
52428:27bc8b966642 88123:375f2633d815
501 invokes that command using the function @code{command-execute}. If the 501 invokes that command using the function @code{command-execute}. If the
502 command is a function, @code{command-execute} calls 502 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 &optional for-call-interactively 506 @defun commandp object
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
510 The interactively callable objects include strings and vectors (treated 510 The interactively callable objects include strings and vectors (treated
511 as keyboard macros), lambda expressions that contain a top-level call to 511 as keyboard macros), lambda expressions that contain a top-level call to
512 @code{interactive}, byte-code function objects made from such lambda 512 @code{interactive}, byte-code function objects made from such lambda
513 expressions, autoload objects that are declared as interactive 513 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 517 A symbol satisfies @code{commandp} if its function definition satisfies
518 satisfies @code{commandp}. Keys and keymaps are not commands. 518 @code{commandp}.
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.
524 522
525 See @code{documentation} in @ref{Accessing Documentation}, for a 523 See @code{documentation} in @ref{Accessing Documentation}, for a
526 realistic example of using @code{commandp}. 524 realistic example of using @code{commandp}.
527 @end defun 525 @end defun
528 526
661 (interactive "p") 659 (interactive "p")
662 (when print-message 660 (when print-message
663 (message "foo"))) 661 (message "foo")))
664 @end example 662 @end example
665 663
666 @noindent
667 Defined in this way, the function does display the message when
668 called from a keyboard macro.
669
670 The numeric prefix argument, provided by @samp{p}, is never @code{nil}. 664 The numeric prefix argument, provided by @samp{p}, is never @code{nil}.
671 665
672 @node Command Loop Info 666 @node Command Loop Info
673 @comment node-name, next, previous, up 667 @comment node-name, next, previous, up
674 @section Information from the Command Loop 668 @section Information from the Command Loop
730 724
731 @noindent 725 @noindent
732 We do not bind @code{this-command} with @code{let} because that would 726 We do not bind @code{this-command} with @code{let} because that would
733 restore the old value in case of error---a feature of @code{let} which 727 restore the old value in case of error---a feature of @code{let} which
734 in this case does precisely what we want to avoid. 728 in this case does precisely what we want to avoid.
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 729
744 @defun this-command-keys 730 @defun this-command-keys
745 This function returns a string or vector containing the key sequence 731 This function returns a string or vector containing the key sequence
746 that invoked the present command, plus any previous commands that 732 that invoked the present command, plus any previous commands that
747 generated the prefix argument for this command. The value is a string 733 generated the prefix argument for this command. The value is a string
2831 @defvar kbd-macro-termination-hook 2817 @defvar kbd-macro-termination-hook
2832 This normal hook (@pxref{Standard Hooks}) is run when a keyboard 2818 This normal hook (@pxref{Standard Hooks}) is run when a keyboard
2833 macro terminates, regardless of what caused it to terminate (reaching 2819 macro terminates, regardless of what caused it to terminate (reaching
2834 the macro end or an error which ended the macro prematurely). 2820 the macro end or an error which ended the macro prematurely).
2835 @end defvar 2821 @end defvar
2836
2837 @ignore
2838 arch-tag: e34944ad-7d5c-4980-be00-36a5fe54d4b1
2839 @end ignore