/[emacs]/emacs/lispref/commands.texi
ViewVC logotype

Diff of /emacs/lispref/commands.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36.2.1 by miles, Fri Apr 4 06:20:41 2003 UTC revision 1.36.2.2 by miles, Tue Oct 14 23:10:11 2003 UTC
# Line 90  and also when the command loop is first Line 90  and also when the command loop is first
90  these hooks, it terminates execution of the hook, and clears the hook  these hooks, it terminates execution of the hook, and clears the hook
91  variable to @code{nil} so as to prevent an infinite loop of errors.  variable to @code{nil} so as to prevent an infinite loop of errors.
92    
93      A request coming into the Emacs server (@pxref{Emacs Server,,,
94    emacs, The GNU Emacs Manual}) runs these two hooks just as a keyboard
95    command does.
96    
97  @node Defining Commands  @node Defining Commands
98  @section Defining Commands  @section Defining Commands
99  @cindex defining commands  @cindex defining commands
# Line 499  command is a function, @code{command-exe Line 503  command is a function, @code{command-exe
503  @code{call-interactively}, which reads the arguments and calls the  @code{call-interactively}, which reads the arguments and calls the
504  command.  You can also call these functions yourself.  command.  You can also call these functions yourself.
505    
506  @defun commandp object  @defun commandp object &optional for-call-interactively
507  Returns @code{t} if @var{object} is suitable for calling interactively;  Returns @code{t} if @var{object} is suitable for calling interactively;
508  that is, if @var{object} is a command.  Otherwise, returns @code{nil}.  that is, if @var{object} is a command.  Otherwise, returns @code{nil}.
509    
# Line 510  expressions, autoload objects that are d Line 514  expressions, autoload objects that are d
514  (non-@code{nil} fourth argument to @code{autoload}), and some of the  (non-@code{nil} fourth argument to @code{autoload}), and some of the
515  primitive functions.  primitive functions.
516    
517  A symbol satisfies @code{commandp} if its function definition satisfies  A symbol satisfies @code{commandp} if its function definition
518  @code{commandp}.  satisfies @code{commandp}.  Keys and keymaps are not commands.
519    Rather, they are used to look up commands (@pxref{Keymaps}).
520  Keys and keymaps are not commands.  Rather, they are used to look up  
521  commands (@pxref{Keymaps}).  If @var{for-call-interactively} is non-@code{nil}, then
522    @code{commandp} returns @code{t} only for objects that
523    @code{call-interactively} could call---thus, not for keyboard macros.
524    
525  See @code{documentation} in @ref{Accessing Documentation}, for a  See @code{documentation} in @ref{Accessing Documentation}, for a
526  realistic example of using @code{commandp}.  realistic example of using @code{commandp}.
# Line 657  non-@code{nil}.  Here's how: Line 663  non-@code{nil}.  Here's how:
663      (message "foo")))      (message "foo")))
664  @end example  @end example
665    
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}.    The numeric prefix argument, provided by @samp{p}, is never @code{nil}.
671    
672  @node Command Loop Info  @node Command Loop Info
# Line 723  We do not bind @code{this-command} with Line 733  We do not bind @code{this-command} with
733  restore the old value in case of error---a feature of @code{let} which  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.  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    
744  @defun this-command-keys  @defun this-command-keys
745  This function returns a string or vector containing the key sequence  This function returns a string or vector containing the key sequence
746  that invoked the present command, plus any previous commands that  that invoked the present command, plus any previous commands that
# Line 2037  calls that function, passing the charact Line 2055  calls that function, passing the charact
2055  If this is non-@code{nil}, its value specifies the current input method  If this is non-@code{nil}, its value specifies the current input method
2056  function.  function.
2057    
2058  @strong{Note:} Don't bind this variable with @code{let}.  It is often  @strong{Warning:} don't bind this variable with @code{let}.  It is often
2059  buffer-local, and if you bind it around reading input (which is exactly  buffer-local, and if you bind it around reading input (which is exactly
2060  when you @emph{would} bind it), switching buffers asynchronously while  when you @emph{would} bind it), switching buffers asynchronously while
2061  Emacs is waiting will cause the value to be restored in the wrong  Emacs is waiting will cause the value to be restored in the wrong
# Line 2247  the middle of a computation to allow the Line 2265  the middle of a computation to allow the
2265  input comes in, while @code{sleep-for} pauses without updating the  input comes in, while @code{sleep-for} pauses without updating the
2266  screen.  screen.
2267    
2268  @defun sit-for seconds &optional millisec nodisp  @defun sit-for seconds &optional nodisp
2269  This function performs redisplay (provided there is no pending input  This function performs redisplay (provided there is no pending input
2270  from the user), then waits @var{seconds} seconds, or until input is  from the user), then waits @var{seconds} seconds, or until input is
2271  available.  The value is @code{t} if @code{sit-for} waited the full  available.  The value is @code{t} if @code{sit-for} waited the full
# Line 2259  point number, @code{sit-for} waits for a Line 2277  point number, @code{sit-for} waits for a
2277  Some systems support only a whole number of seconds; on these systems,  Some systems support only a whole number of seconds; on these systems,
2278  @var{seconds} is rounded down.  @var{seconds} is rounded down.
2279    
 The optional argument @var{millisec} specifies an additional waiting  
 period measured in milliseconds.  This adds to the period specified by  
 @var{seconds}.  If the system doesn't support waiting fractions of a  
 second, you get an error if you specify nonzero @var{millisec}.  
   
2280  The expression @code{(sit-for 0)} is a convenient way to request a  The expression @code{(sit-for 0)} is a convenient way to request a
2281  redisplay, without any delay.  @xref{Forcing Redisplay}.  redisplay, without any delay.  @xref{Forcing Redisplay}.
2282    
# Line 2276  that generates an event.  @xref{Misc Eve Line 2289  that generates an event.  @xref{Misc Eve
2289    
2290  The usual purpose of @code{sit-for} is to give the user time to read  The usual purpose of @code{sit-for} is to give the user time to read
2291  text that you display.  text that you display.
2292    
2293    It is also possible to call @code{sit-for} with three arguments,
2294    as @code{(sit-for @var{seconds} @var{millisec} @var{nodisp})},
2295    but that is considered obsolete.
2296  @end defun  @end defun
2297    
2298  @defun sleep-for seconds &optional millisec  @defun sleep-for seconds &optional millisec
# Line 2816  This normal hook (@pxref{Standard Hooks} Line 2833  This normal hook (@pxref{Standard Hooks}
2833  macro terminates, regardless of what caused it to terminate (reaching  macro terminates, regardless of what caused it to terminate (reaching
2834  the macro end or an error which ended the macro prematurely).  the macro end or an error which ended the macro prematurely).
2835  @end defvar  @end defvar
2836    
2837    @ignore
2838       arch-tag: e34944ad-7d5c-4980-be00-36a5fe54d4b1
2839    @end ignore

Legend:
Removed from v.1.36.2.1  
changed lines
  Added in v.1.36.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26