# Suppress xparse message “Redefining document command”

I am trying to suppress messages of the form:

*************************************************
* LaTeX warning: "xparse/redefine-command"
*
* Redefining document command \MyMacro with arg. spec. 'm' on line 29.
*************************************************


I tried to use the silence package, but can't determine how to correctly use that package for such errors.

## Code:

\documentclass{article}
\usepackage{xparse}
\usepackage{silence}

%% All these attempts do not solve this problem.
\WarningsOff[latex]
\WarningsOff[xparse]

\WarningFilter{latex}{LaTeX warning}
\WarningFilter{xparse}{LaTeX warning}

\WarningFilter{latex}{Redefining document command}
\WarningFilter{xparse}{Redefining document command}

\NewDocumentCommand{\MyMacro}{m}{\textbf{#1}}

\begin{document}
\MyMacro{some text}

\RenewDocumentCommand{\MyMacro}{m}{\emph{#1}}%

\MyMacro{some more text}
\end{document}

-
silence will only silence output if it matches exactly and if it's produced by a specific command. –  Werner Dec 11 '12 at 0:08
Related Question: Can I temporarily supress xparse's log messages?. –  Peter Grill Jun 11 '13 at 15:26

You can't use silence for this, because xparse and all packages in the l3kernel suite (LaTeX3) use a very different method for issuing warnings, and definitely not the \PackageWarning macros on which silence relies.

The correct way for suppressing warnings is

\usepackage[log-declarations=false]{xparse}


The code connected with this option is

\DeclareOption { log-declarations = false }
{
\msg_redirect_module:nnn { LaTeX / xparse } { info }    { none }
\msg_redirect_module:nnn { LaTeX / xparse } { warning } { none }
}


that redirects only messages from the xparse module to "none".

-
Do you know which introduced this? It hasn't been there since forever AFAIK. –  Werner Dec 11 '12 at 0:10
@Werner What I know is that the option didn't really work until some reworking on the kernel (last summer, I believe). –  egreg Dec 11 '12 at 0:14
@Werner As egreg says, the option has been there for some time (since I rewrote xparse), but it was broken for some time! –  Joseph Wright Dec 11 '12 at 6:52