I want to use pgfopts (and therefore pgfkeys) when customizing a class with new options, keeping the old ones, and using some of them.
Here is a simplified example with a class "exa" which extends "article" with a new option, and also sets option "a5paper".
\begin{filecontents}{exa.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{exa}[2014/03/19 exa]
% As "article" with "a5paper" set, and an extra option "lastword".
\RequirePackage{pgfopts}
\pgfkeys{
/exa/.cd,
lastword/.code=\AtEndDocument{\par The last word is #1.}
}
\ProcessPgfOptions{/exa}
\PassOptionsToClass{a5paper}{article}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
\end{filecontents}
\documentclass[lastword=bar,twocolumn]{exa}
\usepackage{blindtext}
\begin{document}
\blindtext
\end{document}
The three options work as intended here; "a5paper" set by the class, "twocolumn" sent to "article", and the new option "lastword". But it gives a warning about unused global option ["lastword=bar]".
How can take away all options ProcessPgfOptions took care of, so that only the rest is sent on to "article"?