- try
- let selected_node = mathview#get_selection in
- try
- let parent_node = selected_node#get_parent in
- mathview#set_selection parent_node;
- print_string "set selection: SEEMS TO WORK\n"
- with
- O.Minidom_exception s ->
- print_string ("EXCEPTION: " ^ s ^ "\n")
- with
- GtkMathView.MathView.NoSelection ->
- print_string "set_selection: YOU MUST PREVIOUSLY SELECT A NON-ROOT NODE\n"
+ match mathview#get_selection with
+ | Some node ->
+ begin
+ try
+ let parent_node = node#get_parent in
+ mathview#set_selection (Some parent_node);
+ print_string "set selection: SEEMS TO WORK\n"
+ with
+ _ -> print_string "EXCEPTION: no parent\n"
+ end
+ | None ->
+ mathview#set_selection None;
+ print_string "no selection\n"