ragged2e: "newcommands" option produces "underfull \hbox" warnings

According to p. 4 of the ragged2e documentation (thanks to Herbert for encouraging me to RTFM), the ragged2e lengths which control \leftskip resp. \rightskip for \Centering & friends "must be set to a finite value, to make hyphenation possible". (By default, ragged2e uses a value of 0pt plus 2em instead of standard LaTeX's 0pt plus 1fil.) But finit glue in turn means that "underfull \hbox" warnings become possible. In practice, such warnings are likely to be issued for one-liner or two-liner paragraphs typeset with \Centering & friends in effect -- i.e., they will turn up in (but are not confined to) title pages and headers.

This is demonstrated in the following MWE, which typesets text within three center environments (which, because ragged2e's newcommands option is enabled, internally use \Centering). The first environment will produce an underfull \hbox with a badness of 10000, the second environment one with a badness of 4096. In the third environment, the sixth word is moved to the second line (instead of being hyphenated), and no warning is issued.

To remove all those "underfull \hbox" warnings, \hbadness may be set to a value of 10000 for \Centering & friends (again thanks to Herbert for the tip). Note that, if the newcommands option is enabled, one must add \hbadness=10000\relax (EDIT: or, even better, \hbadness=\@M) to the new definitions of, e.g., \centering as well as to the start of center environments.

\documentclass[12pt]{article}

\usepackage[newcommands]{ragged2e}

% Uncommenting the following lines will remove "underfull \hbox" warnings
\makeatletter
% \g@addto@macro{\centering}{\hbadness=\@M}
% \g@addto@macro{\raggedright}{\hbadness=\@M}
% \g@addto@macro{\raggedleft}{\hbadness=\@M}
% \g@addto@macro{\center}{\hbadness=\@M}
% \g@addto@macro{\flushleft}{\hbadness=\@M}
% \g@addto@macro{\flushright}{\hbadness=\@M}
\makeatother

\begin{document}

\begin{center}
hyphenation
\end{center}

\begin{center}
hyphenation hyphenation hyphenation hyphenation hyphenation
hyphenation hyphenation hyphenation hyphenation
\end{center}

\begin{center}
hyphenation hyphenation hyphenation hyphenation hyphenation
hyphenation hyphenation hyphenation hyphenation hyphenation
\end{center}

\end{document}

With ragged2e you have \CenteringRightskip=0pt plus 2em, but LaTeX uses a value of 0pt plus 1fil. You can set \CenteringRightskip to this value and there will be no warning.