Using pgfkeys, I would like to have a choice key which, rather than immediately executing some code when a value is selected, stores the selection somewhere and then later on demand I can execute the code associated with said option.
An example should clarify things. I would like to define some sort of handler that allows me to write something like:
\pgfkeys{
/action/.is choice,
/action/jump/.on exec = \dojump,
/action/walk/.on exec = \dowalk,
/action/run/.on exec = \dorun
}
So that when I select an option
\pgfkeys{/action=jump} # remembers that I selected "jump"
the corresponding code \dojump is not executed just yet, but instead the selection is saved and executed only later until I actually say something like:
\pgfkeys{/action/.exec} # actually does the `\dojump`
This should allow the user to choose one option at some point, and change her mind later, and then put the option back. But nothing should be executed until I explicitly ask the code for the selected option to be executed.
Is there a simple way to add handlers to pgfkeys and achieve this? Am I doing things the right way, or I am trying to reinvent the wheel?

\pgfkeys@split@pathis doing here, since you aren't using\pgfkeyscurrentnameand\pgfkeys@case@threecalls\pgfkeys@split@path. Anddo exec/.style={\pgfkeyscurrentpath/do exec}smacks of a cyclic call. – Ahmed Musa Nov 02 '12 at 18:28\pgfkeys@split@pathsplits the current key into path+name; by setting the path to the current key before calling this, effectively this moves the path “one level up”. And the “cyclic call” is no cyclic, precisely for the same reason, I do a .cd up to go one leve up before. – Juan A. Navarro Nov 02 '12 at 23:53