comparison man/lispref/commands.texi @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents 8de8e3f6228a
children 47c30044fc4e
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the XEmacs Lisp Reference Manual. 2 @c This is part of the XEmacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 @c See the file lispref.texi for copying conditions. 4 @c See the file lispref.texi for copying conditions.
5 @setfilename ../../info/commands.info 5 @setfilename ../../info/commands.info
6 @node Command Loop, Keymaps, Minibuffers, Top 6 @node Command Loop, Keymaps, Minibuffers, Top
7 @chapter Command Loop 7 @chapter Command Loop
8 @cindex editor command loop 8 @cindex editor command loop
9 @cindex command loop 9 @cindex command loop
10 10
11 When you run XEmacs, it enters the @dfn{editor command loop} almost 11 When you run XEmacs, it enters the @dfn{editor command loop} almost
12 immediately. This loop reads events, executes their definitions, 12 immediately. This loop reads events, executes their definitions,
13 and displays the results. In this chapter, we describe how these things 13 and displays the results. In this chapter, we describe how these things
14 are done, and the subroutines that allow Lisp programs to do them. 14 are done, and the subroutines that allow Lisp programs to do them.
15 15
16 @menu 16 @menu
17 * Command Overview:: How the command loop reads commands. 17 * Command Overview:: How the command loop reads commands.
18 * Defining Commands:: Specifying how a function should read arguments. 18 * Defining Commands:: Specifying how a function should read arguments.
19 * Interactive Call:: Calling a command, so that it will read arguments. 19 * Interactive Call:: Calling a command, so that it will read arguments.
427 @end table 427 @end table
428 428
429 @node Interactive Examples 429 @node Interactive Examples
430 @subsection Examples of Using @code{interactive} 430 @subsection Examples of Using @code{interactive}
431 @cindex examples of using @code{interactive} 431 @cindex examples of using @code{interactive}
432 @cindex @code{interactive}, examples of using 432 @cindex @code{interactive}, examples of using
433 433
434 Here are some examples of @code{interactive}: 434 Here are some examples of @code{interactive}:
435 435
436 @example 436 @example
437 @group 437 @group
485 @code{command-execute}. If the definition is a function that is a 485 @code{command-execute}. If the definition is a function that is a
486 command, @code{command-execute} calls @code{call-interactively}, which 486 command, @code{command-execute} calls @code{call-interactively}, which
487 reads the arguments and calls the command. You can also call these 487 reads the arguments and calls the command. You can also call these
488 functions yourself. 488 functions yourself.
489 489
490 @defun commandp object 490 @defun commandp function
491 Returns @code{t} if @var{object} is suitable for calling interactively; 491 Returns @code{t} if @var{function} is suitable for calling interactively;
492 that is, if @var{object} is a command. Otherwise, returns @code{nil}. 492 that is, if @var{function} is a command. Otherwise, returns @code{nil}.
493 493
494 The interactively callable objects include strings and vectors (treated 494 The interactively callable objects include strings and vectors (treated
495 as keyboard macros), lambda expressions that contain a top-level call to 495 as keyboard macros), lambda expressions that contain a top-level call to
496 @code{interactive}, compiled-function objects made from such lambda 496 @code{interactive}, compiled-function objects made from such lambda
497 expressions, autoload objects that are declared as interactive 497 expressions, autoload objects that are declared as interactive
506 506
507 See @code{documentation} in @ref{Accessing Documentation}, for a 507 See @code{documentation} in @ref{Accessing Documentation}, for a
508 realistic example of using @code{commandp}. 508 realistic example of using @code{commandp}.
509 @end defun 509 @end defun
510 510
511 @defun call-interactively command &optional record-flag 511 @defun call-interactively command &optional record-flag keys
512 This function calls the interactively callable function @var{command}, 512 This function calls the interactively callable function @var{command},
513 reading arguments according to its interactive calling specifications. 513 reading arguments according to its interactive calling specifications.
514 An error is signaled if @var{command} is not a function or if it cannot 514 An error is signaled if @var{command} is not a function or if it cannot
515 be called interactively (i.e., is not a command). Note that keyboard 515 be called interactively (i.e., is not a command). Note that keyboard
516 macros (strings and vectors) are not accepted, even though they are 516 macros (strings and vectors) are not accepted, even though they are
517 considered commands, because they are not functions. 517 considered commands, because they are not functions.
518 518
519 @c XEmacs feature? 519 @c XEmacs feature?
520 If @var{record-flag} is the symbol @code{lambda}, the interactive 520 If @var{record-flag} is the symbol @code{lambda}, the interactive
521 calling arguments for @code{command} are read and returned as a list, 521 calling arguments for @var{command} are read and returned as a list,
522 but the function is not called on them. 522 but the function is not called on them.
523 523
524 @cindex record command history 524 @cindex record command history
525 If @var{record-flag} is @code{t}, then this command and its arguments 525 If @var{record-flag} is @code{t}, then this command and its arguments
526 are unconditionally added to the list @code{command-history}. 526 are unconditionally added to the list @code{command-history}.
527 Otherwise, the command is added only if it uses the minibuffer to read 527 Otherwise, the command is added only if it uses the minibuffer to read
528 an argument. @xref{Command History}. 528 an argument. @xref{Command History}.
529 @end defun 529 @end defun
530 530
531 @defun command-execute command &optional record-flag 531 @defun command-execute command &optional record-flag keys
532 @cindex keyboard macro execution 532 @cindex keyboard macro execution
533 This function executes @var{command} as an editing command. The 533 This function executes @var{command} as an editing command. The
534 argument @var{command} must satisfy the @code{commandp} predicate; i.e., 534 argument @var{command} must satisfy the @code{commandp} predicate; i.e.,
535 it must be an interactively callable function or a keyboard macro. 535 it must be an interactively callable function or a keyboard macro.
536 536
630 630
631 @node Command Loop Info 631 @node Command Loop Info
632 @section Information from the Command Loop 632 @section Information from the Command Loop
633 633
634 The editor command loop sets several Lisp variables to keep status 634 The editor command loop sets several Lisp variables to keep status
635 records for itself and for commands that are run. 635 records for itself and for commands that are run.
636 636
637 @defvar last-command 637 @defvar last-command
638 This variable records the name of the previous command executed by the 638 This variable records the name of the previous command executed by the
639 command loop (the one before the current command). Normally the value 639 command loop (the one before the current command). Normally the value
640 is a symbol with a function definition, but this is not guaranteed. 640 is a symbol with a function definition, but this is not guaranteed.
790 790
791 For information about how exactly the XEmacs command loop works, 791 For information about how exactly the XEmacs command loop works,
792 @xref{Reading Input}. 792 @xref{Reading Input}.
793 793
794 @defun eventp object 794 @defun eventp object
795 This function returns non-@code{nil} if @var{event} is an input event. 795 This function returns non-@code{nil} if @var{object} is an input event.
796 @end defun 796 @end defun
797 797
798 @menu 798 @menu
799 * Event Types:: Events come in different types. 799 * Event Types:: Events come in different types.
800 * Event Contents:: What the contents of each event type are. 800 * Event Contents:: What the contents of each event type are.
845 @item magic event 845 @item magic event
846 Some window-system-specific action (such as a frame being resized or 846 Some window-system-specific action (such as a frame being resized or
847 a portion of a frame needing to be redrawn) has occurred. The contents 847 a portion of a frame needing to be redrawn) has occurred. The contents
848 of this event are not accessible at the E-Lisp level, but 848 of this event are not accessible at the E-Lisp level, but
849 @code{dispatch-event} knows what to do with an event of this type. 849 @code{dispatch-event} knows what to do with an event of this type.
850 850
851 @item eval event 851 @item eval event
852 This is a special kind of event specifying that a particular function 852 This is a special kind of event specifying that a particular function
853 needs to be called when this event is dispatched. An event of this type 853 needs to be called when this event is dispatched. An event of this type
854 is sometimes placed in the event queue when a magic event is processed. 854 is sometimes placed in the event queue when a magic event is processed.
855 This kind of event should generally just be passed off to 855 This kind of event should generally just be passed off to
1007 1007
1008 @defun key-press-event-p object 1008 @defun key-press-event-p object
1009 This is true if @var{object} is a key-press event. 1009 This is true if @var{object} is a key-press event.
1010 @end defun 1010 @end defun
1011 1011
1012 @defun button-event-p object object 1012 @defun button-event-p object
1013 This is true if @var{object} is a mouse button-press or button-release 1013 This is true if @var{object} is a mouse button-press or button-release
1014 event. 1014 event.
1015 @end defun 1015 @end defun
1016 1016
1017 @defun button-press-event-p object 1017 @defun button-press-event-p object
1325 @item @code{button} 1325 @item @code{button}
1326 The event button. This an integer, either 1, 2 or 3. It is allowed 1326 The event button. This an integer, either 1, 2 or 3. It is allowed
1327 only for button-press and button-release events. 1327 only for button-press and button-release events.
1328 1328
1329 @item @code{modifiers} 1329 @item @code{modifiers}
1330 The event modifiers. This is a list of modifier symbols. It is allowed 1330 The event modifiers. This is a list of modifier symbols. It is allowed
1331 for key-press, button-press, button-release and motion events. 1331 for key-press, button-press, button-release and motion events.
1332 1332
1333 @item @code{x} 1333 @item @code{x}
1334 The event X coordinate. This is an integer. It is relative to the 1334 The event X coordinate. This is an integer. It is relative to the
1335 channel's root window, and is allowed for button-press, button-release 1335 channel's root window, and is allowed for button-press, button-release
1428 (event-properties @var{event}))) 1428 (event-properties @var{event})))
1429 @end lisp 1429 @end lisp
1430 @end defun 1430 @end defun
1431 1431
1432 @defun copy-event event1 &optional event2 1432 @defun copy-event event1 &optional event2
1433 This function makes a copy of the given event object. If a second 1433 This function makes a copy of the event object @var{event1}. If a
1434 argument is given, the first event is copied into the second and the 1434 second event argument @var{event2} is given, @var{event1} is copied into
1435 second is returned. If the second argument is not supplied (or is 1435 @var{event2} and @var{event2} is returned. If @var{event2} is not
1436 @code{nil}) then a new event will be made. 1436 supplied (or is @code{nil}) then a new event will be made, as with
1437 @code{make-event}.
1437 @end defun 1438 @end defun
1438 1439
1439 @defun deallocate-event event 1440 @defun deallocate-event event
1440 This function allows the given event structure to be reused. You 1441 This function allows the given event structure to be reused. You
1441 @strong{MUST NOT} use this event object after calling this function with 1442 @strong{MUST NOT} use this event object after calling this function with
1442 it. You will lose. It is not necessary to call this function, as event 1443 it. You will lose. It is not necessary to call this function, as event
1443 objects are garbage-collected like all other objects; however, it may be 1444 objects are garbage-collected like all other objects; however, it may be
1444 more efficient to explicitly deallocate events when you are sure that 1445 more efficient to explicitly deallocate events when you are sure that
1445 that is safe. 1446 it is safe to do so.
1446 @end defun 1447 @end defun
1447 1448
1448 @node Converting Events 1449 @node Converting Events
1449 @subsection Converting Events 1450 @subsection Converting Events
1450 1451
1451 XEmacs provides some auxiliary functions for converting between events 1452 XEmacs provides some auxiliary functions for converting between events
1452 and other ways of representing keys. These are useful when working with 1453 and other ways of representing keys. These are useful when working with
1453 @sc{ascii} strings and with keymaps. 1454 @sc{ascii} strings and with keymaps.
1454 1455
1455 @defun character-to-event ch &optional event device 1456 @defun character-to-event key-description &optional event console use-console-meta-flag
1456 This function converts a numeric @sc{ascii} value to an event structure, 1457 This function converts a keystroke description to an event structure.
1457 replete with modifier bits. @var{ch} is the character to convert, and 1458 @var{key-description} is the specification of a key stroke, and
1458 @var{event} is the event object to fill in. This function contains 1459 @var{event} is the event object to fill in. This function contains
1459 knowledge about what the codes ``mean''---for example, the number 9 is 1460 knowledge about what the codes ``mean''---for example, the number 9 is
1460 converted to the character @key{Tab}, not the distinct character 1461 converted to the character @key{Tab}, not the distinct character
1461 @key{Control-I}. 1462 @key{Control-I}.
1462 1463
1463 Note that @var{ch} does not have to be a numeric value, but can be a 1464 Note that @var{key-description} can be an integer, a character, a symbol
1464 symbol such as @code{clear} or a list such as @code{(control 1465 such as @code{clear} or a list such as @code{(control backspace)}.
1465 backspace)}. 1466
1466 1467 If optional arg @var{event} is non-@code{nil}, it is modified;
1467 If @code{event} is not @code{nil}, it is modified; otherwise, a 1468 otherwise, a new event object is created. In both cases, the event is
1468 new event object is created. In both cases, the event is returned. 1469 returned.
1469 1470
1470 Optional third arg @var{device} is the device to store in the event; 1471 Optional third arg @var{console} is the console to store in the event,
1471 this also affects whether the high bit is interpreted as a meta key. A 1472 and defaults to the selected console.
1472 value of @code{nil} means use the selected device but always treat the 1473
1473 high bit as meta. 1474 If @var{key-description} is an integer or character, the high bit may be
1475 interpreted as the meta key. (This is done for backward compatibility in
1476 lots of places.) If @var{use-console-meta-flag} is @code{nil}, this
1477 will always be the case. If @var{use-console-meta-flag} is
1478 non-@code{nil}, the @code{meta} flag for @var{console} affects whether
1479 the high bit is interpreted as a meta key. (See @code{set-input-mode}.)
1480 If you don't want this silly meta interpretation done, you should pass
1481 in a list containing the character.
1474 1482
1475 Beware that @code{character-to-event} and @code{event-to-character} are 1483 Beware that @code{character-to-event} and @code{event-to-character} are
1476 not strictly inverse functions, since events contain much more 1484 not strictly inverse functions, since events contain much more
1477 information than the @sc{ascii} character set can encode. 1485 information than the @sc{ascii} character set can encode.
1478 @end defun 1486 @end defun
1538 1546
1539 Lisp programs can read input a key sequence at a time by calling 1547 Lisp programs can read input a key sequence at a time by calling
1540 @code{read-key-sequence}; for example, @code{describe-key} uses it to 1548 @code{read-key-sequence}; for example, @code{describe-key} uses it to
1541 read the key to describe. 1549 read the key to describe.
1542 1550
1543 @defun read-key-sequence prompt 1551 @defun read-key-sequence prompt &optional continue-echo dont-downcase-last
1544 @cindex key sequence 1552 @cindex key sequence
1545 This function reads a sequence of keystrokes or mouse clicks and returns 1553 This function reads a sequence of keystrokes or mouse clicks and returns
1546 it as a vector of events. It keeps reading events until it has 1554 it as a vector of event objects read. It keeps reading events until it
1547 accumulated a full key sequence; that is, enough to specify a non-prefix 1555 has accumulated a full key sequence; that is, enough to specify a
1548 command using the currently active keymaps. 1556 non-prefix command using the currently active keymaps.
1549 1557
1550 The vector and the event objects it contains are freshly created, and 1558 The vector and the event objects it contains are freshly created (and
1551 will not be side-effected by subsequent calls to this function. 1559 so will not be side-effected by subsequent calls to this function).
1552 1560
1553 The function @code{read-key-sequence} suppresses quitting: @kbd{C-g} 1561 The function @code{read-key-sequence} suppresses quitting: @kbd{C-g}
1554 typed while reading with this function works like any other character, 1562 typed while reading with this function works like any other character,
1555 and does not set @code{quit-flag}. @xref{Quitting}. 1563 and does not set @code{quit-flag}. @xref{Quitting}.
1556 1564
1557 The argument @var{prompt} is either a string to be displayed in the echo 1565 The argument @var{prompt} is either a string to be displayed in the echo
1558 area as a prompt, or @code{nil}, meaning not to display a prompt. 1566 area as a prompt, or @code{nil}, meaning not to display a prompt.
1567
1568 Second optional arg @var{continue-echo} non-@code{nil} means this key
1569 echoes as a continuation of the previous key.
1570
1571 Third optional arg @var{dont-downcase-last} non-@code{nil} means do not
1572 convert the last event to lower case. (Normally any upper case event is
1573 converted to lower case if the original event is undefined and the lower
1574 case equivalent is defined.) This argument is provided mostly for
1575 @var{fsf} compatibility; the equivalent effect can be achieved more
1576 generally by binding @code{retry-undefined-key-binding-unshifted} to
1577 @code{nil} around the call to @code{read-key-sequence}.
1559 1578
1560 @c XEmacs feature 1579 @c XEmacs feature
1561 If the user selects a menu item while we are prompting for a key 1580 If the user selects a menu item while we are prompting for a key
1562 sequence, the returned value will be a vector of a single menu-selection 1581 sequence, the returned value will be a vector of a single menu-selection
1563 event (a misc-user event). An error will be signalled if you pass this 1582 event (a misc-user event). An error will be signalled if you pass this
1616 1635
1617 In most cases, the function @code{next-command-event} is more 1636 In most cases, the function @code{next-command-event} is more
1618 appropriate. 1637 appropriate.
1619 @end defun 1638 @end defun
1620 1639
1621 @defun next-command-event &optional event 1640 @defun next-command-event &optional event prompt
1622 This function returns the next available ``user'' event from the window 1641 This function returns the next available ``user'' event from the window
1623 system or terminal driver. Pass this object to @code{dispatch-event} to 1642 system or terminal driver. Pass this object to @code{dispatch-event} to
1624 handle it. If an event object is supplied, it is filled in and 1643 handle it. If an event object is supplied, it is filled in and
1625 returned, otherwise a new event object will be created. 1644 returned, otherwise a new event object will be created.
1626 1645
1743 1762
1744 @cindex prefix argument unreading 1763 @cindex prefix argument unreading
1745 For example, the function that implements numeric prefix arguments reads 1764 For example, the function that implements numeric prefix arguments reads
1746 any number of digits. When it finds a non-digit event, it must unread 1765 any number of digits. When it finds a non-digit event, it must unread
1747 the event so that it can be read normally by the command loop. 1766 the event so that it can be read normally by the command loop.
1748 Likewise, incremental search uses this feature to unread events with no 1767 Likewise, incremental search uses this feature to unread events with no
1749 special meaning in a search, because these events should exit the search 1768 special meaning in a search, because these events should exit the search
1750 and then execute normally. 1769 and then execute normally.
1751 1770
1752 @ignore FSF Emacs stuff 1771 @ignore FSF Emacs stuff
1753 The reliable and easy way to extract events from a key sequence so as to 1772 The reliable and easy way to extract events from a key sequence so as to
1821 cancels any keyboard macro that might be in the process of definition. 1840 cancels any keyboard macro that might be in the process of definition.
1822 It returns @code{nil}. 1841 It returns @code{nil}.
1823 1842
1824 In the following example, the user may type a number of characters right 1843 In the following example, the user may type a number of characters right
1825 after starting the evaluation of the form. After the @code{sleep-for} 1844 after starting the evaluation of the form. After the @code{sleep-for}
1826 finishes sleeping, @code{discard-input} discards any characters typed 1845 finishes sleeping, @code{discard-input} discards any characters typed
1827 during the sleep. 1846 during the sleep.
1828 1847
1829 @example 1848 @example
1830 (progn (sleep-for 2) 1849 (progn (sleep-for 2)
1831 (discard-input)) 1850 (discard-input))
1848 Note that in FSF Emacs, the commands @code{sit-for} and @code{sleep-for} 1867 Note that in FSF Emacs, the commands @code{sit-for} and @code{sleep-for}
1849 take two arguments to specify the time (one integer and one float 1868 take two arguments to specify the time (one integer and one float
1850 value), instead of a single argument that can be either an integer or a 1869 value), instead of a single argument that can be either an integer or a
1851 float. 1870 float.
1852 1871
1853 @defun sit-for seconds &optional nodisp 1872 @defun sit-for seconds &optional nodisplay
1854 This function performs redisplay (provided there is no pending input 1873 This function performs redisplay (provided there is no pending input
1855 from the user), then waits @var{seconds} seconds, or until input is 1874 from the user), then waits @var{seconds} seconds, or until input is
1856 available. The result is @code{t} if @code{sit-for} waited the full 1875 available. The result is @code{t} if @code{sit-for} waited the full
1857 time with no input arriving (see @code{input-pending-p} in @ref{Peeking 1876 time with no input arriving (see @code{input-pending-p} in @ref{Peeking
1858 and Discarding}). Otherwise, the value is @code{nil}. 1877 and Discarding}). Otherwise, the value is @code{nil}.
1859 1878
1860 The argument @var{seconds} need not be an integer. If it is a floating 1879 The argument @var{seconds} need not be an integer. If it is a floating
1861 point number, @code{sit-for} waits for a fractional number of seconds. 1880 point number, @code{sit-for} waits for a fractional number of seconds.
1862 @ignore FSF Emacs stuff
1863 Some systems support only a whole number of seconds; on these systems,
1864 @var{seconds} is rounded down.
1865
1866 The optional argument @var{millisec} specifies an additional waiting
1867 period measured in milliseconds. This adds to the period specified by
1868 @var{seconds}. If the system doesn't support waiting fractions of a
1869 second, you get an error if you specify nonzero @var{millisec}.
1870 @end ignore
1871 1881
1872 @cindex forcing redisplay 1882 @cindex forcing redisplay
1873 Redisplay is normally preempted if input arrives, and does not happen at 1883 Redisplay is normally preempted if input arrives, and does not happen at
1874 all if input is available before it starts. (You can force screen 1884 all if input is available before it starts. (You can force screen
1875 updating in such a case by using @code{force-redisplay}. @xref{Refresh 1885 updating in such a case by using @code{force-redisplay}. @xref{Refresh
1876 Screen}.) If there is no input pending, you can force an update with no 1886 Screen}.) If there is no input pending, you can force an update with no
1877 delay by using @code{(sit-for 0)}. 1887 delay by using @code{(sit-for 0)}.
1878 1888
1879 If @var{nodisp} is non-@code{nil}, then @code{sit-for} does not 1889 If @var{nodisplay} is non-@code{nil}, then @code{sit-for} does not
1880 redisplay, but it still returns as soon as input is available (or when 1890 redisplay, but it still returns as soon as input is available (or when
1881 the timeout elapses). 1891 the timeout elapses).
1882 1892
1883 @ignore 1893 @ignore
1884 Iconifying or deiconifying a frame makes @code{sit-for} return, because 1894 Iconifying or deiconifying a frame makes @code{sit-for} return, because
1944 non-@code{nil} in any way thus causes a quit. 1954 non-@code{nil} in any way thus causes a quit.
1945 1955
1946 At the level of C code, quitting cannot happen just anywhere; only at the 1956 At the level of C code, quitting cannot happen just anywhere; only at the
1947 special places that check @code{quit-flag}. The reason for this is 1957 special places that check @code{quit-flag}. The reason for this is
1948 that quitting at other places might leave an inconsistency in XEmacs's 1958 that quitting at other places might leave an inconsistency in XEmacs's
1949 internal state. Because quitting is delayed until a safe place, quitting 1959 internal state. Because quitting is delayed until a safe place, quitting
1950 cannot make XEmacs crash. 1960 cannot make XEmacs crash.
1951 1961
1952 Certain functions such as @code{read-key-sequence} or 1962 Certain functions such as @code{read-key-sequence} or
1953 @code{read-quoted-char} prevent quitting entirely even though they wait 1963 @code{read-quoted-char} prevent quitting entirely even though they wait
1954 for input. Instead of quitting, @kbd{C-g} serves as the requested 1964 for input. Instead of quitting, @kbd{C-g} serves as the requested
1955 input. In the case of @code{read-key-sequence}, this serves to bring 1965 input. In the case of @code{read-key-sequence}, this serves to bring
1956 about the special behavior of @kbd{C-g} in the command loop. In the 1966 about the special behavior of @kbd{C-g} in the command loop. In the
1957 case of @code{read-quoted-char}, this is so that @kbd{C-q} can be used 1967 case of @code{read-quoted-char}, this is so that @kbd{C-q} can be used
1958 to quote a @kbd{C-g}. 1968 to quote a @kbd{C-g}.
1959 1969
1960 You can prevent quitting for a portion of a Lisp function by binding 1970 You can prevent quitting for a portion of a Lisp function by binding
1961 the variable @code{inhibit-quit} to a non-@code{nil} value. Then, 1971 the variable @code{inhibit-quit} to a non-@code{nil} value. Then,
1962 although @kbd{C-g} still sets @code{quit-flag} to @code{t} as usual, the 1972 although @kbd{C-g} still sets @code{quit-flag} to @code{t} as usual, the
1963 usual result of this---a quit---is prevented. Eventually, 1973 usual result of this---a quit---is prevented. Eventually,
2008 in @ref{Errors}.) 2018 in @ref{Errors}.)
2009 @end deffn 2019 @end deffn
2010 2020
2011 You can specify a character other than @kbd{C-g} to use for quitting. 2021 You can specify a character other than @kbd{C-g} to use for quitting.
2012 See the function @code{set-input-mode} in @ref{Terminal Input}. 2022 See the function @code{set-input-mode} in @ref{Terminal Input}.
2013 2023
2014 @node Prefix Command Arguments 2024 @node Prefix Command Arguments
2015 @section Prefix Command Arguments 2025 @section Prefix Command Arguments
2016 @cindex prefix argument 2026 @cindex prefix argument
2017 @cindex raw prefix argument 2027 @cindex raw prefix argument
2018 @cindex numeric prefix argument 2028 @cindex numeric prefix argument
2079 2089
2080 M-3 M-x display-prefix @print{} 3 ; @r{(Same as @code{C-u 3}.)} 2090 M-3 M-x display-prefix @print{} 3 ; @r{(Same as @code{C-u 3}.)}
2081 2091
2082 C-3 M-x display-prefix @print{} 3 ; @r{(Same as @code{C-u 3}.)} 2092 C-3 M-x display-prefix @print{} 3 ; @r{(Same as @code{C-u 3}.)}
2083 2093
2084 C-u - M-x display-prefix @print{} - 2094 C-u - M-x display-prefix @print{} -
2085 2095
2086 M-- M-x display-prefix @print{} - ; @r{(Same as @code{C-u -}.)} 2096 M-- M-x display-prefix @print{} - ; @r{(Same as @code{C-u -}.)}
2087 2097
2088 C-- M-x display-prefix @print{} - ; @r{(Same as @code{C-u -}.)} 2098 C-- M-x display-prefix @print{} - ; @r{(Same as @code{C-u -}.)}
2089 2099
2090 C-u - 7 M-x display-prefix @print{} -7 2100 C-u - 7 M-x display-prefix @print{} -7
2091 2101
2092 M-- 7 M-x display-prefix @print{} -7 ; @r{(Same as @code{C-u -7}.)} 2102 M-- 7 M-x display-prefix @print{} -7 ; @r{(Same as @code{C-u -7}.)}
2093 2103
2094 C-- 7 M-x display-prefix @print{} -7 ; @r{(Same as @code{C-u -7}.)} 2104 C-- 7 M-x display-prefix @print{} -7 ; @r{(Same as @code{C-u -7}.)}
2095 @end example 2105 @end example
2106 argument, either numeric or raw, in the @code{interactive} declaration. 2116 argument, either numeric or raw, in the @code{interactive} declaration.
2107 (@xref{Using Interactive}.) Alternatively, functions may look at the 2117 (@xref{Using Interactive}.) Alternatively, functions may look at the
2108 value of the prefix argument directly in the variable 2118 value of the prefix argument directly in the variable
2109 @code{current-prefix-arg}, but this is less clean. 2119 @code{current-prefix-arg}, but this is less clean.
2110 2120
2111 @defun prefix-numeric-value arg 2121 @defun prefix-numeric-value raw
2112 This function returns the numeric meaning of a valid raw prefix argument 2122 This function returns the numeric meaning of a valid raw prefix argument
2113 value, @var{arg}. The argument may be a symbol, a number, or a list. 2123 value, @var{raw}. The argument may be a symbol, a number, or a list.
2114 If it is @code{nil}, the value 1 is returned; if it is @code{-}, the 2124 If it is @code{nil}, the value 1 is returned; if it is @code{-}, the
2115 value @minus{}1 is returned; if it is a number, that number is returned; 2125 value @minus{}1 is returned; if it is a number, that number is returned;
2116 if it is a list, the @sc{car} of that list (which should be a number) is 2126 if it is a list, the @sc{car} of that list (which should be a number) is
2117 returned. 2127 returned.
2118 @end defun 2128 @end defun
2217 a recursive edit but also provides the other features of the debugger. 2227 a recursive edit but also provides the other features of the debugger.
2218 2228
2219 Recursive editing levels are also used when you type @kbd{C-r} in 2229 Recursive editing levels are also used when you type @kbd{C-r} in
2220 @code{query-replace} or use @kbd{C-x q} (@code{kbd-macro-query}). 2230 @code{query-replace} or use @kbd{C-x q} (@code{kbd-macro-query}).
2221 2231
2222 @defun recursive-edit 2232 @deffn Command recursive-edit
2223 @cindex suspend evaluation 2233 @cindex suspend evaluation
2224 This function invokes the editor command loop. It is called 2234 This function invokes the editor command loop. It is called
2225 automatically by the initialization of XEmacs, to let the user begin 2235 automatically by the initialization of XEmacs, to let the user begin
2226 editing. When called from a Lisp program, it enters a recursive editing 2236 editing. When called from a Lisp program, it enters a recursive editing
2227 level. 2237 level.
2239 (forward-word 1)) 2249 (forward-word 1))
2240 @result{} simple-rec 2250 @result{} simple-rec
2241 (simple-rec) 2251 (simple-rec)
2242 @result{} nil 2252 @result{} nil
2243 @end example 2253 @end example
2244 @end defun 2254 @end deffn
2245 2255
2246 @deffn Command exit-recursive-edit 2256 @deffn Command exit-recursive-edit
2247 This function exits from the innermost recursive edit (including 2257 This function exits from the innermost recursive edit (including
2248 minibuffer input). Its definition is effectively @code{(throw 'exit 2258 minibuffer input). Its definition is effectively @code{(throw 'exit
2249 nil)}. 2259 nil)}.
2250 @end deffn 2260 @end deffn
2251 2261
2252 @deffn Command abort-recursive-edit 2262 @deffn Command abort-recursive-edit
2253 This function aborts the command that requested the innermost recursive 2263 This function aborts the command that requested the innermost recursive
2254 edit (including minibuffer input), by signaling @code{quit} 2264 edit (including minibuffer input), by signaling @code{quit}
2255 after exiting the recursive edit. Its definition is effectively 2265 after exiting the recursive edit. Its definition is effectively
2256 @code{(throw 'exit t)}. @xref{Quitting}. 2266 @code{(throw 'exit t)}. @xref{Quitting}.
2257 @end deffn 2267 @end deffn
2258 2268
2259 @deffn Command top-level 2269 @deffn Command top-level
2392 not a symbol, string, or vector, an error is signaled. 2402 not a symbol, string, or vector, an error is signaled.
2393 2403
2394 The argument @var{count} is a repeat count; @var{macro} is executed that 2404 The argument @var{count} is a repeat count; @var{macro} is executed that
2395 many times. If @var{count} is omitted or @code{nil}, @var{macro} is 2405 many times. If @var{count} is omitted or @code{nil}, @var{macro} is
2396 executed once. If it is 0, @var{macro} is executed over and over until it 2406 executed once. If it is 0, @var{macro} is executed over and over until it
2397 encounters an error or a failing search. 2407 encounters an error or a failing search.
2398 @end defun 2408 @end defun
2399 2409
2400 @defvar executing-macro 2410 @defvar executing-macro
2401 This variable contains the string or vector that defines the keyboard 2411 This variable contains the string or vector that defines the keyboard
2402 macro that is currently executing. It is @code{nil} if no macro is 2412 macro that is currently executing. It is @code{nil} if no macro is