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 loc -> b#select_location loc
    );
    b
  with Not_found -> create_buffer ~attributes filename