method set_location (l,c) =
      (*      prerr_endline (Printf.sprintf "set_location(%d,%d)" l c);*)
      (* to avoid a fatal gtk error if the offset on line is bigger than
         the maximum offset of the line, we minimize the column by
         (the number of chars on the line) - 1. *)

      let b = file#buffer in
      let current_loc = self#location_in_buffer in
      if current_loc = (l,c) then
        begin
          (*          prerr_endline (Printf.sprintf "current_loc = (l,c)");*)
          self#update_my_location
        end
      else
        begin
          let l = max 0 (min (b#line_count - 1) l) in
          let it1 = b#get_iter (`LINECHAR (l,0)) in
          let chars = it1#chars_in_line - 1 in
          let c = max 0 (min c chars) in
          let it = b#get_iter (`LINECHAR (l,c)) in
          self#place_cursor it
        end;
      source_view#scroll_to_mark `INSERT