blob: bf327981b28ce03a7a8ea3e42f886d714dc39a65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<h4 class="subsection">Quoted Character Input</h4> <p>You can use the function <code>read-quoted-char</code> to ask the user to specify a character, and allow the user to specify a control or meta character conveniently, either literally or as an octal character code. The command <code>quoted-insert</code> uses this function. </p> <dl> <dt id="read-quoted-char">Function: <strong>read-quoted-char</strong> <em>&optional prompt</em>
</dt> <dd>
<p>This function is like <code>read-char</code>, except that if the first character read is an octal digit (0–7), it reads any number of octal digits (but stopping if a non-octal digit is found), and returns the character represented by that numeric character code. If the character that terminates the sequence of octal digits is <tt class="key">RET</tt>, it is discarded. Any other terminating character is used as input after this function returns. </p> <p>Quitting is suppressed when the first character is read, so that the user can enter a <kbd>C-g</kbd>. See <a href="quitting">Quitting</a>. </p> <p>If <var>prompt</var> is supplied, it specifies a string for prompting the user. The prompt string is always displayed in the echo area, followed by a single ‘<samp>-</samp>’. </p> <p>In the following example, the user types in the octal number 177 (which is 127 in decimal). </p> <div class="example"> <pre class="example">(read-quoted-char "What character")
</pre>
<pre class="example">---------- Echo Area ----------
What character <kbd>1 7 7</kbd>-
---------- Echo Area ----------
⇒ 127
</pre>
</div> </dd>
</dl><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/Quoted-Character-Input.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Quoted-Character-Input.html</a>
</p>
</div>
|