; Classic Siag keybindings
(add_keybinding "SPC" "(set_block)")
(add_keybinding "C-@" "(set_mark_command)")
(add_keybinding "ESC SPC" "(unset_block)")
(add_keybinding "C-a" "(beginning_of_line)")
(add_keybinding "C-b" "(backward_cell)")
(add_keybinding "C-d" "(delete_cell)")
(add_keybinding "C-e" "(end_of_line)")
(add_keybinding "C-f" "(forward_cell)")
(add_keybinding "C-g" "(keyboard_quit)")
(add_keybinding "C-l" "(recenter)")
(add_keybinding "C-n" "(next_line)")
(add_keybinding "C-p" "(previous_line)")
(add_keybinding "C-o" "(insert_line)")
(add_keybinding "C-r" "(search_backward)")
(add_keybinding "C-s" "(search_forward)")
(add_keybinding "C-u" "(universal_argument)")
(add_keybinding "C-v" "(scroll_up)")
(add_keybinding "M-v" "(scroll_down)")
(add_keybinding "ESC v" "(scroll_down)")
(add_keybinding "M-x" "(execute_extended_command)")
(add_keybinding "ESC x" "(execute_extended_command)")
(add_keybinding "?" "(what_cursor_position)")
(add_keybinding "C-x ?" "(what_cursor_position)")
(add_keybinding "!" "(recalc_matrix)")
(add_keybinding "=" "(edit_expression)")
(add_keybinding "\"" "(edit_label)")
(add_keybinding "(" "(execute_extended_command)")
(add_keybinding "<" "(beginning_of_buffer)")
(add_keybinding "M-<" "(beginning_of_buffer)")
(add_keybinding "ESC <" "(beginning_of_buffer)")
(add_keybinding ">" "(end_of_buffer)")
(add_keybinding "M->" "(end_of_buffer)")
(add_keybinding "ESC >" "(end_of_buffer)")
(add_keybinding "ESC" "(prefix)")
(add_keybinding "ESC C-g" "(keyboard_quit)")
(add_keybinding "ESC b" "(scroll_right)")
(add_keybinding "ESC f" "(scroll_left)")
(add_keybinding "ESC g" "(go_to)")
(add_keybinding "ESC p" "(top_of_buffer)")
(add_keybinding "ESC n" "(bottom_of_buffer)")
(add_keybinding "ESC -" "(argument_sign)")
(add_keybinding "ESC 0" "(argument_digit)")
(add_keybinding "ESC 1" "(argument_digit)")
(add_keybinding "ESC 2" "(argument_digit)")
(add_keybinding "ESC 3" "(argument_digit)")
(add_keybinding "ESC 4" "(argument_digit)")
(add_keybinding "ESC 5" "(argument_digit)")
(add_keybinding "ESC 6" "(argument_digit)")
(add_keybinding "ESC 7" "(argument_digit)")
(add_keybinding "ESC 8" "(argument_digit)")
(add_keybinding "ESC 9" "(argument_digit)")

; Extended commands, inspired by Emacs
(add_keybinding "C-x" "(prefix)")
;(add_keybinding "C-x C-b" "(list_buffers)")
(add_keybinding "C-x C-c" "(quit_program)")
(add_keybinding "C-x C-f" "(load_buffer)")
(add_keybinding "C-x C-g" "(keyboard_quit)")
(add_keybinding "C-x C-s" "(save_buffer)")
(add_keybinding "C-x C-w" "(save_buffer_as)")
(add_keybinding "C-x C-x" "(exchange_point_and_mark)")
(add_keybinding "C-x b" "(switch_to_buffer)")
(add_keybinding "C-x e" "(call_last_kbd_macro)")
(add_keybinding "C-x k" "(kill_buffer 1)")
(add_keybinding "C-x o" "(other_window)")
(add_keybinding "C-x 0" "(delete_window)")
(add_keybinding "C-x 1" "(delete_other_windows)")
(add_keybinding "C-x 2" "(split_window_vertically)")
(add_keybinding "C-x =" "(what_cursor_position)")
(add_keybinding "C-x (" "(start_kbd_macro)")
(add_keybinding "C-x )" "(end_kbd_macro)")

; "Compatibility bindings" (similar to what Windows programs usually do)
(add_keybinding "C-c" "(prefix)")
(add_keybinding "C-C C-c" "(copy_block_to_string)")
(add_keybinding "C-c C-d" "(delete_cell)")
(add_keybinding "C-c C-f" "(search_forward)")
(add_keybinding "C-c C-g" "(keyboard_quit)")
(add_keybinding "C-c C-n" "(new_buffer)")
(add_keybinding "C-c C-o" "(load_buffer)")
(add_keybinding "C-c C-p" "(print)")
(add_keybinding "C-c C-q" "(quit_program)")
(add_keybinding "C-c C-s" "(save_buffer_as)")
(add_keybinding "C-c C-v" "(paste_block_from_string)")
(add_keybinding "C-c C-w" "(kill_buffer 1)")
(add_keybinding "C-C C-x" "(cut_block_to_string)")
(add_keybinding "C-c C-z" "(undo_restore)")

; Classic Siag weirdness
(add_keybinding "C-c !" "(recalc_matrix)")
(add_keybinding "C-c g" "(go_to)")
(add_keybinding "C-c l" "(edit_label)")
(add_keybinding "C-c x" "(edit_expression)")
(add_keybinding "C-c =" "(interpreter_test 'C)")
(add_keybinding "C-c b" "(prefix)")
(add_keybinding "C-c b ?" "(llpr \"One of SPC c d i p s\")")
(add_keybinding "C-c b C-g" "(keyboard_quit)")
(add_keybinding "C-c b SPC" "(set_block)")
(add_keybinding "C-c b c" "(copy_block)")
(add_keybinding "C-c b d" "(delete_block)")
(add_keybinding "C-c b f" "(fill_block)")
(add_keybinding "C-c b i" "(intelligent_copy_block)")
(add_keybinding "C-c b p" "(print)")
;(add_keybinding "C-c b s" "(save_block_file)")
(add_keybinding "C-c c" "(prefix)")
(add_keybinding "C-c c C-g" "(keyboard_quit)")
(add_keybinding "C-c c ?" "(llpr \"One of g s t\")")
;(add_keybinding "C-c c g" "(execute_guile)")
;(add_keybinding "C-c c s" "(execute_siod)")
;(add_keybinding "C-c c t" "(execute_tcl)")
(add_keybinding "C-c s" "(prefix)")
(add_keybinding "C-c s ?" "(llpr \"One of l r c w h\")")
(add_keybinding "C-c s C-g" "(keyboard_quit)")
;(add_keybinding "C-c s l" "(set_left_margin)")
;(add_keybinding "C-c s r" "(set_right_margin)")
;(add_keybinding "C-c s c" "(set_cell_width)")
;(add_keybinding "C-c s w" "(set_screen_width)")
;(add_keybinding "C-c s h" "(set_screen_height)")
(add_keybinding "C-c v" "(print_version)")
(add_keybinding "C-c x" "(prefix)")
(add_keybinding "C-c x C-g" "(keyboard_quit)")
(add_keybinding "C-c x ?" "(llpr \"One of c g s t\")")
(add_keybinding "C-c x c" "(edit_c)")
(add_keybinding "C-c x g" "(edit_guile)")
(add_keybinding "C-c x s" "(edit_siod)")
(add_keybinding "C-c x t" "(edit_tcl)")
(add_keybinding "C-c ?" "(prefix)")
(add_keybinding "C-c ? ?" "(llpr \"One of m s c p\")")
(add_keybinding "C-c C-g" "(keyboard_quit)")
;(add_keybinding "C-c ? m" "(show_margins)")
;(add_keybinding "C-c ? s" "(show_screen_size)")
;(add_keybinding "C-c ? c" "(show_cell_width)")
(add_keybinding "C-c ? p" "(show_pool_info)")
(add_keybinding "C-h" "(prefix)")
(add_keybinding "C-h C-g" "(keyboard_quit)")
;(add_keybinding "C-h a" "(command_apropos)")
;(add_keybinding "C-h b" "(describe_bindings)")
;(add_keybinding "C-h c" "(describe_key_briefly)")
(add_keybinding "C-h C-c" "(help_contents)")
;(add_keybinding "C-h f" "(describe_function)")
;(add_keybinding "C-h k" "(describe_key)")
(add_keybinding "C-h v" "(print_version)")
;(add_keybinding "C-h w" "(where_is)")
(add_keybinding "C-h C-h" "(help_for_help)")
(add_keybinding "C-h ?" "(llpr \"One of a b C-c c f k v w C-h\")")
(add_keybinding "RET" "(hyperlink)")
(add_keybinding "C-z" "(suspend_function)")
