diff options
| author | Luc Teirlinck | 2004-08-07 01:12:59 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-08-07 01:12:59 +0000 |
| commit | 5504e99ca65abbc04ab68a13612e51b6b5c04e7a (patch) | |
| tree | 0ac67edbaeb0c7fbf868f5f7b0619c0431a2a3c8 /lispref | |
| parent | bdb3097a23f057be4a747831cf69aa957f4f67e1 (diff) | |
| download | emacs-5504e99ca65abbc04ab68a13612e51b6b5c04e7a.tar.gz emacs-5504e99ca65abbc04ab68a13612e51b6b5c04e7a.zip | |
Various changes in addition to:
(Using Interactive): Clarify description of `interactive-form'.
(Interactive Call): Mention default for KEYS argument to
`call-interactively'.
(Command Loop Info): Clarify description of `this-command-keys'.
Mention KEEP-RECORD argument to `clear-this-command-keys'.
Value of `last-event-frame' can be `macro'.
(Repeat Events): `double-click-fuzz' is also used to distinguish
clicks and drags.
(Classifying Events): Clarify descriptions of `event-modifiers'
`event-basic-type' and `event-convert-list'.
(Accessing Events): `posn-timestamp' takes POSITION argument.
(Quoted Character Input): Clarify description of
`read-quoted-char' and fix example.
(Quitting): Add `with-local-quit'.
(Disabling Commands): Correct and clarify descriptions of
`enable-command' and `disable-command'.
Mention what happens if `disabled-command-hook' is nil.
(Keyboard Macros): Mention LOOPFUNC arg to `execute-kbd-macro'.
Describe `executing-kbd-macro' instead of obsolete `executing-macro'.
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/ChangeLog | 26 | ||||
| -rw-r--r-- | lispref/commands.texi | 169 |
2 files changed, 139 insertions, 56 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 146f2173864..adfd17b5318 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,29 @@ | |||
| 1 | 2004-08-06 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * minibuf.texi (High-Level Completion): Add anchor for definition | ||
| 4 | of `read-variable'. | ||
| 5 | |||
| 6 | * commands.texi: Various changes in addition to: | ||
| 7 | (Using Interactive): Clarify description of `interactive-form'. | ||
| 8 | (Interactive Call): Mention default for KEYS argument to | ||
| 9 | `call-interactively'. | ||
| 10 | (Command Loop Info): Clarify description of `this-command-keys'. | ||
| 11 | Mention KEEP-RECORD argument to `clear-this-command-keys'. | ||
| 12 | Value of `last-event-frame' can be `macro'. | ||
| 13 | (Repeat Events): `double-click-fuzz' is also used to distinguish | ||
| 14 | clicks and drags. | ||
| 15 | (Classifying Events): Clarify descriptions of `event-modifiers' | ||
| 16 | `event-basic-type' and `event-convert-list'. | ||
| 17 | (Accessing Events): `posn-timestamp' takes POSITION argument. | ||
| 18 | (Quoted Character Input): Clarify description of | ||
| 19 | `read-quoted-char' and fix example. | ||
| 20 | (Quitting): Add `with-local-quit'. | ||
| 21 | (Disabling Commands): Correct and clarify descriptions of | ||
| 22 | `enable-command' and `disable-command'. | ||
| 23 | Mention what happens if `disabled-command-hook' is nil. | ||
| 24 | (Keyboard Macros): Mention LOOPFUNC arg to `execute-kbd-macro'. | ||
| 25 | Describe `executing-kbd-macro' instead of obsolete `executing-macro'. | ||
| 26 | |||
| 1 | 2004-07-24 Luc Teirlinck <teirllm@auburn.edu> | 27 | 2004-07-24 Luc Teirlinck <teirllm@auburn.edu> |
| 2 | 28 | ||
| 3 | * frames.texi: Various changes in addition to: | 29 | * frames.texi: Various changes in addition to: |
diff --git a/lispref/commands.texi b/lispref/commands.texi index 7a014080e89..d568805d6be 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004 |
| 4 | @c Free Software Foundation, Inc. | 4 | @c Free Software Foundation, Inc. |
| 5 | @c See the file elisp.texi for copying conditions. | 5 | @c See the file elisp.texi for copying conditions. |
| 6 | @setfilename ../info/commands | 6 | @setfilename ../info/commands |
| @@ -119,7 +119,7 @@ controls the reading of arguments for an interactive call. | |||
| 119 | 119 | ||
| 120 | This section describes how to write the @code{interactive} form that | 120 | This section describes how to write the @code{interactive} form that |
| 121 | makes a Lisp function an interactively-callable command, and how to | 121 | makes a Lisp function an interactively-callable command, and how to |
| 122 | examine a commands's @code{interactive} form. | 122 | examine a command's @code{interactive} form. |
| 123 | 123 | ||
| 124 | @defspec interactive arg-descriptor | 124 | @defspec interactive arg-descriptor |
| 125 | @cindex argument descriptors | 125 | @cindex argument descriptors |
| @@ -235,12 +235,13 @@ string (starting with the first character that is not @samp{*} or | |||
| 235 | 235 | ||
| 236 | @cindex examining the @code{interactive} form | 236 | @cindex examining the @code{interactive} form |
| 237 | @defun interactive-form function | 237 | @defun interactive-form function |
| 238 | This function returns the @code{interactive} form of @var{function}. If | 238 | This function returns the @code{interactive} form of @var{function}. |
| 239 | @var{function} is a command (@pxref{Interactive Call}), the value is a | 239 | If @var{function} is an interactively callable function |
| 240 | list of the form @code{(interactive @var{spec})}, where @var{spec} is | 240 | (@pxref{Interactive Call}), the value is the command's |
| 241 | the descriptor specification used by the command's @code{interactive} | 241 | @code{interactive} form @code{(interactive @var{spec})}, which |
| 242 | form to compute the function's arguments. If @var{function} is not a | 242 | specifies how to compute its arguments. Otherwise, the value is |
| 243 | command, @code{interactive-form} returns @code{nil}. | 243 | @code{nil}. If @var{function} is a symbol, its function definition is |
| 244 | used. | ||
| 244 | @end defun | 245 | @end defun |
| 245 | 246 | ||
| 246 | @node Interactive Codes | 247 | @node Interactive Codes |
| @@ -416,8 +417,9 @@ the string.) Other characters that normally terminate a symbol (e.g., | |||
| 416 | parentheses and brackets) do not do so here. Prompt. | 417 | parentheses and brackets) do not do so here. Prompt. |
| 417 | 418 | ||
| 418 | @item v | 419 | @item v |
| 419 | A variable declared to be a user option (i.e., satisfying the predicate | 420 | A variable declared to be a user option (i.e., satisfying the |
| 420 | @code{user-variable-p}). @xref{High-Level Completion}. Existing, | 421 | predicate @code{user-variable-p}). This reads the variable using |
| 422 | @code{read-variable}. @xref{Definition of read-variable}. Existing, | ||
| 421 | Completion, Prompt. | 423 | Completion, Prompt. |
| 422 | 424 | ||
| 423 | @item x | 425 | @item x |
| @@ -528,10 +530,12 @@ realistic example of using @code{commandp}. | |||
| 528 | @defun call-interactively command &optional record-flag keys | 530 | @defun call-interactively command &optional record-flag keys |
| 529 | This function calls the interactively callable function @var{command}, | 531 | This function calls the interactively callable function @var{command}, |
| 530 | reading arguments according to its interactive calling specifications. | 532 | reading arguments according to its interactive calling specifications. |
| 531 | An error is signaled if @var{command} is not a function or if it cannot | 533 | It returns whatever @var{command} returns. An error is signaled if |
| 532 | be called interactively (i.e., is not a command). Note that keyboard | 534 | @var{command} is not a function or if it cannot be called |
| 533 | macros (strings and vectors) are not accepted, even though they are | 535 | interactively (i.e., is not a command). Note that keyboard macros |
| 534 | considered commands, because they are not functions. | 536 | (strings and vectors) are not accepted, even though they are |
| 537 | considered commands, because they are not functions. If @var{command} | ||
| 538 | is a symbol, then @code{call-interactively} uses its function definition. | ||
| 535 | 539 | ||
| 536 | @cindex record command history | 540 | @cindex record command history |
| 537 | If @var{record-flag} is non-@code{nil}, then this command and its | 541 | If @var{record-flag} is non-@code{nil}, then this command and its |
| @@ -541,6 +545,8 @@ an argument. @xref{Command History}. | |||
| 541 | 545 | ||
| 542 | The argument @var{keys}, if given, specifies the sequence of events to | 546 | The argument @var{keys}, if given, specifies the sequence of events to |
| 543 | supply if the command inquires which events were used to invoke it. | 547 | supply if the command inquires which events were used to invoke it. |
| 548 | If @var{keys} is omitted or @code{nil}, the return value of | ||
| 549 | @code{this-command-keys} is used. @xref{Definition of this-command-keys}. | ||
| 544 | @end defun | 550 | @end defun |
| 545 | 551 | ||
| 546 | @defun command-execute command &optional record-flag keys special | 552 | @defun command-execute command &optional record-flag keys special |
| @@ -551,7 +557,8 @@ callable function or a keyboard macro. | |||
| 551 | 557 | ||
| 552 | A string or vector as @var{command} is executed with | 558 | A string or vector as @var{command} is executed with |
| 553 | @code{execute-kbd-macro}. A function is passed to | 559 | @code{execute-kbd-macro}. A function is passed to |
| 554 | @code{call-interactively}, along with the optional @var{record-flag}. | 560 | @code{call-interactively}, along with the optional @var{record-flag} |
| 561 | and @var{keys}. | ||
| 555 | 562 | ||
| 556 | A symbol is handled by using its function definition in its place. A | 563 | A symbol is handled by using its function definition in its place. A |
| 557 | symbol with an @code{autoload} definition counts as a command if it was | 564 | symbol with an @code{autoload} definition counts as a command if it was |
| @@ -559,9 +566,6 @@ declared to stand for an interactively callable function. Such a | |||
| 559 | definition is handled by loading the specified library and then | 566 | definition is handled by loading the specified library and then |
| 560 | rechecking the definition of the symbol. | 567 | rechecking the definition of the symbol. |
| 561 | 568 | ||
| 562 | The argument @var{keys}, if given, specifies the sequence of events to | ||
| 563 | supply if the command inquires which events were used to invoke it. | ||
| 564 | |||
| 565 | The argument @var{special}, if given, means to ignore the prefix | 569 | The argument @var{special}, if given, means to ignore the prefix |
| 566 | argument and not clear it. This is used for executing special events | 570 | argument and not clear it. This is used for executing special events |
| 567 | (@pxref{Special Events}). | 571 | (@pxref{Special Events}). |
| @@ -741,10 +745,14 @@ was specified to run but remapped into another command. | |||
| 741 | @end defvar | 745 | @end defvar |
| 742 | 746 | ||
| 743 | @defun this-command-keys | 747 | @defun this-command-keys |
| 748 | @anchor{Definition of this-command-keys} | ||
| 744 | This function returns a string or vector containing the key sequence | 749 | This function returns a string or vector containing the key sequence |
| 745 | that invoked the present command, plus any previous commands that | 750 | that invoked the present command, plus any previous commands that |
| 746 | generated the prefix argument for this command. The value is a string | 751 | generated the prefix argument for this command. However, if the |
| 747 | if all those events were characters. @xref{Input Events}. | 752 | command has called @code{read-key-sequence}, it returns the last read |
| 753 | key sequence. @xref{Definition of read-key-sequence}. The value is a | ||
| 754 | string if all events in the sequence were characters that fit in a | ||
| 755 | string. @xref{Input Events}. | ||
| 748 | 756 | ||
| 749 | @example | 757 | @example |
| 750 | @group | 758 | @group |
| @@ -762,13 +770,13 @@ input events in a string (@pxref{Strings of Events}). | |||
| 762 | @end defun | 770 | @end defun |
| 763 | 771 | ||
| 764 | @tindex clear-this-command-keys | 772 | @tindex clear-this-command-keys |
| 765 | @defun clear-this-command-keys | 773 | @defun clear-this-command-keys &optional keep-record |
| 766 | This function empties out the table of events for | 774 | This function empties out the table of events for |
| 767 | @code{this-command-keys} to return, and also empties the records that | 775 | @code{this-command-keys} to return. Unless @var{keep-record} is |
| 768 | the function @code{recent-keys} (@pxref{Recording Input}) will | 776 | non-@code{nil}, it also empties the records that the function |
| 769 | subsequently return. This is useful after reading a password, to | 777 | @code{recent-keys} (@pxref{Recording Input}) will subsequently return. |
| 770 | prevent the password from echoing inadvertently as part of the next | 778 | This is useful after reading a password, to prevent the password from |
| 771 | command in certain cases. | 779 | echoing inadvertently as part of the next command in certain cases. |
| 772 | @end defun | 780 | @end defun |
| 773 | 781 | ||
| 774 | @defvar last-nonmenu-event | 782 | @defvar last-nonmenu-event |
| @@ -809,6 +817,8 @@ Usually this is the frame that was selected when the event was | |||
| 809 | generated, but if that frame has redirected input focus to another | 817 | generated, but if that frame has redirected input focus to another |
| 810 | frame, the value is the frame to which the event was redirected. | 818 | frame, the value is the frame to which the event was redirected. |
| 811 | @xref{Input Focus}. | 819 | @xref{Input Focus}. |
| 820 | |||
| 821 | If the last event came from a keyboard macro, the value is @code{macro}. | ||
| 812 | @end defvar | 822 | @end defvar |
| 813 | 823 | ||
| 814 | @node Adjusting Point | 824 | @node Adjusting Point |
| @@ -1155,7 +1165,7 @@ the marginal areas, @var{position} has this form: | |||
| 1155 | 1165 | ||
| 1156 | @example | 1166 | @example |
| 1157 | (@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp} | 1167 | (@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp} |
| 1158 | @var{object} @var{text-pos} (@var{col} . @var{row}) | 1168 | @var{object} @var{text-pos} (@var{col} . @var{row}) |
| 1159 | @var{image} (@var{dx} . @var{dy}) (@var{width} . @var{height})) | 1169 | @var{image} (@var{dx} . @var{dy}) (@var{width} . @var{height})) |
| 1160 | @end example | 1170 | @end example |
| 1161 | 1171 | ||
| @@ -1387,22 +1397,25 @@ the value is 3 or greater. If @var{event} is an ordinary mouse event | |||
| 1387 | (not a repeat event), the value is 1. | 1397 | (not a repeat event), the value is 1. |
| 1388 | @end defun | 1398 | @end defun |
| 1389 | 1399 | ||
| 1390 | @defvar double-click-fuzz | 1400 | @defopt double-click-fuzz |
| 1391 | To generate repeat events, successive mouse button presses must be at | 1401 | To generate repeat events, successive mouse button presses must be at |
| 1392 | approximately the same screen position. The value of | 1402 | approximately the same screen position. The value of |
| 1393 | @code{double-click-fuzz} specifies the maximum number of pixels the | 1403 | @code{double-click-fuzz} specifies the maximum number of pixels the |
| 1394 | mouse may be moved between two successive clicks to make a | 1404 | mouse may be moved (horizontally or vertically) between two successive |
| 1395 | double-click. | 1405 | clicks to make a double-click. |
| 1396 | @end defvar | ||
| 1397 | 1406 | ||
| 1398 | @defvar double-click-time | 1407 | This variable is also the threshold for motion of the mouse to count |
| 1408 | as a drag. | ||
| 1409 | @end defopt | ||
| 1410 | |||
| 1411 | @defopt double-click-time | ||
| 1399 | To generate repeat events, the number of milliseconds between | 1412 | To generate repeat events, the number of milliseconds between |
| 1400 | successive button presses must be less than the value of | 1413 | successive button presses must be less than the value of |
| 1401 | @code{double-click-time}. Setting @code{double-click-time} to | 1414 | @code{double-click-time}. Setting @code{double-click-time} to |
| 1402 | @code{nil} disables multi-click detection entirely. Setting it to | 1415 | @code{nil} disables multi-click detection entirely. Setting it to |
| 1403 | @code{t} removes the time limit; Emacs then detects multi-clicks by | 1416 | @code{t} removes the time limit; Emacs then detects multi-clicks by |
| 1404 | position only. | 1417 | position only. |
| 1405 | @end defvar | 1418 | @end defopt |
| 1406 | 1419 | ||
| 1407 | @node Motion Events | 1420 | @node Motion Events |
| 1408 | @subsection Motion Events | 1421 | @subsection Motion Events |
| @@ -1593,16 +1606,22 @@ This function returns a list of the modifiers that @var{event} has. The | |||
| 1593 | modifiers are symbols; they include @code{shift}, @code{control}, | 1606 | modifiers are symbols; they include @code{shift}, @code{control}, |
| 1594 | @code{meta}, @code{alt}, @code{hyper} and @code{super}. In addition, | 1607 | @code{meta}, @code{alt}, @code{hyper} and @code{super}. In addition, |
| 1595 | the modifiers list of a mouse event symbol always contains one of | 1608 | the modifiers list of a mouse event symbol always contains one of |
| 1596 | @code{click}, @code{drag}, and @code{down}. | 1609 | @code{click}, @code{drag}, and @code{down}. For double or triple |
| 1610 | events, it also contains @code{double} or @code{triple}. | ||
| 1597 | 1611 | ||
| 1598 | The argument @var{event} may be an entire event object, or just an event | 1612 | The argument @var{event} may be an entire event object, or just an |
| 1599 | type. | 1613 | event type. If @var{event} is a symbol that has never been used in an |
| 1614 | event that has been read as input in the current Emacs session, then | ||
| 1615 | @code{event-modifiers} can return @code{nil}, even when @var{event} | ||
| 1616 | actually has modifiers. | ||
| 1600 | 1617 | ||
| 1601 | Here are some examples: | 1618 | Here are some examples: |
| 1602 | 1619 | ||
| 1603 | @example | 1620 | @example |
| 1604 | (event-modifiers ?a) | 1621 | (event-modifiers ?a) |
| 1605 | @result{} nil | 1622 | @result{} nil |
| 1623 | (event-modifiers ?A) | ||
| 1624 | @result{} (shift) | ||
| 1606 | (event-modifiers ?\C-a) | 1625 | (event-modifiers ?\C-a) |
| 1607 | @result{} (control) | 1626 | @result{} (control) |
| 1608 | (event-modifiers ?\C-%) | 1627 | (event-modifiers ?\C-%) |
| @@ -1627,7 +1646,8 @@ but the event symbol name itself does not contain @samp{click}. | |||
| 1627 | 1646 | ||
| 1628 | @defun event-basic-type event | 1647 | @defun event-basic-type event |
| 1629 | This function returns the key or mouse button that @var{event} | 1648 | This function returns the key or mouse button that @var{event} |
| 1630 | describes, with all modifiers removed. For example: | 1649 | describes, with all modifiers removed. The @var{event} argument is as |
| 1650 | in @code{event-modifiers}. For example: | ||
| 1631 | 1651 | ||
| 1632 | @example | 1652 | @example |
| 1633 | (event-basic-type ?a) | 1653 | (event-basic-type ?a) |
| @@ -1656,7 +1676,8 @@ event. | |||
| 1656 | 1676 | ||
| 1657 | @defun event-convert-list list | 1677 | @defun event-convert-list list |
| 1658 | This function converts a list of modifier names and a basic event type | 1678 | This function converts a list of modifier names and a basic event type |
| 1659 | to an event type which specifies all of them. For example, | 1679 | to an event type which specifies all of them. The basic event type |
| 1680 | must be the last element of the list. For example, | ||
| 1660 | 1681 | ||
| 1661 | @example | 1682 | @example |
| 1662 | (event-convert-list '(control ?a)) | 1683 | (event-convert-list '(control ?a)) |
| @@ -1788,7 +1809,7 @@ is a buffer position, return the size of the character at that position. | |||
| 1788 | 1809 | ||
| 1789 | @cindex mouse event, timestamp | 1810 | @cindex mouse event, timestamp |
| 1790 | @cindex timestamp of a mouse event | 1811 | @cindex timestamp of a mouse event |
| 1791 | @defun posn-timestamp | 1812 | @defun posn-timestamp position |
| 1792 | Return the timestamp in @var{position}. This is the time at which the | 1813 | Return the timestamp in @var{position}. This is the time at which the |
| 1793 | event occurred, in milliseconds. | 1814 | event occurred, in milliseconds. |
| 1794 | @end defun | 1815 | @end defun |
| @@ -1998,10 +2019,13 @@ for example, @code{describe-key} uses it to read the key to describe. | |||
| 1998 | 2019 | ||
| 1999 | @defun read-key-sequence prompt | 2020 | @defun read-key-sequence prompt |
| 2000 | @cindex key sequence | 2021 | @cindex key sequence |
| 2022 | @anchor{Definition of read-key-sequence} | ||
| 2001 | This function reads a key sequence and returns it as a string or | 2023 | This function reads a key sequence and returns it as a string or |
| 2002 | vector. It keeps reading events until it has accumulated a complete key | 2024 | vector. It keeps reading events until it has accumulated a complete key |
| 2003 | sequence; that is, enough to specify a non-prefix command using the | 2025 | sequence; that is, enough to specify a non-prefix command using the |
| 2004 | currently active keymaps. | 2026 | currently active keymaps. (Remember that a key sequence that starts |
| 2027 | with a mouse event is read using the keymaps of the buffer in the | ||
| 2028 | window that the mouse was in, not the current buffer.) | ||
| 2005 | 2029 | ||
| 2006 | If the events are all characters and all can fit in a string, then | 2030 | If the events are all characters and all can fit in a string, then |
| 2007 | @code{read-key-sequence} returns a string (@pxref{Strings of Events}). | 2031 | @code{read-key-sequence} returns a string (@pxref{Strings of Events}). |
| @@ -2101,6 +2125,8 @@ from the terminal---not counting those generated by keyboard macros. | |||
| 2101 | The lowest level functions for command input are those that read a | 2125 | The lowest level functions for command input are those that read a |
| 2102 | single event. | 2126 | single event. |
| 2103 | 2127 | ||
| 2128 | None of the three functions below suppresses quitting. | ||
| 2129 | |||
| 2104 | @defun read-event &optional prompt inherit-input-method | 2130 | @defun read-event &optional prompt inherit-input-method |
| 2105 | This function reads and returns the next event of command input, waiting | 2131 | This function reads and returns the next event of command input, waiting |
| 2106 | if necessary until an event is available. Events can come directly from | 2132 | if necessary until an event is available. Events can come directly from |
| @@ -2122,8 +2148,8 @@ If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} | |||
| 2122 | moves the cursor temporarily to the echo area, to the end of any message | 2148 | moves the cursor temporarily to the echo area, to the end of any message |
| 2123 | displayed there. Otherwise @code{read-event} does not move the cursor. | 2149 | displayed there. Otherwise @code{read-event} does not move the cursor. |
| 2124 | 2150 | ||
| 2125 | If @code{read-event} gets an event that is defined as a help character, in | 2151 | If @code{read-event} gets an event that is defined as a help character, |
| 2126 | some cases @code{read-event} processes the event directly without | 2152 | then in some cases @code{read-event} processes the event directly without |
| 2127 | returning. @xref{Help Functions}. Certain other events, called | 2153 | returning. @xref{Help Functions}. Certain other events, called |
| 2128 | @dfn{special events}, are also processed directly within | 2154 | @dfn{special events}, are also processed directly within |
| 2129 | @code{read-event} (@pxref{Special Events}). | 2155 | @code{read-event} (@pxref{Special Events}). |
| @@ -2235,7 +2261,10 @@ The command @code{quoted-insert} uses this function. | |||
| 2235 | This function is like @code{read-char}, except that if the first | 2261 | This function is like @code{read-char}, except that if the first |
| 2236 | character read is an octal digit (0-7), it reads any number of octal | 2262 | character read is an octal digit (0-7), it reads any number of octal |
| 2237 | digits (but stopping if a non-octal digit is found), and returns the | 2263 | digits (but stopping if a non-octal digit is found), and returns the |
| 2238 | character represented by that numeric character code. | 2264 | character represented by that numeric character code. If the |
| 2265 | character that terminates the sequence of octal digits is @key{RET}, | ||
| 2266 | it is discarded. Any other terminating character is used as input | ||
| 2267 | after this function returns. | ||
| 2239 | 2268 | ||
| 2240 | Quitting is suppressed when the first character is read, so that the | 2269 | Quitting is suppressed when the first character is read, so that the |
| 2241 | user can enter a @kbd{C-g}. @xref{Quitting}. | 2270 | user can enter a @kbd{C-g}. @xref{Quitting}. |
| @@ -2252,7 +2281,7 @@ is 127 in decimal). | |||
| 2252 | 2281 | ||
| 2253 | @group | 2282 | @group |
| 2254 | ---------- Echo Area ---------- | 2283 | ---------- Echo Area ---------- |
| 2255 | What character-@kbd{177} | 2284 | What character @kbd{1 7 7}- |
| 2256 | ---------- Echo Area ---------- | 2285 | ---------- Echo Area ---------- |
| 2257 | 2286 | ||
| 2258 | @result{} 127 | 2287 | @result{} 127 |
| @@ -2370,7 +2399,8 @@ during the sleep. | |||
| 2370 | @cindex special events | 2399 | @cindex special events |
| 2371 | Special events are handled at a very low level---as soon as they are | 2400 | Special events are handled at a very low level---as soon as they are |
| 2372 | read. The @code{read-event} function processes these events itself, and | 2401 | read. The @code{read-event} function processes these events itself, and |
| 2373 | never returns them. | 2402 | never returns them. Instead, it keeps waiting for the first event |
| 2403 | that is not special and returns that one. | ||
| 2374 | 2404 | ||
| 2375 | Events that are handled in this way do not echo, they are never grouped | 2405 | Events that are handled in this way do not echo, they are never grouped |
| 2376 | into key sequences, and they never appear in the value of | 2406 | into key sequences, and they never appear in the value of |
| @@ -2544,6 +2574,28 @@ is set to a value other than @code{nil}. If @code{inhibit-quit} is | |||
| 2544 | non-@code{nil}, then @code{quit-flag} has no special effect. | 2574 | non-@code{nil}, then @code{quit-flag} has no special effect. |
| 2545 | @end defvar | 2575 | @end defvar |
| 2546 | 2576 | ||
| 2577 | @defmac with-local-quit forms@dots{} | ||
| 2578 | This macro executes @var{forms} in sequence, but allows quitting, at | ||
| 2579 | least locally, within @var{body} even if @code{inhibit-quit} was | ||
| 2580 | non-@code{nil} outside this construct. It returns the value of the | ||
| 2581 | last form in @var{forms}. | ||
| 2582 | |||
| 2583 | If @code{inhibit-quit} is @code{nil} on entry to @code{with-local-quit}, | ||
| 2584 | it only executes the @var{forms}, and setting @code{quit-flag} causes | ||
| 2585 | a normal quit. However, if @code{inhibit-quit} is non-@code{nil} so | ||
| 2586 | that ordinary quitting is delayed, a non-@code{nil} @code{quit-flag} | ||
| 2587 | triggers a special kind of local quit. This ends the execution of | ||
| 2588 | @var{forms} and exits the @code{with-local-quit} form with | ||
| 2589 | @code{quit-flag} still non-@code{nil}, so that another (ordinary) quit | ||
| 2590 | will happen as soon as that is allowed. If @code{quit-flag} is | ||
| 2591 | already non-@code{nil} at the beginning of @var{forms}, the local quit | ||
| 2592 | happens immediately and they don't execute at all. | ||
| 2593 | |||
| 2594 | This macro is mainly useful in functions that can be called from | ||
| 2595 | timers, @code{pre-command-hook}, @code{post-command-hook} and other | ||
| 2596 | places where @code{inhibit-quit} is normally bound to @code{t}. | ||
| 2597 | @end defmac | ||
| 2598 | |||
| 2547 | @deffn Command keyboard-quit | 2599 | @deffn Command keyboard-quit |
| 2548 | This function signals the @code{quit} condition with @code{(signal 'quit | 2600 | This function signals the @code{quit} condition with @code{(signal 'quit |
| 2549 | nil)}. This is the same thing that quitting does. (See @code{signal} | 2601 | nil)}. This is the same thing that quitting does. (See @code{signal} |
| @@ -2844,15 +2896,14 @@ Disabling a command has no effect on calling it as a function from Lisp | |||
| 2844 | programs. | 2896 | programs. |
| 2845 | 2897 | ||
| 2846 | @deffn Command enable-command command | 2898 | @deffn Command enable-command command |
| 2847 | Allow @var{command} to be executed without special confirmation from now | 2899 | Allow @var{command} (a symbol) to be executed without special |
| 2848 | on, and (if the user confirms) alter the user's init file (@pxref{Init | 2900 | confirmation from now on, and alter the user's init file (@pxref{Init |
| 2849 | File}) so that this will apply to future sessions. | 2901 | File}) so that this will apply to future sessions. |
| 2850 | @end deffn | 2902 | @end deffn |
| 2851 | 2903 | ||
| 2852 | @deffn Command disable-command command | 2904 | @deffn Command disable-command command |
| 2853 | Require special confirmation to execute @var{command} from now on, and | 2905 | Require special confirmation to execute @var{command} from now on, and |
| 2854 | (if the user confirms) alter the user's init file so that this | 2906 | alter the user's init file so that this will apply to future sessions. |
| 2855 | will apply to future sessions. | ||
| 2856 | @end deffn | 2907 | @end deffn |
| 2857 | 2908 | ||
| 2858 | @defvar disabled-command-hook | 2909 | @defvar disabled-command-hook |
| @@ -2862,7 +2913,8 @@ is run instead of the disabled command. The hook functions can use | |||
| 2862 | command, and thus find the command itself. @xref{Hooks}. | 2913 | command, and thus find the command itself. @xref{Hooks}. |
| 2863 | 2914 | ||
| 2864 | By default, @code{disabled-command-hook} contains a function that asks | 2915 | By default, @code{disabled-command-hook} contains a function that asks |
| 2865 | the user whether to proceed. | 2916 | the user whether to proceed. If the value is @code{nil}, then all |
| 2917 | commands work normally, even disabled ones. | ||
| 2866 | @end defvar | 2918 | @end defvar |
| 2867 | 2919 | ||
| 2868 | @node Command History | 2920 | @node Command History |
| @@ -2918,7 +2970,7 @@ representation of a keyboard macro is a string or vector containing the | |||
| 2918 | events. Don't confuse keyboard macros with Lisp macros | 2970 | events. Don't confuse keyboard macros with Lisp macros |
| 2919 | (@pxref{Macros}). | 2971 | (@pxref{Macros}). |
| 2920 | 2972 | ||
| 2921 | @defun execute-kbd-macro kbdmacro &optional count | 2973 | @defun execute-kbd-macro kbdmacro &optional count loopfunc |
| 2922 | This function executes @var{kbdmacro} as a sequence of events. If | 2974 | This function executes @var{kbdmacro} as a sequence of events. If |
| 2923 | @var{kbdmacro} is a string or vector, then the events in it are executed | 2975 | @var{kbdmacro} is a string or vector, then the events in it are executed |
| 2924 | exactly as if they had been input by the user. The sequence is | 2976 | exactly as if they had been input by the user. The sequence is |
| @@ -2935,10 +2987,14 @@ many times. If @var{count} is omitted or @code{nil}, @var{kbdmacro} is | |||
| 2935 | executed once. If it is 0, @var{kbdmacro} is executed over and over until it | 2987 | executed once. If it is 0, @var{kbdmacro} is executed over and over until it |
| 2936 | encounters an error or a failing search. | 2988 | encounters an error or a failing search. |
| 2937 | 2989 | ||
| 2990 | If @var{loopfunc} is non-@code{nil}, it is a function that is called, | ||
| 2991 | without arguments, prior to each iteration of the macro. If | ||
| 2992 | @var{loopfunc} returns @code{nil}, then this stops execution of the macro. | ||
| 2993 | |||
| 2938 | @xref{Reading One Event}, for an example of using @code{execute-kbd-macro}. | 2994 | @xref{Reading One Event}, for an example of using @code{execute-kbd-macro}. |
| 2939 | @end defun | 2995 | @end defun |
| 2940 | 2996 | ||
| 2941 | @defvar executing-macro | 2997 | @defvar executing-kbd-macro |
| 2942 | This variable contains the string or vector that defines the keyboard | 2998 | This variable contains the string or vector that defines the keyboard |
| 2943 | macro that is currently executing. It is @code{nil} if no macro is | 2999 | macro that is currently executing. It is @code{nil} if no macro is |
| 2944 | currently executing. A command can test this variable so as to behave | 3000 | currently executing. A command can test this variable so as to behave |
| @@ -2947,10 +3003,11 @@ yourself. | |||
| 2947 | @end defvar | 3003 | @end defvar |
| 2948 | 3004 | ||
| 2949 | @defvar defining-kbd-macro | 3005 | @defvar defining-kbd-macro |
| 2950 | This variable indicates whether a keyboard macro is being defined. A | 3006 | This variable is non-@code{nil} if and only if a keyboard macro is |
| 2951 | command can test this variable so as to behave differently while a macro | 3007 | being defined. A command can test this variable so as to behave |
| 2952 | is being defined. The commands @code{start-kbd-macro} and | 3008 | differently while a macro is being defined. The commands |
| 2953 | @code{end-kbd-macro} set this variable---do not set it yourself. | 3009 | @code{start-kbd-macro} and @code{end-kbd-macro} set this variable---do |
| 3010 | not set it yourself. | ||
| 2954 | 3011 | ||
| 2955 | The variable is always local to the current terminal and cannot be | 3012 | The variable is always local to the current terminal and cannot be |
| 2956 | buffer-local. @xref{Multiple Displays}. | 3013 | buffer-local. @xref{Multiple Displays}. |