Next: Browser interface Up: Modes Previous: set_mode

### key_def

`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 ctrl-x key sequence
- `"^x^?"` to bind an ctrl-x ctrl-key sequence.
- `"^[^?"` to bind an escape ctrl-key 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 ctrl-x 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_0, KP_1, KP_2, KP_3, KP_4, KP_5, KP_6, KP_7, KP_8, KP_9, 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: Browser interface Up: Modes Previous: set_mode