# Importing notebooks with definitions that cause messages during formatting

According to reference pages, Quiet "does not quiet messages that occur during formatting", which typically is just a nuisance, but it seems to affect NotebookImport.

Consider this definition that uses NumberForm, which is mentioned in the ref page of Quiet as exactly raising such format message:

exportForm[{l_,r_}][n_]:= StandardForm[NumberForm[n,{l,r},ExponentFunction->(Null&)]];


If the above is saved in a notebook and then the input is imported:

 NotebookImport["~/Desktop/example-notebook.nb", "Input"]


the definition changes - note the right hand side displays as n

{HoldComplete[exportForm[{l_,r_}][n_]:=n;]}


While the full form shows the definition

 NotebookImport["~/Desktop/example-notebook.nb", "Input"] // FullForm


List[HoldComplete[CompoundExpression[SetDelayed[exportForm[List[Pattern[l,Blank[]],Pattern[r,Blank[]]]][Pattern[n,Blank[]]],StandardForm[NumberForm[n,List[l,r],Rule[ExponentFunction,Function[Null]]]]],Null]]]

However, this seems to interfere with subsequent processing.

NumberForm::iprf: Formatting specification {l,r} should be a positive integer or a pair of positive integers.

This message is not raised when the function is actually defined, so the behavior seems like a bug. Is there a workaround or a way to apply Quiet to such "loud" definitions?