Mercurial > emacs
comparison lispref/commands.texi @ 60263:77eae74f8d56
(Command Overview): Improve xrefs.
(Adjusting Point): Adjusting point applies to intangible and invis.
(Key Sequence Input): Doc extra read-key-sequence args.
Likewise for read-key-sequence-vector.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 26 Feb 2005 23:52:38 +0000 |
parents | c8c884c02452 |
children | d1d93edfec58 e4694597cbf4 |
comparison
equal
deleted
inserted
replaced
60262:419004546419 | 60263:77eae74f8d56 |
---|---|
72 | 72 |
73 @defvar pre-command-hook | 73 @defvar pre-command-hook |
74 The editor command loop runs this normal hook before each command. At | 74 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 | 75 that time, @code{this-command} contains the command that is about to |
76 run, and @code{last-command} describes the previous command. | 76 run, and @code{last-command} describes the previous command. |
77 @xref{Hooks}. | 77 @xref{Command Loop Info}. |
78 @end defvar | 78 @end defvar |
79 | 79 |
80 @defvar post-command-hook | 80 @defvar post-command-hook |
81 The editor command loop runs this normal hook after each command | 81 The editor command loop runs this normal hook after each command |
82 (including commands terminated prematurely by quitting or by errors), | 82 (including commands terminated prematurely by quitting or by errors), |
83 and also when the command loop is first entered. At that time, | 83 and also when the command loop is first entered. At that time, |
84 @code{this-command} describes the command that just ran, and | 84 @code{this-command} refers to the command that just ran, and |
85 @code{last-command} describes the command before that. @xref{Hooks}. | 85 @code{last-command} refers to the command before that. |
86 @end defvar | 86 @end defvar |
87 | 87 |
88 Quitting is suppressed while running @code{pre-command-hook} and | 88 Quitting is suppressed while running @code{pre-command-hook} and |
89 @code{post-command-hook}. If an error happens while executing one of | 89 @code{post-command-hook}. If an error happens while executing one of |
90 these hooks, it terminates execution of the hook, and clears the hook | 90 these hooks, it terminates execution of the hook, and clears the hook |
838 @end defvar | 838 @end defvar |
839 | 839 |
840 @node Adjusting Point | 840 @node Adjusting Point |
841 @section Adjusting Point After Commands | 841 @section Adjusting Point After Commands |
842 | 842 |
843 It is not easy to display a value of point in the middle of a sequence | 843 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 | 844 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 | 845 @code{intangible} property, or is invisible. Therefore, after a |
846 within such a sequence, the command loop normally moves point to the | 846 command finishes and returns to the command loop, if point is within |
847 edge of the sequence. | 847 such a sequence, the command loop normally moves point to the edge of |
848 the sequence. | |
848 | 849 |
849 A command can inhibit this feature by setting the variable | 850 A command can inhibit this feature by setting the variable |
850 @code{disable-point-adjustment}: | 851 @code{disable-point-adjustment}: |
851 | 852 |
852 @defvar disable-point-adjustment | 853 @defvar disable-point-adjustment |
853 @tindex disable-point-adjustment | 854 @tindex disable-point-adjustment |
854 If this variable is non-@code{nil} when a command returns to the command | 855 If this variable is non-@code{nil} when a command returns to the |
855 loop, then the command loop does not check for text properties such as | 856 command loop, then the command loop does not check for those text |
856 @code{display} and @code{composition}, and does not move point out of | 857 properties, and does not move point out of sequences that have them. |
857 sequences that have these properties. | |
858 | 858 |
859 The command loop sets this variable to @code{nil} before each command, | 859 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. | 860 so if a command sets it, the effect applies only to that command. |
861 @end defvar | 861 @end defvar |
862 | 862 |
2049 | 2049 |
2050 The command loop reads input a key sequence at a time, by calling | 2050 The command loop reads input a key sequence at a time, by calling |
2051 @code{read-key-sequence}. Lisp programs can also call this function; | 2051 @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. | 2052 for example, @code{describe-key} uses it to read the key to describe. |
2053 | 2053 |
2054 @defun read-key-sequence prompt | 2054 @defun read-key-sequence prompt &optional continue-echo dont-downcase-last switch-frame-ok command-loop |
2055 @cindex key sequence | 2055 @cindex key sequence |
2056 This function reads a key sequence and returns it as a string or | 2056 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 | 2057 vector. It keeps reading events until it has accumulated a complete key |
2058 sequence; that is, enough to specify a non-prefix command using the | 2058 sequence; that is, enough to specify a non-prefix command using the |
2059 currently active keymaps. (Remember that a key sequence that starts | 2059 currently active keymaps. (Remember that a key sequence that starts |
2064 @code{read-key-sequence} returns a string (@pxref{Strings of Events}). | 2064 @code{read-key-sequence} returns a string (@pxref{Strings of Events}). |
2065 Otherwise, it returns a vector, since a vector can hold all kinds of | 2065 Otherwise, it returns a vector, since a vector can hold all kinds of |
2066 events---characters, symbols, and lists. The elements of the string or | 2066 events---characters, symbols, and lists. The elements of the string or |
2067 vector are the events in the key sequence. | 2067 vector are the events in the key sequence. |
2068 | 2068 |
2069 The argument @var{prompt} is either a string to be displayed in the echo | 2069 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. | 2070 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. | |
2071 | 2091 |
2072 In the example below, the prompt @samp{?} is displayed in the echo area, | 2092 In the example below, the prompt @samp{?} is displayed in the echo area, |
2073 and the user types @kbd{C-x C-f}. | 2093 and the user types @kbd{C-x C-f}. |
2074 | 2094 |
2075 @example | 2095 @example |
2087 The function @code{read-key-sequence} suppresses quitting: @kbd{C-g} | 2107 The function @code{read-key-sequence} suppresses quitting: @kbd{C-g} |
2088 typed while reading with this function works like any other character, | 2108 typed while reading with this function works like any other character, |
2089 and does not set @code{quit-flag}. @xref{Quitting}. | 2109 and does not set @code{quit-flag}. @xref{Quitting}. |
2090 @end defun | 2110 @end defun |
2091 | 2111 |
2092 @defun read-key-sequence-vector prompt | 2112 @defun read-key-sequence-vector prompt &optional continue-echo dont-downcase-last switch-frame-ok command-loop |
2093 This is like @code{read-key-sequence} except that it always | 2113 This is like @code{read-key-sequence} except that it always |
2094 returns the key sequence as a vector, never as a string. | 2114 returns the key sequence as a vector, never as a string. |
2095 @xref{Strings of Events}. | 2115 @xref{Strings of Events}. |
2096 @end defun | 2116 @end defun |
2097 | 2117 |