anchor.diff:  %% expressions is a sequence of expressions separated by ','.
   %% </p>
   %% =================================================================================================
  -%% @spec expr_search(FileName::filename(), Start::Pos, End::Pos, integer())-> 
  -%%           {ok, [{integer(), integer(), integer(), integer()}]} | {error, string()}.
  +%% @spec expr_search_in_buffer(FileName::filename(), Start::Pos, End::Pos, integer(), SearchPaths::[dir()])-> 
  +%%           {ok, [{filename(), {integer(), integer()}, {integer(), integer()}}]}.
   %% =================================================================================================         
  -%%-spec(expr_search/4::(filename(), pos(), pos(), integer()) -> 
  -%%    {ok, [{integer(), integer(), integer(), integer()}]} | {error, string()}).    
  -expr_search(FileName, Start = {Line, Col}, End = {Line1, Col1}, TabWidth) ->
  +-spec(expr_search_in_buffer/5::(filename(), pos(), pos(), integer(), [dir()]) -> 
  +    {ok, [{filename(),{{integer(), integer()}, {integer(), integer()}}}]}).
  +expr_search_in_buffer(FileName, Start = {Line, Col}, End = {Line1, Col1}, SearchPaths, TabWidth) ->
       ?wrangler_io("\nCMD: ~p:expr_search(~p, {~p,~p},{~p,~p},~p).\n",
   		 [?MODULE, FileName, Line, Col, Line1, Col1, TabWidth]),
  -    {ok, {AnnAST, _Info}} = refac_util:parse_annotate_file(FileName, true, [], TabWidth),
  +    Es =  get_expr_selected(FileName, Start, End, SearchPaths, TabWidth),
  +    Res = do_expr_search(FileName, Es, SearchPaths, TabWidth),
  +    SE = refac_sim_expr_search:get_start_end_loc(Es),
  +    Res1 =[{FileName, SE}| Res -- [{FileName, SE}]],
  +    display_search_result(Res1).
  +
  +-spec(expr_search_in_dirs/5::(filename(), pos(), pos(), integer(), [dir()]) -> 
  +    {ok, [{filename(),{{integer(), integer()}, {integer(), integer()}}}]}).   
  +expr_search_in_dirs(FileName, Start = {Line, Col}, End = {Line1, Col1}, SearchPaths, TabWidth) ->
  +    ?wrangler_io("\nCMD: ~p:expr_search_in_dirs(~p, {~p,~p},{~p,~p},~p, ~p).\n",
  +		 [?MODULE, FileName, Line, Col, Line1, Col1, SearchPaths, TabWidth]),
  +    Files =[FileName|(refac_util:expand_files(SearchPaths, ".erl")-- [FileName])],
  +    Es =  get_expr_selected(FileName, Start, End, SearchPaths, TabWidth),
  +    Res =lists:append([do_expr_search(F, Es, SearchPaths, TabWidth) ||F<-Files]),
  +    SE = refac_sim_expr_search:get_start_end_loc(Es),
  +    Res1 =[{FileName, SE}| Res -- [{FileName, SE}]],
  +    display_search_result(Res1).
  +
  +get_expr_selected(FileName, Start, End, SearchPaths, TabWidth) ->
  +    {ok, {AnnAST, _Info}} = refac_util:parse_annotate_file(FileName, true, SearchPaths, TabWidth),
       Es = refac_util:pos_to_expr_list(AnnAST, Start, End),
       case Es of
  -      [] -> throw({error, "You have not selected an expression!"});
  -      _ -> ok
  -    end,
  -    Res =  do_expr_search(AnnAST, Es),
  -    case Res of
  -      [] -> ?wrangler_io("No identical expression has been found. \n", []),
  -	    {ok, []};
  -      [_] ->
  -	  ?wrangler_io("No identical expression has been found. \n", []),
  -	  {ok, []};
  -      _ -> ?wrangler_io("\n~p identical expressions(including the "
  -			"expression selected) have been found.\n", [length(Res)]),
  -	   ?wrangler_io(compose_search_result_info(FileName, Res), []),
  -	   ?wrangler_io("\nUse 'C-c C-e' to remove highlights!\n", []),
  -	   {ok, Res}
  -    end.
  -
  -do_expr_search(AnnAST, Es) ->
  -    case Es of
  -	[E] ->
  -	    SE = refac_sim_expr_search:get_start_end_loc(E),
  -	  SearchRes = search_one_expr(AnnAST, E),
  -	    [SE| SearchRes -- [SE]];
  -	_ ->
  -	    SE = refac_sim_expr_search:get_start_end_loc(Es),
  -	    SearchRes = search_expr_seq(AnnAST, Es),
  -	    [SE| SearchRes -- [SE]]
  -    end.
  -
  -    
  -%%-spec(expr_search_eclipse/4::(filename(), pos(), pos(), integer()) ->
  -%%   {ok, [{integer(), integer(), integer(), integer()}]} | {error, string()}).
  +	[] -> throw({error, "You have not selected an expression!"});
  +	_ -> Es
  +    end.
  +   
  +do_expr_search(FileName, Es, SearchPaths, TabWidth) ->
  +    try  refac_util:parse_annotate_file(FileName, true, SearchPaths, TabWidth) of
  +	{ok, {AnnAST, _}} ->
  +	    case length(Es) of 
  +		1 -> search_one_expr(FileName, AnnAST, hd(Es));
  +		_ -> search_expr_seq(FileName, AnnAST, Es)
  +	    end
  +    catch
  +	_E1:_E2 ->
  +	    []
  +    end.
  +
  +-spec(expr_search_eclipse/4::(filename(), pos(), pos(), integer()) ->
  +   {ok, [{{integer(), integer()}, {integer(), integer()}}]} | {error, string()}).
   expr_search_eclipse(FileName, Start, End, TabWidth) ->
       {ok, {AnnAST, _Info}} =refac_util:parse_annotate_file(FileName,true, [], TabWidth),
       case refac_util:pos_to_expr_list(AnnAST, Start, End) of 
   	[E|Es] -> 
   	    Res = case Es == [] of 
   		      true ->
  -			  search_one_expr(AnnAST, E);
  +			  search_one_expr(FileName, AnnAST, E);
   		      _ -> 
  -			  search_expr_seq(AnnAST, [E|Es])
  +			  search_expr_seq(FileName, AnnAST, [E|Es])
   		  end,
  -	    {ok, Res};	
  +	    {ok, [SE||{_File, SE} <-Res]};	
   	_   -> {error, "You have not selected an expression!"}
       end.     
   
   %% Search the clones of an expression from Tree.
  -search_one_expr(Tree, Exp) ->
  +search_one_expr(FileName, Tree, Exp) ->
       SimplifiedExp = simplify_expr(Exp),
       BdStructExp = var_binding_structure([Exp]),
       F = fun (T, Acc) ->
  
positive.code: 			  En = lists:last(List22),
  			  {StartLoc, _EndLoc} = refac_util:get_range(E1),
  			  {_StartLoc1, EndLoc1} = refac_util:get_range(En),
  			  [{StartLoc, EndLoc1}] ++ get_clone(ExpList1, tl(ExpList2));
  		      _ -> get_clone(ExpList1, tl(ExpList2))
  		  end;
  	      _ -> get_clone(ExpList1, tl(ExpList2))
  	  end;
  	_ -> []
      end.
  
negative.code: %% 
  -module(refac_expr_search).
  
  -export([expr_search_in_buffer/5, expr_search_in_dirs/5, expr_search_eclipse/4]).
  
  -export([contained_exprs/2, var_binding_structure/1, compose_search_result_info/2]).
  
  