Controls the Alt character prefix
Int_Type ALT_CHAR
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.
This variable may not be available on all platforms.
META_CHAR, FN_CHAR
The currently executing keyboard command
String_Type CURRENT_KBD_COMMAND
The value of the CURRENT_KBD_COMMAND
function represents the
name of the currently executing procedure bound to the currently
executing key sequence.
LASTKEY, LAST_KBD_COMMAND, _function_name
Set the input mode for 8 bit control characters
Int_Type DEC_8BIT_HACK
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.
META_CHAR
Non-zero if defining a macro
Int_Type DEFINING_MACRO
The DEFINING_MACRO
variable will be non-zero is a keyboard
macro definition is in progress.
EXECUTING_MACRO
Non-zero is a keyboard macro is currently executing
Int_Type EXECUTING_MACRO
The EXECUTING_MACRO
variable will be non-zero is a keyboard
macro is currently being executed.
Controls the function key prefix
Int_Type FN_CHAR
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.
This variable is available only for Microsoft window systems.
ALT_CHAR, META_CHAR
Control keyboard interrupt processing
Int_Type IGNORE_USER_ABORT
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.
set_abort_char
Configure the kill_line function
Int_Type KILL_LINE_FEATURE
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.
bolp
The value of the current key sequence
String_Type LASTKEY
The value of the LASTKEY
variable represents the currently
executing key sequence.
Key sequences involving the null character may not be accurately recorded.
LAST_KBD_COMMAND
The Last Character read from the keyboard
Int_Type LAST_CHAR
The value of LAST_CHAR
will be the last character read from
the keyboard buffer.
Get the last key sequence
String_Type LAST_KEY
The LASTKEY
variable contains the most recently entered
keyboard sequence.
Key sequences using the null character may not be recorded accurately.
LAST_CHAR
Specify the meta-character
Int_Type META_CHAR
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.
DISPLAY_EIGHT_BIT, DEC_8BIT_HACK
Keysym associated with the last key
Int_Type X_LAST_KEYSYM
The value of the X_LAST_KEYSYM
variable represents the keysym
of the most previously processed key.
This variable is availible only in the XWindows version of JED.
LASTKEY
buffer_keystring
Void buffer_keystring (String str);
Append string str
to the end of the input stream to be read by JED's
getkey routines.
ungetkey, getkey
definekey
Void definekey(String f, String key, String kmap);
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.
setkey, undefinekey, make_keymap, use_keymap
dump_bindings
Void dump_bindings(String map);
This functions inserts a formatted list of keybindings for the keymap
specified by map
into the buffer at the current point.
get_key_function
enable_flow_control
Void enable_flow_control (Integer flag);
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.
flush_input
Void flush_input ();
This function may be used to remove all forms of queued input.
input_pending, getkey
get_key_function
String get_key_function ();
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.
getkey, input_pending
getkey
Integer getkey ();
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.
input_pending, ungetkey
input_pending
Integer input_pending (Integer tsecs);
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.
getkey, ungetkey
keymap_p
Integer keymap_p (String kmap);
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.
make_keymap, definekey
make_keymap
Void make_keymap (String km);
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.
use_keymap, keymap_p, definekey, setkey
map_input
Void map_input (Integer x, Integer y);
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.
getkey
prefix_argument
Integer prefix_argument (Integer dflt);
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.
set_prefix_argument
set_abort_char
Void set_abort_char (Integer ch);
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
.
set_current_kbd_command
Void set_current_kbd_command (String s);
Undocumented
Set the prefix argument
Void set_prefix_argument (Int_Type n)
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.
prefix_argument
setkey
Void setkey(String fun, String key);
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.
unsetkey, definekey
undefinekey
Void undefinekey (String key, String kmap);
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
.
unsetkey, definekey, what_keymap
ungetkey
Void ungetkey (Integer ch);
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
.
buffer_keystring, getkey, get_key_function
unsetkey
Void unsetkey(String key);
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.
setkey, undefinekey
use_keymap
Void use_keymap (String km);
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.
make_keymap, keymap_p, what_keymap
what_keymap
String what_keymap ();
This function returns the name of the keymap associated with the current buffer.
create_keymap, keymap_p
which_key
Integer which_key (String f);
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
.
get_key_function, setkey, what_keymap