let switch_file (v:Ed_sourceview.sourceview) args =
  let f = v#file#filename in
  try
    let filename2 =
      let ext =
        if Filename.check_suffix f ".ml" then
          "mli"
        else if Filename.check_suffix f ".mli" then
          "ml"
        else
          raise Not_found
      in
      Printf.sprintf "%s.%s" (Filename.chop_extension f) ext
    in
    let com = Printf.sprintf "open_file %s" (Filename.quote filename2) in
    Cam_commands.eval_command com
  with
    Not_found -> ()