LispWorks Editor User Guide > 6 Advanced Features > 6.3 Programming the editor

NextPrevUpTopContentsIndex

6.3.12 Prompting the user

The following functions can be used to prompt for some kind of input, which is generally typed into the Echo Area.

The following keyword arguments are common to a number of prompting functions.

:must-exist

Specifies whether the value that is input by the user must be an existing value or not. If :must-exist is non-nil, the user is prompted again if a non-existent value is input.

:default

Defines the default value that is selected if an empty string is input.

:default-string

Specifies the string that may be edited by the user (with Insert Parse Default).

:prompt

Defines the prompt that is written in the Echo Area. Most prompting functions have a default prompt that is used if no value is supplied for :prompt .

:help

Provides a help message that is printed if the user types " ? ".

editor:prompt-for-file

Function

editor:prompt-for-file &key direction must-exist create-directories default default-string prompt help

Prompts for a file name, and returns a pathname.

:direction

You can specify direction :input (when expecting to read the file) or direction :output (when expecting to write the file). This controls the default value of must-exist, which is false for direction :output and true otherwise.

:create-directories

If create-directories is true, then the user is prompted to create any missing directories in the path she enters. The default is false for direction :output and true otherwise.

See above for an explanation of the other arguments.

editor:prompt-for-buffer

Function

editor:prompt-for-buffer &key prompt must-exist default default-string help

Prompts for a buffer name, and returns the buffer. See above for an explanation of the keywords.

The default value of must-exist is t . If must-exist is nil and the buffer does not exist, it is created.

editor:prompt-for-integer

Function

editor:prompt-for-integer &key prompt must-exist default help

Prompts for an integer. See above for an explanation of the keywords.

editor:prompt-for-string

Function

editor:prompt-for-string &key prompt default default-string clear-echo-area help

Prompts for a string. No checking is done on the input. The keyword clear-echo-area controls whether or not the echo area is cleared (that is, whether the text being replaced is visible or not). The default for this keyword is t . See above for an explanation of the remaining keywords.

editor:prompt-for-variable

Function

editor:prompt-for-variable &key must-exist prompt default default-string help

Prompts for an editor variable. See above for an explanation of the keywords. The default value of must-exist is t .


LispWorks Editor User Guide (Unix version) - 22 Dec 2009

NextPrevUpTopContentsIndex