Description: Documentation

## variable MINIBUFFER_ACTIVE

### Synopsis

Non-zero is the mini-buffer is in use

### Usage

Int_Type MINIBUFFER_ACTIVE

### Description

The MINIBUFFER_ACTIVE variable will be non-zero if the mini-buffer is in use.

### See also

read_mini

## function _add_completion

### Synopsis

_add_completion

### Usage

Void _add_completion (String f1, String f2, ..., Integer n);

### Description

The _add_completion function is like the add_completion function except that it takes n names f1 , ... fn . For example,

            _add_completion ("fun_a", "fun_b", 2);

is equivalent to

            add_completion ("fun_a");
            add_completion ("fun_b");

### See also

add_completion

## function add_completion

### Synopsis

add_completion

### Usage

Void add_completion(String f);

### Description

The add_completion function adds the user defined S-Lang function with name specified by the string f to the list of functions that are eligible for mini-buffer completion. The function specified by f must be already defined before this function is called. The S-Lang function is_defined may be used to test whether or not the function is defined.

### See also

read_with_completion , _add_completion

## function get_mini_response

### Synopsis

Prompt for a key

### Usage

Int_Type get_mini_response (String_Type str)

### Description

The get_mini_response function display the text str at the bottom of the screen and waits for the user to press a key. The key is returned.

### See also

read_mini , getkey , flush

## function get_y_or_n

### Synopsis

Prompt for a y or n response

### Usage

Int_Type get_y_or_n (String_Type str)

### Description

The get_y_or_n function forms a y/n question by concatenating "? (y/n)" to str and displays the result at the bottom of the display. It returns 1 if the user responds with y , 0 with n , or -1 if the user cancelled the prompt.

### See also

get_yes_no , get_mini_response

## function get_yes_no

### Synopsis

get_yes_no

### Usage

Integer get_yes_no (String s);

### Description

This function may be used to get a yes or no response from the user. The string parameter s will be used to construct the prompt by concating the string "? (yes/no)" to s . It returns 1 if the answer is yes or 0 if the answer is no.

### See also

getkey , flush , message

## function read_mini

### Synopsis

read_mini

### Usage

String read_mini (String prompt, String dflt, String init);

### Description

The read_mini function reads a line of input from the user in the mini-buffer. The first parameter, prompt , is used to prompt the user. The second parameter, dflt , is what is returned as a default value if the user simply presses the return key. The final parameter, init , is stuffed into the mini-buffer for editing by the user. For example,

            define search_whole_buffer ()
            {
              variable str;
              str = read_mini ("Search for:", "", "");
              !if (strlen (str)) return;
              !if (fsearch (str))
                 {
                   push_mark (); bob ();
                   if (fsearch (str)) pop_mark (0);
                   else pop_mark (1);
                     {
                        pop_mark (1);
                        error ("Not found");
                     }
                 }
            }

reads a string from the user and then searches forward for it and if not found, it resumes the search from the beginning of the buffer. Note: If the user aborts the function mini_read by pressing the keyboard quit character (e.g., Ctrl-G), an error is signaled. This error can be caught by an ERROR_BLOCK and the appropriate action taken. Also if the mini-buffer is already in use, this function should not be called. The variable MINIBUFFER_ACTIVE may be checked to determine if this is the case or not.

### See also

read_with_completion , getkey , input_pending

### See also

MINIBUFFER_ACTIVE

## function read_with_completion

### Synopsis

read_with_completion

### Usage

Void read_with_completion (String prt, String dflt, String s, Integer type);

### Description

This function may be used to read one of the objects specified by the last parameter type . The first parameter, prt , is used as a prompt, the second parameter, dflt , is used to specify a default, and the third parameter, s , is used to initialize the string to be read. type is an integer with the following meanings:

            'f'   file name
            'b'   buffer name
            'F'   function name
            'V'   variable name.

Finally, if type has the value 's' , then the set of completions will be defined by a zeroth parameter, list , to the function call. This parameter is simple a comma separated list of completions. For example,

            read_with_completion ("Larry,Curly,Moe", "Favorite Stooge:",
                                  "Larry", "", 's');

provides completion over the set of three stooges. The function returns the string read.

### See also

read_mini

## function set_expansion_hook

### Synopsis

set_expansion_hook

### Usage

Void set_expansion_hook (String fname);

### Description

This function may be used to specify a function that will be called to expand a filename upon TAB completion. The function fname must already be defined. When fname is called, it is given a string to be expanded. If it changes the string, it must return a non-zero value and the modified string. If the string is not modified, it must simply return zero.