anchor.diff:  -include("../include/wrangler.hrl").
   
   -define(DefaultSimiScore, 0.8).
  +
  +%%-define(DEBUG, true).
  +
  +-ifdef(DEBUG).
  +-define(debug(__String, __Args), ?wrangler_io(__String, __Args)).
  +-else.
  +-define(debug(__String, __Args), ok).
  +-endif.
  +
   %% ================================================================================================
   %% @doc Search expressions that are 'similar' to a user-selected expression or a sequence of expressions in the current buffer.
   %%
   %% <p> Given expression selected by the user, A say, expression B is similar to A if there exist a least general common abstation, C, 
  -%% such that, substitution C(Args1) = A, and C(Arg2) == B, and Size(C) /Size(A) > the threshold specified (0.6 by default).
  +%% such that, substitution C(Args1) = A, and C(Arg2) == B, and Size(C) /Size(A) > the threshold specified (0.8 by default).
   %% </p>
   %% <p> When the selected code contains multiple, but non-continuous sequence of, expressions, the first
   %% continuous sequence of expressions is taken as the user-selected expression. A continuous sequence of
   %% expressions is a sequence of expressions separated by ','.
   %% <p>
   
  --spec(sim_expr_search/6::(filename(), pos(), pos(), string(),[dir()],integer()) -> {ok, [{integer(), integer(), integer(), integer()}]} | {error, string()}).    
  +-spec(sim_expr_search/6::(filename(), pos(), pos(), string(),[dir()],integer()) 
  +      -> {ok, [{integer(), integer(), integer(), integer()}]} | {error, string()}).    
   sim_expr_search(FName, Start = {Line, Col}, End = {Line1, Col1}, SimiScore0, SearchPaths, TabWidth) ->
  -    ?wrangler_io("\nCMD: ~p:sim_expr_search(~p, {~p,~p},{~p,~p},~p, ~p, ~p).\n", [?MODULE, FName, Line, Col, Line1, Col1, SimiScore0, SearchPaths, TabWidth]),
  +    ?wrangler_io("\nCMD: ~p:sim_expr_search(~p, {~p,~p},{~p,~p},~p, ~p, ~p).\n", 
  +		 [?MODULE, FName, Line, Col, Line1, Col1, SimiScore0, SearchPaths, TabWidth]),
       SimiScore1 = case SimiScore0 of 
   		     [] -> ?DefaultSimiScore;
   		     _ -> list_to_float(SimiScore0)
  
positive.code: 			      _ ->[]
  			  end;
  	{error, _Reason} -> []
     end.
  
  
  no_of_nodes(Nodes) when is_list(Nodes) ->
      lists:sum(lists:map(fun(N) -> no_of_nodes(N) end, Nodes));
  no_of_nodes(Node) ->
      case refac_syntax:is_leaf(Node) of
  	true ->
  	     1;
  	_ ->
  	    SubTrees = refac_syntax:subtrees(Node),
  	    lists:sum(lists:map(fun(T) -> no_of_nodes(T) end, SubTrees))
      end.
  	     
  
negative.code: 		    As = refac_syntax:get_ann(Op),
  		    case lists:keysearch(fun_def, 1, As) of
  			{value, {fun_def, {M, _FunName, _Arity, _UsePos, _DefinePos}}} ->
  			    Op1 =refac_util:rewrite(
  				   Op, refac_syntax:module_qualifier(set_random_pos(refac_syntax:atom(M)), Op)),
  				refac_util:rewrite(Node, refac_syntax:application(Op1,Args));
  			_ -> Node
  		    end;
  		_ -> Node
  	    end;
  	_ -> Node
      end. 					    
  
  
  denormalise_expr(Exprs, _RecordInfo) ->
     do_denormalise_fun_calls(Exprs).
    
  do_denormalise_fun_calls(Exprs)  when is_list(Exprs)->
      [refac_util:full_buTP(fun do_denormalise_fun_calls_1/2, E, [])||E<-Exprs];
  
  do_denormalise_fun_calls(Expr) ->
      refac_util:full_buTP(fun do_denormalise_fun_calls_1/2, Expr, []).
  
  do_denormalise_fun_calls_1(Node, _Others) ->
      case refac_syntax:type(Node) of
  	application ->
  	    Op = refac_syntax:application_operator(Node),
  	    Args = refac_syntax:application_arguments(Node),
  	    case refac_syntax:type(Op) of 
  		module_qualifier ->
  		    M = refac_syntax:module_qualifier_argument(Op),
  		    F = refac_syntax:module_qualifier_body(Op),
  		    case refac_syntax:type(M)==atom andalso (refac_syntax:get_pos(M) < {0, 0}) of 
  			true ->
  			    refac_util:rewrite(Node, refac_syntax:application(F, Args));
  			_ -> Node
  		    end;
  		_ -> Node
  