# xkeyval's \presetkeys

Please is there a way to avoid xkeyval package bombing out in endless loop, as implied by the following simplified case?

\documentclass{article}
\usepackage{xkeyval}
\makeatletter
\define@key{fam}{key1}[key1-def]{\def\x##1{#1*##1}}
\define@cmdkey{fam}[store@]{key2}[key2-def]{\setkeys{fam}{key1=#1}}
%\define@key{fam}{key3}[key3-def]{\def\keyvalue{#1}}
\presetkeys{fam}{key2=val2}{}
\setkeys{fam}{key1}
\makeatother

\begin{document}
x
\end{document}


I get "If you really absolutely need more capacity, you can ask a wizard to enlarge me."

-

I and Hendri Adriaens (the author of xkeyval package) agree that the following patch does solve the problem. We also agreed to collaborate to integrate xkeyval, ltxkeys and skeyval packages into xkeyval2, if we are able to find spare time.

\def\XKV@badsetkeys{%
\@latex@error{You can't nest \noexpand\setkeys in preset keys.
\MessageBreak That could cause an endless loop}\@ehd
}
\let\XKV@savsetkeys\setkeys
\def\XKV@usepresetkeys#1#2{%
\XKV@presettrue
\XKV@for@eo\XKV@fams\XKV@tfam{%
\XKV@makehd\XKV@tfam