let get_buffer ?(attributes=[]) filename =
try
if not (Sys.file_exists filename) then raise Not_found;
let b = List.find
(fun f -> Ed_misc.safe_same_files f#filename filename)
!buffers
in
let loc =
match get_att "location" attributes with
None -> None
| Some s -> location_of_string s
in
(
match loc with
| None -> ()
| Some (`Linechar (l,c)) -> b#set_location (l,c)
| Some (`Char c) ->
let it = b#buffer#get_iter (`OFFSET c) in
b#buffer#place_cursor ~where: it;
b#set_location (location_of_iter it)
);
b
with Not_found -> create_buffer ~attributes filename