Description: Documentation

## variable ALT_CHAR

### Synopsis

Controls the Alt character prefix

### Usage

Int_Type ALT_CHAR

### Description

If this variable is non-zero, characters pressed in combination the Alt key will generate a two character sequence: the first character is the value of ALT_CHAR itself followed by the character pressed. For example, if Alt-X is pressed and ALT_CHAR has a value of 27, the characters ESC X will be generated.

### Notes

This variable may not be available on all platforms.

### See also

META_CHAR , FN_CHAR

## variable CURRENT_KBD_COMMAND

### Synopsis

The currently executing keyboard command

### Usage

String_Type CURRENT_KBD_COMMAND

### Description

The value of the CURRENT_KBD_COMMAND function represents the name of the currently executing procedure bound to the currently executing key sequence.

### See also

LASTKEY , LAST_KBD_COMMAND, _function_name

## variable DEC_8BIT_HACK

### Synopsis

Set the input mode for 8 bit control characters

### Usage

Int_Type DEC_8BIT_HACK

### Description

If set to a non-zero value, a input character between 128 and 160 will be converted into a two character sequence: ESC and the character itself stripped of the high bit + 64. The motivation behind this variable is to enable the editor to work with VTxxx terminals that are in eight bit mode.

### See also

META_CHAR

## variable DEFINING_MACRO

### Synopsis

Non-zero if defining a macro

### Usage

Int_Type DEFINING_MACRO

### Description

The DEFINING_MACRO variable will be non-zero is a keyboard macro definition is in progress.

### See also

EXECUTING_MACRO

## variable EXECUTING_MACRO

### Synopsis

Non-zero is a keyboard macro is currently executing

### Usage

Int_Type EXECUTING_MACRO

### Description

The EXECUTING_MACRO variable will be non-zero is a keyboard macro is currently being executed.

### See also

## variable FN_CHAR

### Synopsis

Controls the function key prefix

### Usage

Int_Type FN_CHAR

### Description

If this variable is non-zero, function keys presses will generate a two character sequence: the first character is the value of the FN_CHAR itself followed by the character pressed.

### Notes

This variable is available only for Microsoft window systems.

### See also

ALT_CHAR , META_CHAR

## variable IGNORE_USER_ABORT

### Synopsis

Control keyboard interrupt processing

### Usage

Int_Type IGNORE_USER_ABORT

### Description

If set to a non-zero value, the keyboard interrupt character, e.g., Ctrl-G will not trigger a S-Lang error. When JED starts up, this value is set to 1 so that the user cannot interrupt the loading of site.sl. Later, it is set to 0.

### See also

set_abort_char

## variable KILL_LINE_FEATURE

### Synopsis

Configure the kill_line function

### Usage

Int_Type KILL_LINE_FEATURE

### Description

If non-zero, kill_line will kill through end of line character if the cursor is at the beginning of a line. Otherwise, it will kill only to the end of the line.

### See also

bolp

## variable LASTKEY

### Synopsis

The value of the current key sequence

### Usage

String_Type LASTKEY

### Description

The value of the LASTKEY variable represents the currently executing key sequence.

### Notes

Key sequences involving the null character may not be accurately recorded.

### See also

LAST_KBD_COMMAND

## variable LAST_CHAR

### Synopsis

The Last Character read from the keyboard

### Usage

Int_Type LAST_CHAR

### Description

The value of LAST_CHAR will be the last character read from the keyboard buffer.

### See also

## variable LAST_KEY

### Synopsis

Get the last key sequence

### Usage

String_Type LAST_KEY

### Description

The LASTKEY variable contains the most recently entered keyboard sequence.

### Notes

Key sequences using the null character may not be recorded accurately.

### See also

LAST_CHAR

## variable META_CHAR

### Synopsis

Specify the meta-character

### Usage

Int_Type META_CHAR

### Description

This variable determines how input characters with the high bit set are to be treated. If META_CHAR is less than zero, the character is passed through un-processed. However, if META_CHAR is greater than or equal to zero, an input character with the high bit set is mapped to a two character sequence. The first character of the sequence is the character whose ascii value is META_CHAR and the second character is the input with its high bit stripped off.

### See also

DISPLAY_EIGHT_BIT , DEC_8BIT_HACK

## variable X_LAST_KEYSYM

### Synopsis

Keysym associated with the last key

### Usage

Int_Type X_LAST_KEYSYM

### Description

The value of the X_LAST_KEYSYM variable represents the keysym of the most previously processed key.

### Notes

This variable is availible only in the XWindows version of Jed.

### See also

LASTKEY

## function buffer_keystring

### Synopsis

buffer_keystring

### Usage

Void buffer_keystring (String str);

### Description

Append string str to the end of the input stream to be read by JED's getkey routines.

### See also

ungetkey , getkey

## function definekey

### Synopsis

definekey

### Usage

Void definekey(String f, String key, String kmap);

### Description

Unlike setkey which operates on the global keymap, this function is used for binding keys to functions in a specific keymap. Here f is the function to be bound, key is a string of characters that make up the key sequence and kmap is the name of the keymap to be used. See setkey for more information about the arguments.

### See also

setkey , undefinekey , make_keymap , use_keymap

## function dump_bindings

### Synopsis

dump_bindings

### Usage

Void dump_bindings(String map);

### Description

This functions inserts a formatted list of keybindings for the keymap specified by map into the buffer at the current point.

### See also

get_key_function

## function enable_flow_control

### Synopsis

enable_flow_control

### Usage

Void enable_flow_control (Integer flag);

### Description

This Unix specific function may be used to turn XON/XOFF flow control on or off. If flag is non-zero, flow control is turned on; otherwise, it is turned off.

## function flush_input

### Synopsis

flush_input

### Usage

Void flush_input ();

### Description

This function may be used to remove all forms of queued input.

### See also

input_pending , getkey

## function get_key_function

### Synopsis

get_key_function

### Usage

String get_key_function ();

### Description

get_key_function waits for a key to be pressed and returns a string that represents the binding of the key. If the key has no binding the empty string is returned. Otherwise, it also returns an integer that describes whether or not the function is an internal one. If the function is internal, 1 will be returned; otherwise zero will be returned to indicate that the binding is either to an S-Lang function or a macro. If it is a macro, the first character of the of returned string will be the @ character.

### See also

getkey , input_pending

## function getkey

### Synopsis

getkey

### Usage

Integer getkey ();

### Description

The getkey function may be used to read an input character from the keyboard. It returns an integer in the range 0 to 256 which represents the ASCII or extended ASCII value of the character.

### See also

input_pending , ungetkey

## function input_pending

### Synopsis

input_pending

### Usage

Integer input_pending (Integer tsecs);

### Description

This function is used to see if keyboard input is available to be read or not. The paramter tsecs is the amount of time to wait for input before returning if input is not available. The time unit for tsecs is one-tenth of a second. That is, to wait up to one second, pass a value of ten to this routine. It returns zero if no input is available, otherwise it returns non-zero. As an example,

            define peek_key ()
            {
              variable ch;
              !if (input_pending (0)) return -1;
              ch = getkey ();
              ungetkey (ch);
              return ch;
            }

returns the value of the next character to be read if one is available; otherwise, it returns -1.

### See also

getkey , ungetkey

## function keymap_p

### Synopsis

keymap_p

### Usage

Integer keymap_p (String kmap);

### Description

The keymap_p function may be used to determine whether or not a keymap with name kmap exists. If the keymap specified by kmap exists, the function returns non-zero. It returns zero if the keymap does not exist.

### See also

make_keymap , definekey

## function make_keymap

### Synopsis

make_keymap

### Usage

Void make_keymap (String km);

### Description

The make_keymap function creates a keymap with a name specified by the km parameter. The new keymap is an exact copy of the pre-defined "global" keymap.

### See also

use_keymap , keymap_p , definekey , setkey

## function map_input

### Synopsis

map_input

### Usage

Void map_input (Integer x, Integer y);

### Description

The map_input function may be used to remap an input character with ascii value x from the keyboard to a different character with ascii value y . This mapping can be quite useful because it takes place before the editor interprets the character. One simply use of this function is to swap the backspace and delete characters. Since the backspace character has an ascii value of 8 and the delete character has ascii value 127 , the statement

            map_input (8, 127);

maps the backspace character to a delete character and

            map_input (127, 8);

maps the delete character to a backspace character. Used together, these two statement effectively swap the delete and backspace keys.

### See also

getkey

## function prefix_argument

### Synopsis

prefix_argument

### Usage

Integer prefix_argument (Integer dflt);

### Description

This function may be used to determine whether or not the user has entered a prefix argument from the keyboard. If a prefix argument is present, its value is returned; otherwise, dflt is returned. Calling this function cancels the prefix argument. For example,

            variable arg = prefix_argument (-9999);
            if (arg == -9999)
              message ("No Prefix Argument");
            else
              message (Sprintf ("Prefix argument: %d", arg, 1));

displays the prefix argument in the message area. Note: This function is incapable of distinguishing between the case of no prefix argument and when the argument's value is dflt . Currently, this is not a problem because the editor does not allow negative prefix arguments.

### See also

set_prefix_argument

## function set_abort_char

### Synopsis

set_abort_char

### Usage

Void set_abort_char (Integer ch);

### Description

This function may be used to change the keyboard character that generates an S-Lang interrupt. The parameter ch is the ASCII value of the character that will become the new abort character. The default abort character Ctrl-G corresponds to ch=7 .

## function set_current_kbd_command

### Synopsis

set_current_kbd_command

### Usage

Void set_current_kbd_command (String s);

### Description

Undocumented

## function set_prefix_argument

### Synopsis

Set the prefix argument

### Usage

Void set_prefix_argument (Int_Type n)

### Description

This function may be used to set the prefix argument to the value specified by n . If n is less than zero, then the prefix argument is cancelled.

### See also

prefix_argument

## function setkey

### Synopsis

setkey

### Usage

Void setkey(String fun, String key);

### Description

This function may be used to define a key sequence specified by the string key to the function fun . key can contain the ^ character which denotes that the following character is to be interpreted as a control character, e.g.,

            setkey("bob", "^Kt");

sets the key sequence Ctrl-K t to the function bob . The fun argument is usually the name of an internal or a user defined S-Lang function. However, if may also be a sequence of functions or even another keysequence (a keyboard macro). For example,

            setkey ("bol;insert(string(whatline()))", "^Kw");

assigns the key sequence Ctrl-K w to move to the beginning of a line and insert the current line number. For more information about this important function, see the JED User Manual. Note that setkey works on the "global" keymap.

### See also

unsetkey , definekey

## function undefinekey

### Synopsis

undefinekey

### Usage

Void undefinekey (String key, String kmap);

### Description

This function may be used to remove a keybinding from a specified keymap. The key sequence is given by the parameter key and the keymap is specified by the second parameter kmap .

### See also

unsetkey , definekey , what_keymap

## function ungetkey

### Synopsis

ungetkey

### Usage

Void ungetkey (Integer ch);

### Description

This function may be used to push a character ch represented by its ASCII value, onto the input stream. This means that the next keyboard to be read will be ch .

### See also

buffer_keystring , getkey , get_key_function

## function unsetkey

### Synopsis

unsetkey

### Usage

Void unsetkey(String key);

### Description

This function is used to remove the definition of the key sequence key from the "global" keymap. This is sometimes necessary to bind new key sequences which conflict with other ones. For example, the "global" keymap binds the keys "^[[A" , "^[[B" , "^[[C" , and "^[[D" to the character movement functions. Using unsetkey("^[[A") will remove the binding of "^[[A" from the global keymap but the other three will remain. However, unsetkey("^[[") will remove the definition of all the above keys. This might be necessary to bind, say, "^[[" to some function.

### See also

setkey , undefinekey

## function use_keymap

### Synopsis

use_keymap

### Usage

Void use_keymap (String km);

### Description

This function may be used to dictate which keymap will be used by the current buffer. km is a string value that corresponds to the name of a keymap.

### See also

make_keymap , keymap_p , what_keymap

## function what_keymap

### Synopsis

what_keymap

### Usage

String what_keymap ();

### Description

This function returns the name of the keymap associated with the current buffer.

### See also

create_keymap, keymap_p

## function which_key

### Synopsis

which_key

### Usage

Integer which_key (String f);

### Description

The which_key function returns the the number of keys that are bound to the function f in the current keymap. It also returns that number of key sequences with control characters expanded as the two character sequence ^ and the the whose ascii value is the control character + 64. For example,

            define insert_key_bindings (f)
            {
               variable n, key;
               n = which_key (f);
               loop (n)
                 {
                     str = ();
                     insert (str);
                     insert ("\n");
                 }
            }

inserts into the buffer all the key sequences that are bound to the function f .

### See also

get_key_function , setkey , what_keymap