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

5. Read functions

Elib provides a number of functions for reading data from the minibuffer. To use them in your own elisp programs, put the following line into you source file:

 
(require 'read)

The following functions are provided by ‘read’.

(read-number &optional prompt default)

Read a number from the minibuffer. If optional argument prompt is non-nil, the user is prompted using prompt, otherwise the prompt string Enter a number: is used. If optional argument default is non-nil, it is written within parenthesis after the prompt string. default can be either a number or of the type which (interactive "P") generates.

(read-num-range low high &optional prompt show-range)

Read a number from the minibuffer. The number returned will be forced to lie between low and high. If prompt is non-nil, the user is prompted using prompt, otherwise the prompt string Enter a number: is used. If show-range is non-nil, the prompt will show the range within parenthesis to the user.

(read-silent prompt &optional showchar)

Read a string in the minibuffer without echoing. The following characters are special when entering the string:

DEL

Delete the last character in the input buffer.

C-u

Clear the input buffer.

RET

End the reading of the string.

Newline

Same as RET.

If optional argument showchar is non-nil, one of these characters will be displayed for each character input by the user.

This function is well suited to read a password from the user, but beware of the function (view-lossage) which displays the last 100 keystrokes, even hidden ones.


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

This document was generated on January 18, 2014 using texi2html 1.82.