Hello all,

A reasonably common use case for keyval method is is the situation where
one or more keys are set to a value implicitly. This is often managed in
LaTeX using grouping.

  % Set up keys
  \keys_define:nn { mymod }
    {
      key-a .tl_set:N = \l_mya_tl ,
     ...
    }
  \keys_set:nn { mymod }
    {
      key-a = value % Applies unless set otherwise
    }
  ...
  \group_begin:
    \keys_set:nn { mymod }
      {
        key-a = new-value
      }
  \group-end:
  % key-a will be "value" again
  \group_begin:
    \keys_set:nn { mymod }
      {
        % No key-a set => "value"
      }

However, there are cases where you'd like to 'preset' the key every
time. Currently, that would require

    \cs_new_protected:Npn \foo #1#2 % #1 = keys
      {
        \keys_set:nn { mymod }
          {
            key-a = new-value ,
            #1
          }

but that is not that efficient and also not that clear.

An alternative approach is to provide a method to 'preset' keys from
within the key system, something like

  \keys_define:nn { mymod }
    {
      key-a .tl_set:N = \l_mya_tl ,
      key-a .preset:n = value
     ...
    }

where the presetting can avoid having to parse the keys each time it's
run (cf. what happens in xtemplate).

The team have some use cases where this makes sense, so I will be
looking to add it as an experimental idea. Before I do, thought, I'd
like to know if the name, etc., makes sense. It's distinct from
".default:n" (used if a key name is given with no property) and
".initial:n" (a 'set up' shortcut).

I note that xkeyval offers the idea of preset keys, but in a slightly
more complex fashion as it allows 'tail' keys and does some tests for
the presence of keys before doing presetting. I don't see a similar
concept in the pgfkeys manual: I have a feeling there just the 'manual'
approach is used.

Thoughts?
--
Joseph Wright