[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

21.7.4 Quoted Character Input

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.

Function: read-quoted-char &optional prompt
This function is like 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 21.10 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



This document was generated on May 2, 2002 using texi2html