anchor.diff:  -module(refac_new_let).
   
   -export([new_let/6,  new_let_1/7, new_let_eclipse/6, new_let_1_eclipse/6,
  -	 merge_let/3, merge_let_1/5, 
  -	 merge_forall/3, merge_forall_1/5,
  -	 merge_forall_eclipse/3]).
  +	 merge_let/3, merge_let_1/5, merge_let_eclipse/3, merge_let_1_eclipse/4,
  +	 merge_forall/3, merge_forall_1/5,merge_forall_eclipse/3, merge_forall_1_eclipse/4]).
   
   -include("../include/wrangler.hrl").
   
  
positive.code:     merge(FileName, 'LET', SearchPaths, TabWidth, emacs).
  
  
  
  -spec(merge_forall/3::(FileName::filename(), SearchPaths::[dir()], TabWidth::integer()) ->
  	     {not_found, string()} |{ok, [{{integer(), integer(), integer(), integer()}, string()}], string()}).
  merge_forall(FileName, SearchPaths, TabWidth) ->
      ?wrangler_io("\nCMD: ~p:merge_forall(~p,~p,~p).\n",
  		 [?MODULE, FileName, SearchPaths, TabWidth]),
      merge(FileName, 'FORALL', SearchPaths, TabWidth, emacs).
  
  
  merge_forall_eclipse(FileName, SearchPaths, TabWidth) ->
      merge(FileName, 'FORALL', SearchPaths, TabWidth, eclipse).
  
  
negative.code: -spec(merge_let_1/5::(FileName::filename(), Candidates::[{{integer(), integer(), integer(), integer()}, string()}],
  		      SearchPaths::[dir()], TabWidth::integer(), Cmd::string()) -> {ok, [filename()]}).
  merge_let_1(FileName, Candidates, SearchPaths, TabWidth, Cmd) ->
      merge_1(FileName, Candidates, SearchPaths, TabWidth, Cmd, emacs).
  
  
  -spec(merge_forall_1/5::(FileName::filename(), Candidates::[{{integer(), integer(), integer(), integer()}, string()}],
  		      SearchPaths::[dir()], TabWidth::integer(), Cmd::string()) -> {ok, [filename()]}).
  merge_forall_1(FileName, Candidates, SearchPaths, TabWidth, Cmd) ->
      merge_1(FileName, Candidates, SearchPaths, TabWidth, Cmd, emacs).
  
  
  
  -spec(merge_let_1_eclipse/4::(FileName::filename(), Candidates::[{{integer(), integer(), integer(), integer()}, syntaxTree()}],
  			      SearchPaths::[dir()], TabWidth::integer()) ->
  				   {'ok', [{filename(), filename(),string()}]}).
  merge_let_1_eclipse(FileName, Candidates, SearchPaths, TabWidth) ->
      merge_1(FileName, Candidates, SearchPaths, TabWidth, "", eclipse).
  
  
  -spec(merge_forall_1_eclipse/4::(FileName::filename(), Candidates::[{{{integer(), integer()}, {integer(), integer()}}, syntaxTree()}],
  				 SearchPaths::[dir()], TabWidth::integer()) -> 
  				      {'ok', [{filename(), filename(),string()}]}).
  merge_forall_1_eclipse(FileName, Candidates, SearchPaths, TabWidth) ->
      merge_1(FileName, Candidates, SearchPaths, TabWidth, "", eclipse).
  
  
  merge_1(FileName, Candidates, SearchPaths, TabWidth, Cmd, Editor) ->
      {ok, {AnnAST, _Info}} = refac_util:parse_annotate_file(FileName, true, SearchPaths, TabWidth),
      Candidates1 = case Editor of 
  		      emacs -> [{SE, list_to_term(NewLetApp)} || {SE, NewLetApp}<-Candidates];
  		      eclipse -> Candidates
  		  end,
      AnnAST1 = do_merge(AnnAST, Candidates1),
      case Editor of
  	emacs ->
  	    Res = [{{FileName, FileName}, AnnAST1}],
  	    refac_util:write_refactored_files_for_preview(Res, Cmd),
  	    {ok, [FileName]};
  	eclipse ->
  	    FileContent = refac_prettypr:print_ast(refac_util:file_format(FileName), AnnAST1),
  	    {ok, [{FileName, FileName, FileContent}]}
      end.
  
  
  do_merge(AnnAST, []) ->
      AnnAST;
  