Modes permits to locally configure key bindings and default font. See also C-mode §5.24 page and french mode §5.19 page .
Returns the name of the current window mode in a new allocated string.
ATTENTION Be careful, the string is allocated each time the function is called, use free() to release it.
void create_mode(char * name)
void create_mode(char * name, char * suffixes)
void create_mode(char * name, char * suffixes, char * fontname)
Creates a new mode named name if it does not already exist. This mode will be created with default mode bindings. If suffixes is valuated, the next file having one of these suffixes will be loaded in name mode. This also goes for fontname.
suffixes is one or a sequence of words beginning by a dot, and
separated by a space. For instance the C\_
mode associated
suffixes are defined with ".h .c .C .H .sc"
.
create_mode("secret-mode", ".dontreadme", "5x8");
void set_mode_suffixes(char * modename, char * suffixes)
Changes the suffixes associated to the mode modename.
void set_mode_font(char * modename, char * fontname)
Changes the font associated to the mode modename.
void set_mode(char * modename)
Changes the current window mode to modename.
void key_def(char * modename, char * keys, char * funcname)
Changes or creates the given mode key binding keys if
funcname is not 0, else removes key binding keys. The
specified key binding can be (?
is any character except ^
):
"?"
for instance }
blinks the current {
in
C\_
mode,
"^?"
to bind a control key (except ^
x), for
instance "^i"
re-indents the current line in
C\_
mode(of course, in this case you can also give
"\t"
),
"^[?"
to bind an escape key sequence,
"^x?"
to bind an ctrlx key sequence
"^x^?"
to bind an ctrlx ctrlkey sequence.
"^[^?"
to bind an escape ctrlkey sequence.
Furthermore:
`^^'
appoints the `^'
character
`^'
and `^@'
appoint the null character (code 0).
It is also possible to bind keysym keys (`k'
is the keysym
name):
"k"
to bind a keysym
"^[k"
to bind an escape keysym
"^xk"
to bind an ctrlx keysym
where `k'
is one of (case is not significant) Multi\_
key,
Home, Left, Up, Right, Down, Prior,
Next, End, Begin, Select, Print, Execute,
Insert, Undo, Redo, Menu, Find, Cancel,
Help, Break, Mode\_
switch, script\_
switch,
Num\_
Lock, KP\_
Space, KP\_
Tab, KP\_
Enter,
KP\_
F1, KP\_
F2, KP\_
F3, KP\_
F4,
KP\_
Equal, KP\_
Multiply, KP\_
Separator,
KP\_
Add, KP\_
Subtract, KP\_
Decimal,
KP\_
Divide, KP, KP
, KP
,
KP
, KP
, KP
, KP
, KP
, KP
, KP
, F1, F10, F11,
F12, F13, F14, F15, F16, F17, F18,
F19, F2, F20, F21, F22, F23, F24,
F25, F26, F27, F28, F29, F3, F30,
F31, F32, F33, F34, F35, F4, F5,
F6, F7, F8, F9, L1, L10, L2, L3, L4, L5, L6, L7, L8, L9, R1,
R10, R11, R12, R13, R14, R15, R2,
R3, R4, R5, R6, R7, R8, R9.
The KP
\_
names refer to the keypad numbers and functions.
Sometimes a key can have several names.
funcname is the name of the function you want to be called when you hit
the keys sequence in the mode modename. The name appoints a Smac
function (built-in or not, taking no arguments) or must be one of the
following: set\_
mark, abort, return, delete,
tab, kill\_
line, cursor\_
down, cursor\_
up, open\_
space, undo, redo, next\_
page, kill\_
region, paste\_
region, eval\_
region, first\_
page, last\_
page, previous\_
page, copy\_
region, delete\_
window,
goto\_
mark, backward\_
search,
forward\_
search, global\_
replace,
write\_
file, kill\_
current\_
buffer, query\_
replace,
save\_
file, read\_
file, insert\_
file,
exchange\_
cursor\_
mark, list\_
open\_
file,
goto\_
line, and eval\_
expression.
These functions are the functions called by the default key bindings,
contrarily to Smac functions they take no argument but asks for them if
necessary. For instance the goto\_
line() Smac function take one
argument, but a key binding with "goto\_
line" prompts the line number
in the mini-buffer. The kill\_
current\_
buffer() Smac function
empties a buffer without confirmation if the buffer is modified, but a key
binding with "kill\_
current\_
buffer" asks if the buffer must be
saved or not.