OK. I'll add them.
Code:
close_all_folders(#st{pst=Pst0}=St,OpenOrClosed0) ->
{Key0,Fld} = gb_trees:get(?FOLDERS,Pst0),
MyAcc = fun
(no_folder, MORE, Acc) ->
orddict:store(no_folder,MORE, Acc);
(Key, {OpenOrClosed1,MORE}, Acc) when OpenOrClosed1 == open orelse OpenOrClosed1 == closed ->
orddict:store(Key,{OpenOrClosed0,MORE},Acc)
end,
Fld2 = orddict:fold(MyAcc,Fld,Fld),
Pst1 = gb_trees:enter(?FOLDERS, {Key0,Fld2}, Pst0),
St#st{pst=Pst1}.