5.4 Prompt

Some templates use prompting macro insertion. A macro that needs a prompt looks like this:

{{?NAME}}

where ? comes after the first escape character.

by default, it will use a prompt like this when it is encountered:

Specify NAME:

For such macros, you can pre-define prompts for any dictionary entry. When that dictionary entry is first encountered, the user is prompted, and subsequent occurrences of that dictionary entry use the same value.

To get a different prompt, use a prompt command like this:

prompt VARNAME "Nice Way to ask for VARNAME: "

Now, if you put this in a template:

template variable
----
(defvar {{?VARNAME}} nil
   "")
----

when VARNAME is encountered, it will use the nice prompt.

Prompts can be extended as well. For example:

prompt VARNAME "VARNAME: " default "srecode" read y-or-n-p

In this case, the default keyword indicates that "srecode" is the default string to use, and y-or-n-p is the function to use to ask the question.

For y-or-n-p if you type “y” it inserts the default string, otherwise it inserts empty.

For any other symbol that occurs after the read token, it is expected to take the same argument list as read-string. As such, you can create your own prompts that do completing reads on deterministic values.

To have the default be calculated later from a dictionary entry, you need to use the defaultmacro keyword instead.

prompt VARNAME "Varname: " defaultmacro "PREFIX"

now, when it attempts to read in VARNAME, it will pre-populate the text editing section with whatever the value of PREFIX is.

Some language arguments may supply possible prefixes for prompts. Look for these when creating your prompts.