Skip to content

Commit

Permalink
docs: improve /handler config docs
Browse files Browse the repository at this point in the history
Add missing 'only existing' exceptions.
Expand the example explaining the interaction
between '.search also' and '/handler config'.

Signed-off-by: Fritz Webering <[email protected]>
  • Loading branch information
fritzw committed Mar 9, 2022
1 parent 21d7d93 commit bb1436b
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions doc/generic/pgf/pgfmanual-en-pgfkeys.tex
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,9 @@ \subsubsection{Keys That Are Handled}
\begin{key}{/handler config/only existing/add exception=\marg{key handler name}}
Allows to add exceptions to the |/handler config=only existing| feature.
Initially exceptions for the key handlers |/.cd|, |/.try|, |/.retry|,
|/.lastretry| and |/.unknown| are defined. The value \marg{key handler
name} should be the name of a key handler.
|/.lastretry|, |/.unknown|, |/.expand once|, |/.expand twice| and
|/.expanded| are defined. The value \marg{key handler name} should be
the name of a key handler.
\end{key}


Expand Down Expand Up @@ -1249,7 +1250,7 @@ \subsubsection{Defining Value-, Macro-, If- and Choice-Keys}
and, thus, |\pgfkeysnovalue| will be stored in |/my key|.

To retrieve the value stored in a key, the handler |/.get| is used.

\medskip
\emph{Remark:} A key can both store a value and execute commands%
\footnote{This behavior was partially changed in \pgfname{} 3.1.6 and then
Expand Down Expand Up @@ -1623,10 +1624,31 @@ \subsubsection{Handlers for Forwarding}
|/handler config=full or existing| when you use |/.search also|, that is,
use
%
\begin{codeexample}[code only]
\begin{codeexample}[]
\pgfkeys{
/main path/.search also={/second path, /third path},
/handlers/.unknown/.code={Unknown key `\pgfkeyscurrentkey'},
/handler config=full or existing,
% This works, because these are a full keys:
/second path/key/.code={Original value},
/third path/other key/.code={Other value},
}

\pgfkeys{
/main path/.search also={/secondary path},
/handler config=full or existing}
/main path/.cd,
% This works, because the keys are found in '.search also'.
key/.code={value1},
other key/.code={value2},
}
\texttt{key} = \pgfkeys{/second path/key},
\texttt{other key} = \pgfkeys{/third path/other key},

\pgfkeys{
/main path/.cd,
% The '.code' handler is not executed because 'undefined key'
% does not exist in either of the '.search also' paths.
undefined key/.code={New value},
}
\end{codeexample}
%
\end{handler}
Expand Down

0 comments on commit bb1436b

Please sign in to comment.