/[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 by eliz, Wed May 8 17:59:04 2002 UTC revision 1.36.2.1 by miles, Fri Apr 4 06:20:41 2003 UTC
# Line 1  Line 1 
1  @c -*-texinfo-*-  @c -*-texinfo-*-
2  @c This is part of the GNU Emacs Lisp Reference Manual.  @c This is part of the GNU Emacs Lisp Reference Manual.
3  @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999  @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
4  @c   Free Software Foundation, Inc.  @c   Free Software Foundation, Inc.
5  @c See the file elisp.texi for copying conditions.  @c See the file elisp.texi for copying conditions.
6  @setfilename ../info/commands  @setfilename ../info/commands
7  @node Command Loop, Keymaps, Minibuffers, Top  @node Command Loop, Keymaps, Minibuffers, Top
# Line 12  Line 12 
12    When you run Emacs, it enters the @dfn{editor command loop} almost    When you run Emacs, it enters the @dfn{editor command loop} almost
13  immediately.  This loop reads key sequences, executes their definitions,  immediately.  This loop reads key sequences, executes their definitions,
14  and displays the results.  In this chapter, we describe how these things  and displays the results.  In this chapter, we describe how these things
15  are done, and the subroutines that allow Lisp programs to do them.    are done, and the subroutines that allow Lisp programs to do them.
16    
17  @menu  @menu
18  * Command Overview::    How the command loop reads commands.  * Command Overview::    How the command loop reads commands.
# Line 442  argument value.  Completion, Existing, P Line 442  argument value.  Completion, Existing, P
442  @comment  node-name,  next,  previous,  up  @comment  node-name,  next,  previous,  up
443  @subsection Examples of Using @code{interactive}  @subsection Examples of Using @code{interactive}
444  @cindex examples of using @code{interactive}  @cindex examples of using @code{interactive}
445  @cindex @code{interactive}, examples of using  @cindex @code{interactive}, examples of using
446    
447    Here are some examples of @code{interactive}:    Here are some examples of @code{interactive}:
448    
# Line 501  command.  You can also call these functi Line 501  command.  You can also call these functi
501    
502  @defun commandp object  @defun commandp object
503  Returns @code{t} if @var{object} is suitable for calling interactively;  Returns @code{t} if @var{object} is suitable for calling interactively;
504  that is, if @var{object} is a command.  Otherwise, returns @code{nil}.    that is, if @var{object} is a command.  Otherwise, returns @code{nil}.
505    
506  The interactively callable objects include strings and vectors (treated  The interactively callable objects include strings and vectors (treated
507  as keyboard macros), lambda expressions that contain a top-level call to  as keyboard macros), lambda expressions that contain a top-level call to
# Line 664  non-@code{nil}.  Here's how: Line 664  non-@code{nil}.  Here's how:
664  @section Information from the Command Loop  @section Information from the Command Loop
665    
666  The editor command loop sets several Lisp variables to keep status  The editor command loop sets several Lisp variables to keep status
667  records for itself and for commands that are run.    records for itself and for commands that are run.
668    
669  @defvar last-command  @defvar last-command
670  This variable records the name of the previous command executed by the  This variable records the name of the previous command executed by the
# Line 1272  The event type of a double-click event c Line 1272  The event type of a double-click event c
1272  @key{meta} held down comes to the Lisp program as  @key{meta} held down comes to the Lisp program as
1273  @code{M-double-mouse-2}.  If a double-click event has no binding, the  @code{M-double-mouse-2}.  If a double-click event has no binding, the
1274  binding of the corresponding ordinary click event is used to execute  binding of the corresponding ordinary click event is used to execute
1275  it.  Thus, you need not pay attention to the double click feature  it.  Thus, you need not pay attention to the double click feature
1276  unless you really want to.  unless you really want to.
1277    
1278  When the user performs a double click, Emacs generates first an ordinary  When the user performs a double click, Emacs generates first an ordinary
# Line 2131  functions to read command input. Line 2131  functions to read command input.
2131  For example, the function that implements numeric prefix arguments reads  For example, the function that implements numeric prefix arguments reads
2132  any number of digits.  When it finds a non-digit event, it must unread  any number of digits.  When it finds a non-digit event, it must unread
2133  the event so that it can be read normally by the command loop.  the event so that it can be read normally by the command loop.
2134  Likewise, incremental search uses this feature to unread events with no  Likewise, incremental search uses this feature to unread events with no
2135  special meaning in a search, because these events should exit the search  special meaning in a search, because these events should exit the search
2136  and then execute normally.  and then execute normally.
2137    
# Line 2200  It returns @code{nil}. Line 2200  It returns @code{nil}.
2200    
2201  In the following example, the user may type a number of characters right  In the following example, the user may type a number of characters right
2202  after starting the evaluation of the form.  After the @code{sleep-for}  after starting the evaluation of the form.  After the @code{sleep-for}
2203  finishes sleeping, @code{discard-input} discards any characters typed  finishes sleeping, @code{discard-input} discards any characters typed
2204  during the sleep.  during the sleep.
2205    
2206  @example  @example
# Line 2251  screen. Line 2251  screen.
2251  This function performs redisplay (provided there is no pending input  This function performs redisplay (provided there is no pending input
2252  from the user), then waits @var{seconds} seconds, or until input is  from the user), then waits @var{seconds} seconds, or until input is
2253  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
2254  time with no input arriving (see @code{input-pending-p} in @ref{Event  time with no input arriving (see @code{input-pending-p} in @ref{Event
2255  Input Misc}).  Otherwise, the value is @code{nil}.  Input Misc}).  Otherwise, the value is @code{nil}.
2256    
2257  The argument @var{seconds} need not be an integer.  If it is a floating  The argument @var{seconds} need not be an integer.  If it is a floating
# Line 2334  non-@code{nil} in any way thus causes a Line 2334  non-@code{nil} in any way thus causes a
2334    At the level of C code, quitting cannot happen just anywhere; only at the    At the level of C code, quitting cannot happen just anywhere; only at the
2335  special places that check @code{quit-flag}.  The reason for this is  special places that check @code{quit-flag}.  The reason for this is
2336  that quitting at other places might leave an inconsistency in Emacs's  that quitting at other places might leave an inconsistency in Emacs's
2337  internal state.  Because quitting is delayed until a safe place, quitting  internal state.  Because quitting is delayed until a safe place, quitting
2338  cannot make Emacs crash.  cannot make Emacs crash.
2339    
2340    Certain functions such as @code{read-key-sequence} or    Certain functions such as @code{read-key-sequence} or
# Line 2343  for input.  Instead of quitting, @kbd{C- Line 2343  for input.  Instead of quitting, @kbd{C-
2343  input.  In the case of @code{read-key-sequence}, this serves to bring  input.  In the case of @code{read-key-sequence}, this serves to bring
2344  about the special behavior of @kbd{C-g} in the command loop.  In the  about the special behavior of @kbd{C-g} in the command loop.  In the
2345  case of @code{read-quoted-char}, this is so that @kbd{C-q} can be used  case of @code{read-quoted-char}, this is so that @kbd{C-q} can be used
2346  to quote a @kbd{C-g}.    to quote a @kbd{C-g}.
2347    
2348  @cindex prevent quitting  @cindex prevent quitting
2349    You can prevent quitting for a portion of a Lisp function by binding    You can prevent quitting for a portion of a Lisp function by binding
# Line 2399  in @ref{Errors}.) Line 2399  in @ref{Errors}.)
2399    
2400    You can specify a character other than @kbd{C-g} to use for quitting.    You can specify a character other than @kbd{C-g} to use for quitting.
2401  See the function @code{set-input-mode} in @ref{Terminal Input}.  See the function @code{set-input-mode} in @ref{Terminal Input}.
2402    
2403  @node Prefix Command Arguments  @node Prefix Command Arguments
2404  @section Prefix Command Arguments  @section Prefix Command Arguments
2405  @cindex prefix argument  @cindex prefix argument
# Line 2468  C-u 3   M-x display-prefix  @print{} 3 Line 2468  C-u 3   M-x display-prefix  @print{} 3
2468    
2469  M-3     M-x display-prefix  @print{} 3      ; @r{(Same as @code{C-u 3}.)}  M-3     M-x display-prefix  @print{} 3      ; @r{(Same as @code{C-u 3}.)}
2470    
2471  C-u -   M-x display-prefix  @print{} -        C-u -   M-x display-prefix  @print{} -
2472    
2473  M--     M-x display-prefix  @print{} -      ; @r{(Same as @code{C-u -}.)}  M--     M-x display-prefix  @print{} -      ; @r{(Same as @code{C-u -}.)}
2474    
2475  C-u - 7 M-x display-prefix  @print{} -7      C-u - 7 M-x display-prefix  @print{} -7
2476    
2477  M-- 7   M-x display-prefix  @print{} -7     ; @r{(Same as @code{C-u -7}.)}  M-- 7   M-x display-prefix  @print{} -7     ; @r{(Same as @code{C-u -7}.)}
2478  @end example  @end example
# Line 2633  then type @kbd{C-M-c} to exit and contin Line 2633  then type @kbd{C-M-c} to exit and contin
2633  @deffn Command exit-recursive-edit  @deffn Command exit-recursive-edit
2634  This function exits from the innermost recursive edit (including  This function exits from the innermost recursive edit (including
2635  minibuffer input).  Its definition is effectively @code{(throw 'exit  minibuffer input).  Its definition is effectively @code{(throw 'exit
2636  nil)}.    nil)}.
2637  @end deffn  @end deffn
2638    
2639  @deffn Command abort-recursive-edit  @deffn Command abort-recursive-edit
2640  This function aborts the command that requested the innermost recursive  This function aborts the command that requested the innermost recursive
2641  edit (including minibuffer input), by signaling @code{quit}  edit (including minibuffer input), by signaling @code{quit}
2642  after exiting the recursive edit.  Its definition is effectively  after exiting the recursive edit.  Its definition is effectively
2643  @code{(throw 'exit t)}.  @xref{Quitting}.  @code{(throw 'exit t)}.  @xref{Quitting}.
2644  @end deffn  @end deffn
# Line 2731  the command to be considered complex. Line 2731  the command to be considered complex.
2731  This variable's value is a list of recent complex commands, each  This variable's value is a list of recent complex commands, each
2732  represented as a form to evaluate.  It continues to accumulate all  represented as a form to evaluate.  It continues to accumulate all
2733  complex commands for the duration of the editing session, but when it  complex commands for the duration of the editing session, but when it
2734  reaches the maximum size (specified by the variable  reaches the maximum size (@pxref{Minibuffer History}), the oldest
2735  @code{history-length}), the oldest elements are deleted as new ones are  elements are deleted as new ones are added.
 added.  
2736    
2737  @example  @example
2738  @group  @group
# Line 2781  not a symbol, string, or vector, an erro Line 2780  not a symbol, string, or vector, an erro
2780  The argument @var{count} is a repeat count; @var{kbdmacro} is executed that  The argument @var{count} is a repeat count; @var{kbdmacro} is executed that
2781  many times.  If @var{count} is omitted or @code{nil}, @var{kbdmacro} is  many times.  If @var{count} is omitted or @code{nil}, @var{kbdmacro} is
2782  executed once.  If it is 0, @var{kbdmacro} is executed over and over until it  executed once.  If it is 0, @var{kbdmacro} is executed over and over until it
2783  encounters an error or a failing search.    encounters an error or a failing search.
2784    
2785  @xref{Reading One Event}, for an example of using @code{execute-kbd-macro}.  @xref{Reading One Event}, for an example of using @code{execute-kbd-macro}.
2786  @end defun  @end defun

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

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