aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorLuc Teirlinck2004-08-07 01:12:59 +0000
committerLuc Teirlinck2004-08-07 01:12:59 +0000
commit5504e99ca65abbc04ab68a13612e51b6b5c04e7a (patch)
tree0ac67edbaeb0c7fbf868f5f7b0619c0431a2a3c8 /lispref
parentbdb3097a23f057be4a747831cf69aa957f4f67e1 (diff)
downloademacs-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/ChangeLog26
-rw-r--r--lispref/commands.texi169
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 @@
12004-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
12004-07-24 Luc Teirlinck <teirllm@auburn.edu> 272004-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
121makes a Lisp function an interactively-callable command, and how to 121makes a Lisp function an interactively-callable command, and how to
122examine a commands's @code{interactive} form. 122examine 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
238This function returns the @code{interactive} form of @var{function}. If 238This function returns the @code{interactive} form of @var{function}.
239@var{function} is a command (@pxref{Interactive Call}), the value is a 239If @var{function} is an interactively callable function
240list of the form @code{(interactive @var{spec})}, where @var{spec} is 240(@pxref{Interactive Call}), the value is the command's
241the descriptor specification used by the command's @code{interactive} 241@code{interactive} form @code{(interactive @var{spec})}, which
242form to compute the function's arguments. If @var{function} is not a 242specifies how to compute its arguments. Otherwise, the value is
243command, @code{interactive-form} returns @code{nil}. 243@code{nil}. If @var{function} is a symbol, its function definition is
244used.
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.,
416parentheses and brackets) do not do so here. Prompt. 417parentheses and brackets) do not do so here. Prompt.
417 418
418@item v 419@item v
419A variable declared to be a user option (i.e., satisfying the predicate 420A variable declared to be a user option (i.e., satisfying the
420@code{user-variable-p}). @xref{High-Level Completion}. Existing, 421predicate @code{user-variable-p}). This reads the variable using
422@code{read-variable}. @xref{Definition of read-variable}. Existing,
421Completion, Prompt. 423Completion, 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
529This function calls the interactively callable function @var{command}, 531This function calls the interactively callable function @var{command},
530reading arguments according to its interactive calling specifications. 532reading arguments according to its interactive calling specifications.
531An error is signaled if @var{command} is not a function or if it cannot 533It returns whatever @var{command} returns. An error is signaled if
532be called interactively (i.e., is not a command). Note that keyboard 534@var{command} is not a function or if it cannot be called
533macros (strings and vectors) are not accepted, even though they are 535interactively (i.e., is not a command). Note that keyboard macros
534considered commands, because they are not functions. 536(strings and vectors) are not accepted, even though they are
537considered commands, because they are not functions. If @var{command}
538is a symbol, then @code{call-interactively} uses its function definition.
535 539
536@cindex record command history 540@cindex record command history
537If @var{record-flag} is non-@code{nil}, then this command and its 541If @var{record-flag} is non-@code{nil}, then this command and its
@@ -541,6 +545,8 @@ an argument. @xref{Command History}.
541 545
542The argument @var{keys}, if given, specifies the sequence of events to 546The argument @var{keys}, if given, specifies the sequence of events to
543supply if the command inquires which events were used to invoke it. 547supply if the command inquires which events were used to invoke it.
548If @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
552A string or vector as @var{command} is executed with 558A 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}
561and @var{keys}.
555 562
556A symbol is handled by using its function definition in its place. A 563A symbol is handled by using its function definition in its place. A
557symbol with an @code{autoload} definition counts as a command if it was 564symbol 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
559definition is handled by loading the specified library and then 566definition is handled by loading the specified library and then
560rechecking the definition of the symbol. 567rechecking the definition of the symbol.
561 568
562The argument @var{keys}, if given, specifies the sequence of events to
563supply if the command inquires which events were used to invoke it.
564
565The argument @var{special}, if given, means to ignore the prefix 569The argument @var{special}, if given, means to ignore the prefix
566argument and not clear it. This is used for executing special events 570argument 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}
744This function returns a string or vector containing the key sequence 749This function returns a string or vector containing the key sequence
745that invoked the present command, plus any previous commands that 750that invoked the present command, plus any previous commands that
746generated the prefix argument for this command. The value is a string 751generated the prefix argument for this command. However, if the
747if all those events were characters. @xref{Input Events}. 752command has called @code{read-key-sequence}, it returns the last read
753key sequence. @xref{Definition of read-key-sequence}. The value is a
754string if all events in the sequence were characters that fit in a
755string. @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
766This function empties out the table of events for 774This 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
768the function @code{recent-keys} (@pxref{Recording Input}) will 776non-@code{nil}, it also empties the records that the function
769subsequently return. This is useful after reading a password, to 777@code{recent-keys} (@pxref{Recording Input}) will subsequently return.
770prevent the password from echoing inadvertently as part of the next 778This is useful after reading a password, to prevent the password from
771command in certain cases. 779echoing 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
809generated, but if that frame has redirected input focus to another 817generated, but if that frame has redirected input focus to another
810frame, the value is the frame to which the event was redirected. 818frame, the value is the frame to which the event was redirected.
811@xref{Input Focus}. 819@xref{Input Focus}.
820
821If 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
1391To generate repeat events, successive mouse button presses must be at 1401To generate repeat events, successive mouse button presses must be at
1392approximately the same screen position. The value of 1402approximately 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
1394mouse may be moved between two successive clicks to make a 1404mouse may be moved (horizontally or vertically) between two successive
1395double-click. 1405clicks to make a double-click.
1396@end defvar
1397 1406
1398@defvar double-click-time 1407This variable is also the threshold for motion of the mouse to count
1408as a drag.
1409@end defopt
1410
1411@defopt double-click-time
1399To generate repeat events, the number of milliseconds between 1412To generate repeat events, the number of milliseconds between
1400successive button presses must be less than the value of 1413successive 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
1404position only. 1417position 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
1593modifiers are symbols; they include @code{shift}, @code{control}, 1606modifiers 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,
1595the modifiers list of a mouse event symbol always contains one of 1608the 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
1610events, it also contains @code{double} or @code{triple}.
1597 1611
1598The argument @var{event} may be an entire event object, or just an event 1612The argument @var{event} may be an entire event object, or just an
1599type. 1613event type. If @var{event} is a symbol that has never been used in an
1614event that has been read as input in the current Emacs session, then
1615@code{event-modifiers} can return @code{nil}, even when @var{event}
1616actually has modifiers.
1600 1617
1601Here are some examples: 1618Here 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
1629This function returns the key or mouse button that @var{event} 1648This function returns the key or mouse button that @var{event}
1630describes, with all modifiers removed. For example: 1649describes, with all modifiers removed. The @var{event} argument is as
1650in @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
1658This function converts a list of modifier names and a basic event type 1678This function converts a list of modifier names and a basic event type
1659to an event type which specifies all of them. For example, 1679to an event type which specifies all of them. The basic event type
1680must 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
1792Return the timestamp in @var{position}. This is the time at which the 1813Return the timestamp in @var{position}. This is the time at which the
1793event occurred, in milliseconds. 1814event 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}
2001This function reads a key sequence and returns it as a string or 2023This function reads a key sequence and returns it as a string or
2002vector. It keeps reading events until it has accumulated a complete key 2024vector. It keeps reading events until it has accumulated a complete key
2003sequence; that is, enough to specify a non-prefix command using the 2025sequence; that is, enough to specify a non-prefix command using the
2004currently active keymaps. 2026currently active keymaps. (Remember that a key sequence that starts
2027with a mouse event is read using the keymaps of the buffer in the
2028window that the mouse was in, not the current buffer.)
2005 2029
2006If the events are all characters and all can fit in a string, then 2030If 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
2102single event. 2126single event.
2103 2127
2128None 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
2105This function reads and returns the next event of command input, waiting 2131This function reads and returns the next event of command input, waiting
2106if necessary until an event is available. Events can come directly from 2132if 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}
2122moves the cursor temporarily to the echo area, to the end of any message 2148moves the cursor temporarily to the echo area, to the end of any message
2123displayed there. Otherwise @code{read-event} does not move the cursor. 2149displayed there. Otherwise @code{read-event} does not move the cursor.
2124 2150
2125If @code{read-event} gets an event that is defined as a help character, in 2151If @code{read-event} gets an event that is defined as a help character,
2126some cases @code{read-event} processes the event directly without 2152then in some cases @code{read-event} processes the event directly without
2127returning. @xref{Help Functions}. Certain other events, called 2153returning. @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.
2235This function is like @code{read-char}, except that if the first 2261This function is like @code{read-char}, except that if the first
2236character read is an octal digit (0-7), it reads any number of octal 2262character read is an octal digit (0-7), it reads any number of octal
2237digits (but stopping if a non-octal digit is found), and returns the 2263digits (but stopping if a non-octal digit is found), and returns the
2238character represented by that numeric character code. 2264character represented by that numeric character code. If the
2265character that terminates the sequence of octal digits is @key{RET},
2266it is discarded. Any other terminating character is used as input
2267after this function returns.
2239 2268
2240Quitting is suppressed when the first character is read, so that the 2269Quitting is suppressed when the first character is read, so that the
2241user can enter a @kbd{C-g}. @xref{Quitting}. 2270user 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 ----------
2255What character-@kbd{177} 2284What 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
2371Special events are handled at a very low level---as soon as they are 2400Special events are handled at a very low level---as soon as they are
2372read. The @code{read-event} function processes these events itself, and 2401read. The @code{read-event} function processes these events itself, and
2373never returns them. 2402never returns them. Instead, it keeps waiting for the first event
2403that is not special and returns that one.
2374 2404
2375Events that are handled in this way do not echo, they are never grouped 2405Events that are handled in this way do not echo, they are never grouped
2376into key sequences, and they never appear in the value of 2406into 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
2544non-@code{nil}, then @code{quit-flag} has no special effect. 2574non-@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{}
2578This macro executes @var{forms} in sequence, but allows quitting, at
2579least locally, within @var{body} even if @code{inhibit-quit} was
2580non-@code{nil} outside this construct. It returns the value of the
2581last form in @var{forms}.
2582
2583If @code{inhibit-quit} is @code{nil} on entry to @code{with-local-quit},
2584it only executes the @var{forms}, and setting @code{quit-flag} causes
2585a normal quit. However, if @code{inhibit-quit} is non-@code{nil} so
2586that ordinary quitting is delayed, a non-@code{nil} @code{quit-flag}
2587triggers 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
2590will happen as soon as that is allowed. If @code{quit-flag} is
2591already non-@code{nil} at the beginning of @var{forms}, the local quit
2592happens immediately and they don't execute at all.
2593
2594This macro is mainly useful in functions that can be called from
2595timers, @code{pre-command-hook}, @code{post-command-hook} and other
2596places where @code{inhibit-quit} is normally bound to @code{t}.
2597@end defmac
2598
2547@deffn Command keyboard-quit 2599@deffn Command keyboard-quit
2548This function signals the @code{quit} condition with @code{(signal 'quit 2600This function signals the @code{quit} condition with @code{(signal 'quit
2549nil)}. This is the same thing that quitting does. (See @code{signal} 2601nil)}. 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
2844programs. 2896programs.
2845 2897
2846@deffn Command enable-command command 2898@deffn Command enable-command command
2847Allow @var{command} to be executed without special confirmation from now 2899Allow @var{command} (a symbol) to be executed without special
2848on, and (if the user confirms) alter the user's init file (@pxref{Init 2900confirmation from now on, and alter the user's init file (@pxref{Init
2849File}) so that this will apply to future sessions. 2901File}) 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
2853Require special confirmation to execute @var{command} from now on, and 2905Require special confirmation to execute @var{command} from now on, and
2854(if the user confirms) alter the user's init file so that this 2906alter the user's init file so that this will apply to future sessions.
2855will 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
2862command, and thus find the command itself. @xref{Hooks}. 2913command, and thus find the command itself. @xref{Hooks}.
2863 2914
2864By default, @code{disabled-command-hook} contains a function that asks 2915By default, @code{disabled-command-hook} contains a function that asks
2865the user whether to proceed. 2916the user whether to proceed. If the value is @code{nil}, then all
2917commands 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
2918events. Don't confuse keyboard macros with Lisp macros 2970events. 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
2922This function executes @var{kbdmacro} as a sequence of events. If 2974This 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
2924exactly as if they had been input by the user. The sequence is 2976exactly 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
2935executed once. If it is 0, @var{kbdmacro} is executed over and over until it 2987executed once. If it is 0, @var{kbdmacro} is executed over and over until it
2936encounters an error or a failing search. 2988encounters an error or a failing search.
2937 2989
2990If @var{loopfunc} is non-@code{nil}, it is a function that is called,
2991without 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
2942This variable contains the string or vector that defines the keyboard 2998This variable contains the string or vector that defines the keyboard
2943macro that is currently executing. It is @code{nil} if no macro is 2999macro that is currently executing. It is @code{nil} if no macro is
2944currently executing. A command can test this variable so as to behave 3000currently 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
2950This variable indicates whether a keyboard macro is being defined. A 3006This variable is non-@code{nil} if and only if a keyboard macro is
2951command can test this variable so as to behave differently while a macro 3007being defined. A command can test this variable so as to behave
2952is being defined. The commands @code{start-kbd-macro} and 3008differently 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
3010not set it yourself.
2954 3011
2955The variable is always local to the current terminal and cannot be 3012The variable is always local to the current terminal and cannot be
2956buffer-local. @xref{Multiple Displays}. 3013buffer-local. @xref{Multiple Displays}.