You can use the function read-quoted-char
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 quoted-insert
uses this function.
read-char
, 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.
Quitting is suppressed when the first character is read, so that the user can enter a C-g. See section Quitting.
If prompt is supplied, it specifies a string for prompting the user. The prompt string is always displayed in the echo area, followed by a single `-'.
In the following example, the user types in the octal number 177 (which is 127 in decimal).
(read-quoted-char "What character") ---------- Echo Area ---------- What character-177 ---------- Echo Area ---------- => 127
Go to the first, previous, next, last section, table of contents.