blob: df9c736daa3c9a2e29e8f5b97bbcce79b0329def (
plain)
1
2
3
4
5
6
7
8
9
10
|
<h4 class="subsection">Invoking the Input Method</h4> <p>The event-reading functions invoke the current input method, if any (see <a href="input-methods">Input Methods</a>). If the value of <code>input-method-function</code> is non-<code>nil</code>, it should be a function; when <code>read-event</code> reads a printing character (including <tt class="key">SPC</tt>) with no modifier bits, it calls that function, passing the character as an argument. </p> <dl> <dt id="input-method-function">Variable: <strong>input-method-function</strong>
</dt> <dd>
<p>If this is non-<code>nil</code>, its value specifies the current input method function. </p> <p><strong>Warning:</strong> don’t bind this variable with <code>let</code>. It is often buffer-local, and if you bind it around reading input (which is exactly when you <em>would</em> bind it), switching buffers asynchronously while Emacs is waiting will cause the value to be restored in the wrong buffer. </p>
</dd>
</dl> <p>The input method function should return a list of events which should be used as input. (If the list is <code>nil</code>, that means there is no input, so <code>read-event</code> waits for another event.) These events are processed before the events in <code>unread-command-events</code> (see <a href="event-input-misc">Event Input Misc</a>). Events returned by the input method function are not passed to the input method function again, even if they are printing characters with no modifier bits. </p> <p>If the input method function calls <code>read-event</code> or <code>read-key-sequence</code>, it should bind <code>input-method-function</code> to <code>nil</code> first, to prevent recursion. </p> <p>The input method function is not called when reading the second and subsequent events of a key sequence. Thus, these characters are not subject to input method processing. The input method function should test the values of <code>overriding-local-map</code> and <code>overriding-terminal-local-map</code>; if either of these variables is non-<code>nil</code>, the input method should put its argument into a list and return that list with no further processing. </p><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Invoking-the-Input-Method.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Invoking-the-Input-Method.html</a>
</p>
</div>
|