Modes permits to locally configure key bindings and default font. See also C-mode §5.24 page and french mode §5.19 page .
char * current_mode()
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
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
}blinks the current
"^?"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
"^[?"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.
`^@'appoint the null character (code 0).
It is also possible to bind keysym keys (
`k' is the keysym
"k"to bind a keysym
"^[k"to bind an escape keysym
"^xk"to bind an ctrlx keysym
`k' is one of (case is not significant) Multi
Home, Left, Up, Right, Down, Prior,
Next, End, Begin, Select, Print, Execute,
Insert, Undo, Redo, Menu, Find, Cancel,
Help, Break, Mode
, 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.
\_ 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
\_mark, abort, return, delete,
\_space, undo, redo, next
\_line, and eval
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
\_buffer() Smac function
empties a buffer without confirmation if the buffer is modified, but a key
binding with "kill
\_buffer" asks if the buffer must be
saved or not.