I have defined a macro that highlights the next word using
\def!##1 {\hkw{##1} }%
where in this scope, ! is an active character. So it works fine to write.
\emph{This is a !good example}
but not
\emph{This example is !good}
where it would complain about ! Argument of ! has an extra }..
Is there a nice way to let ! consider everything up to the next space, but at most everything in the current group, as its argument?

\emph(or change it, not recommended). – egreg Jul 17 '15 at 09:53emphis just an example; for what it’s worth it could be just a group on its own, e.g.{!good}. – Joachim Breitner Jul 17 '15 at 10:28