std-getkword


Synopsis

(std-getkword <flag> <kwd> <def>)

(std-inp-getkword <flag> <kwd> <msg> <def>)

Description

Pauses for user input of a keyword, and returns that keyword.

They use the following enhancements:
msg is nicely formatted.

If a lisp function given at the prompt returns a valid type this one is accepted.

The additionally needed INITGET initialization and default value check may be omitted, thus leading to easier looping code.

If the default argument is given (and it is not nil and the flag contains no bitvalue 1), then empty input is allowed as well.

Arguments

flag: integer, same as the INITGET flag or nil

kwd: a initget-like string or a list of strings or nil

msg: a string to be displayed as a prompt or nil. If nil "\nSelect option: " is prompted.

def: default value or nil

Return Value

A string, either the given input or the default value.

Side Effects

Interrupts the program flow, prints the formatted message and waits for user input.

If no default is given and flag 1 is used and the user enters wrong types, the functions loops until break or correct input.

Module

(std-require 'STDINPUT)

Defined in STDINPUT