+(* let languages_manager =
+ GSourceView.source_languages_manager ~lang_files_dirs:["/etc"] () *)
+let languages_manager = GSourceView.source_languages_manager ()
+
+let lang =
+ if use_mime_type then
+ match languages_manager#get_language_from_mime_type lang_mime_type with
+ | None -> failwith (sprintf "no language for %s" lang_mime_type)
+ | Some lang -> lang
+ else
+ match
+ GSourceView.source_language_from_file ~languages_manager lang_file
+ with
+ | None -> failwith (sprintf "can't load %s" lang_file)
+ | Some lang -> lang
+
+let matching_bracket () =
+ let iter = source_view#source_buffer#get_iter_at_mark `INSERT in
+ match GSourceView.find_matching_bracket iter with
+ | None -> prerr_endline "no matching bracket"
+ | Some iter ->
+ source_view#source_buffer#place_cursor iter;
+ source_view#misc#grab_focus ()
+