next up previous contents index
Next: Others Up: Functions Previous: Colors


Modes permits to locally configure key bindings and default font. See also C-mode §5.24 page gif and french mode §5.19 page gif.


  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\_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 ^):


  It is also possible to bind keysym keys (`k' is the keysym name):

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.

next up previous contents index
Next: Others Up: Functions Previous: Colors

Lionel Fournigault
Mon Mar 6 13:33:34 MET 1995