74 |
The editor command loop runs this normal hook before each command. At |
The editor command loop runs this normal hook before each command. At |
75 |
that time, @code{this-command} contains the command that is about to |
that time, @code{this-command} contains the command that is about to |
76 |
run, and @code{last-command} describes the previous command. |
run, and @code{last-command} describes the previous command. |
77 |
@xref{Hooks}. |
@xref{Command Loop Info}. |
78 |
@end defvar |
@end defvar |
79 |
|
|
80 |
@defvar post-command-hook |
@defvar post-command-hook |
81 |
The editor command loop runs this normal hook after each command |
The editor command loop runs this normal hook after each command |
82 |
(including commands terminated prematurely by quitting or by errors), |
(including commands terminated prematurely by quitting or by errors), |
83 |
and also when the command loop is first entered. At that time, |
and also when the command loop is first entered. At that time, |
84 |
@code{this-command} describes the command that just ran, and |
@code{this-command} refers to the command that just ran, and |
85 |
@code{last-command} describes the command before that. @xref{Hooks}. |
@code{last-command} refers to the command before that. |
86 |
@end defvar |
@end defvar |
87 |
|
|
88 |
Quitting is suppressed while running @code{pre-command-hook} and |
Quitting is suppressed while running @code{pre-command-hook} and |
840 |
@node Adjusting Point |
@node Adjusting Point |
841 |
@section Adjusting Point After Commands |
@section Adjusting Point After Commands |
842 |
|
|
843 |
It is not easy to display a value of point in the middle of a sequence |
It is not easy to display a value of point in the middle of a |
844 |
of text that has the @code{display} or @code{composition} property. So |
sequence of text that has the @code{display}, @code{composition} or |
845 |
after a command finishes and returns to the command loop, if point is |
@code{intangible} property, or is invisible. Therefore, after a |
846 |
within such a sequence, the command loop normally moves point to the |
command finishes and returns to the command loop, if point is within |
847 |
edge of the sequence. |
such a sequence, the command loop normally moves point to the edge of |
848 |
|
the sequence. |
849 |
|
|
850 |
A command can inhibit this feature by setting the variable |
A command can inhibit this feature by setting the variable |
851 |
@code{disable-point-adjustment}: |
@code{disable-point-adjustment}: |
852 |
|
|
853 |
@defvar disable-point-adjustment |
@defvar disable-point-adjustment |
854 |
@tindex disable-point-adjustment |
@tindex disable-point-adjustment |
855 |
If this variable is non-@code{nil} when a command returns to the command |
If this variable is non-@code{nil} when a command returns to the |
856 |
loop, then the command loop does not check for text properties such as |
command loop, then the command loop does not check for those text |
857 |
@code{display} and @code{composition}, and does not move point out of |
properties, and does not move point out of sequences that have them. |
|
sequences that have these properties. |
|
858 |
|
|
859 |
The command loop sets this variable to @code{nil} before each command, |
The command loop sets this variable to @code{nil} before each command, |
860 |
so if a command sets it, the effect applies only to that command. |
so if a command sets it, the effect applies only to that command. |
2051 |
@code{read-key-sequence}. Lisp programs can also call this function; |
@code{read-key-sequence}. Lisp programs can also call this function; |
2052 |
for example, @code{describe-key} uses it to read the key to describe. |
for example, @code{describe-key} uses it to read the key to describe. |
2053 |
|
|
2054 |
@defun read-key-sequence prompt |
@defun read-key-sequence prompt &optional continue-echo dont-downcase-last switch-frame-ok command-loop |
2055 |
@cindex key sequence |
@cindex key sequence |
2056 |
This function reads a key sequence and returns it as a string or |
This function reads a key sequence and returns it as a string or |
2057 |
vector. It keeps reading events until it has accumulated a complete key |
vector. It keeps reading events until it has accumulated a complete key |
2066 |
events---characters, symbols, and lists. The elements of the string or |
events---characters, symbols, and lists. The elements of the string or |
2067 |
vector are the events in the key sequence. |
vector are the events in the key sequence. |
2068 |
|
|
2069 |
The argument @var{prompt} is either a string to be displayed in the echo |
The argument @var{prompt} is either a string to be displayed in the |
2070 |
area as a prompt, or @code{nil}, meaning not to display a prompt. |
echo area as a prompt, or @code{nil}, meaning not to display a prompt. |
2071 |
|
The argument @var{continue-echo}, if non-@code{nil}, means to echo |
2072 |
|
this key as a continuation of the previous key. |
2073 |
|
|
2074 |
|
Normally any upper case event is converted to lower case if the |
2075 |
|
original event is undefined and the lower case equivalent is defined. |
2076 |
|
The argument @var{dont-downcase-last}, if non-@code{nil}, means do not |
2077 |
|
convert the last event to lower case. This is appropriate for reading |
2078 |
|
a key sequence to be defined. |
2079 |
|
|
2080 |
|
The argument @var{switch-frame-ok}, if non-@code{nil}, means that this |
2081 |
|
function should process a @code{switch-frame} event if the user |
2082 |
|
switches frames before typing anything. If the user switches frames |
2083 |
|
in the middle of a key sequence, or at the start of the sequence but |
2084 |
|
@var{switch-frame-ok} is @code{nil}, then the event will be put off |
2085 |
|
until after the current key sequence. |
2086 |
|
|
2087 |
|
The argument @var{command-loop}, if non-@code{nil}, means that this |
2088 |
|
key sequence is being read by something that will read commands one |
2089 |
|
after another. It should be @code{nil} if the caller will read just |
2090 |
|
one key sequence. |
2091 |
|
|
2092 |
In the example below, the prompt @samp{?} is displayed in the echo area, |
In the example below, the prompt @samp{?} is displayed in the echo area, |
2093 |
and the user types @kbd{C-x C-f}. |
and the user types @kbd{C-x C-f}. |
2109 |
and does not set @code{quit-flag}. @xref{Quitting}. |
and does not set @code{quit-flag}. @xref{Quitting}. |
2110 |
@end defun |
@end defun |
2111 |
|
|
2112 |
@defun read-key-sequence-vector prompt |
@defun read-key-sequence-vector prompt &optional continue-echo dont-downcase-last switch-frame-ok command-loop |
2113 |
This is like @code{read-key-sequence} except that it always |
This is like @code{read-key-sequence} except that it always |
2114 |
returns the key sequence as a vector, never as a string. |
returns the key sequence as a vector, never as a string. |
2115 |
@xref{Strings of Events}. |
@xref{Strings of Events}. |