anchor.diff:        ModDoc :: binary().
   exports_attributes(#module{name=Name,code=Beam,docs=Docs0}=Mod) ->
       ChunkRefs = [exports,attributes],
  -    {ok,{Name,[{exports,Expt},{attributes,Attr}]}} = chunks(Beam, ChunkRefs),
  +    {ok,{Name,[{exports,Expf},{attributes,Attr}]}} = chunks(Beam, ChunkRefs),
       Expm  = get_value('export-macro', Attr, []),
       MDoc  = iolist_to_binary(get_value(doc, Attr, "")),
  -    Docs1 = foldl(do_exports(Expt, Expm), [], Docs0),
  +    Docs1 = foldl(do_exports(Expf, Expm), [], Docs0),
       {MDoc,Mod#module{docs=Docs1}}.
   
  -%% do_exports(Expt, Expm) -> Fun.
  -%%  Close over Expt and Expm then return the folding function for exports/1.
  -
  --spec do_exports(Expt, Expm) -> Fun when
  -      Expt :: [{atom(),non_neg_integer()}],
  +%% do_exports(Expf, Expm) -> Fun.
  +%%  Close over Expf and Expm then return the folding function for
  +%%  exports/1.  We only included exported functions and macros.  The
  +%%  export-macro attribute is not necessarily sorted.
  +-spec do_exports(Expf, Expm) -> Fun when
  +      Expf :: [{atom(),non_neg_integer()}],
         Expm :: [atom()],
         Fun  :: fun((doc(), [doc()]) -> [doc()]).
  -do_exports(Expt, Expm) ->
  +
  +do_exports(Expf, Expm) ->
       fun (#doc{type=function,name=F,arity=A}=Doc, Docs) ->
  -            [Doc#doc{exported=is_element({F,A}, Expt)}|Docs];
  +            ?IF(member({F,A}, Expf),
  +                [Doc#doc{exported=true}|Docs],
  +                Docs);
           (#doc{type=macro,name=M}=Doc, Docs) ->
  -            [Doc#doc{exported=is_element(M, Expm)}|Docs]
  +            ?IF(member(M, Expm),
  +                [Doc#doc{exported=true}|Docs],
  +                Docs)
       end.
   
   %% add_beam_chunk(Bin, Id, ChunkData) -> Bin.
  
positive.code: -define(QC_OPTS, [{on_output,fun pprint/2},{numtests,1000},{max_size,10}]).
  -define(QC(T,P), {timeout,30,{T,?_assert(proper:quickcheck(P, ?QC_OPTS))}}).
  -endif.
  
  %% Skip if exclude/1 is true, otherwise check for bad patterns.
  -define(DO_MOD(Docs,Type,Name,Body,DocStr,Line,Defs),
          ?IF(exclude(Name), do_module(Docs, Defs),
              case patterns(Body) of
                  no ->
                      Error = {Line,?MODULE,{bad_lambda,Name,Body}},
                      do_module([Error|Docs], Defs);
                  {yes,Arity,Patterns} ->
                      ?IF(exclude({Name,Arity}), do_module(Docs, Defs),
                          begin
                              Doc = make_doc(Type, Name, Arity,
                                             Patterns, DocStr, Line),
                              do_module([Doc|Docs], Defs)
                          end)
              end)).
  
  %% Errors
  -spec format_error({bad_lambda,Name::atom(),Lambda::list()}) -> string().
  
negative.code: 
  -export([format_error/1]).
  
  -export([module/1,function_patterns/1,macro_patterns/1,add_docs_module/1]).
  
  -import(beam_lib, [all_chunks/1,build_module/1,chunks/2]).
  -import(lfe_lib, [is_proper_list/1,is_symb_list/1]).
  -import(lists, [member/2,filter/2,foldl/3,reverse/1]).
  -import(proplists, [delete/2,get_value/3]).
  
  -include("lfe_comp.hrl").
  