anchor.diff:  	_ -> wrangler_preview_server:add_files({FilePairs, LogMsg})
       end.
   
  +
  +write_refactored_files(FileName, AnnAST, Editor, Cmd) ->
  +    case Editor of
  +      emacs ->
  +	  refac_util:write_refactored_files_for_preview([{{FileName, FileName}, AnnAST}], Cmd),
  +	  {ok, [FileName]};
  +      eclipse ->
  +	  Content = refac_prettypr:print_ast(refac_util:file_format(FileName), AnnAST),
  +	  {ok, [{FileName, FileName, Content}]}
  +    end.
   
   
   %% =====================================================================
  
positive.code: 	 once_tdTU/3, stop_tdTP/3, full_tdTP/3, full_buTP/3,
  	 pos_to_fun_name/2, pos_to_fun_def/2, pos_to_var_name/2,
  	 pos_to_expr/3, pos_to_expr_list/3,
  	 pos_to_expr_or_pat_list/3, pos_to_syntax_units/6,
  	 pos_to_syntax_units/4, expr_to_fun/2, get_range/1,
  	 get_toks/1, concat_toks/1, tokenize/3,
  	 get_var_exports/1, get_env_vars/1, get_bound_vars/1,
  	 get_free_vars/1, get_client_files/2, expand_files/2,
  	 get_modules_by_file/1, reset_attrs/1, update_ann/2,
  	 parse_annotate_file_1/5, parse_annotate_file/3,
  	 parse_annotate_file/4, write_refactored_files/1,
  	 write_refactored_files_for_preview/2,
  	 build_lib_side_effect_tab/1,
  	 build_local_side_effect_tab/2, has_side_effect/3,
  
negative.code: 
  -spec(pos_to_expr(Tree::syntaxTree(), Start::pos(), End::pos()) ->{ok, syntaxTree()} | {error, string()}).
  pos_to_expr(Tree, Start, End) ->
      Es =lists:flatten(pos_to_expr_1(Tree, Start, End)),
      case Es of
  	[] -> {error, "You have not selected an expression, "
  	       "or the function containing the expression selected does not parse."};
  	_ -> {ok, hd(Es)}
      end.
  
  pos_to_expr_1(Tree, Start, End) ->
      {S, E} = get_range(Tree),
      if (S >= Start) and (E =< End) ->
  	    case is_expr(Tree) of
  		true ->
  		    [Tree];
  		_ ->
  		    Ts = refac_syntax:subtrees(Tree),
  		    R0 = [[pos_to_expr_1(T, Start, End) || T <- G]
  			  || G <- Ts],
  		    lists:append(R0)
  	    end;
         (S > End) or (E < Start) -> [];
         (S < Start) or (E > End) ->
  	    Ts = refac_syntax:subtrees(Tree),
  	    R0 = [[pos_to_expr_1(T, Start, End) || T <- G]
  		  || G <- Ts],
  	    lists:append(R0);
         true -> []
      end.
  
  
  %% =====================================================================
  %% get the list expressions enclosed by start and end locations.
  
  -spec(pos_to_expr_list(Tree::syntaxTree(), Start::pos(), End::pos()) ->
  	     [syntaxTree()]).
  
  pos_to_expr_list(AnnAST, Start, End) ->
      Es = pos_to_expr_list_1(AnnAST, Start, End, fun is_expr/1),
      get_expr_list(Es).
  
  pos_to_expr_or_pat_list(AnnAST, Start, End) ->
      F = fun(E) ->is_expr(E) orelse is_pattern(E) end,
      Es =pos_to_expr_list_1(AnnAST, Start, End, F),
      get_expr_list(Es).
   
  pos_to_expr_list_1(Tree, Start, End, F) ->
      {S, E} = get_range(Tree),
      if (S >= Start) and (E =< End) ->
  	    case F(Tree) of
  		true ->
  		    [Tree];
  		_ ->
  		    Ts = refac_syntax:subtrees(Tree),
  		    [[lists:append(pos_to_expr_list_1(T, Start, End, F))|| T <- G]
  		     || G <- Ts]
  	    end;
         (S > End) or (E < Start) -> [];
         (S < Start) or (E > End) ->
  	    Ts = refac_syntax:subtrees(Tree),
  	    [[lists:append(pos_to_expr_list_1(T, Start, End, F)) || T <- G]
  	     || G <- Ts];
         true -> []
      end.
  
  get_expr_list(Es) ->
      case [E|| E<-Es, lists:flatten(E)/=[]] of 
  	[] ->
  	    [];
  	[H|_T] -> 
  	    get_expr_list_1(H)
      end.
  
  get_expr_list_1(L) ->
      F = fun (E) -> not is_list(E) orelse E == [] end,
      case lists:all(F, L) of
        true ->
  	  [E || E <- L, E /= []];
        false ->
  	  get_expr_list(L)
      end.
  
  
  
  %% ===========================================================================
  %% @spec expr_to_fun(Tree::syntaxTree(), Exp::syntaxTree())->
  