(This is how the sectioning commands of the standard LaTeX classes do it.)
Put the following in the “begin” commands of the environment:
\everypar{{\setbox0=\lastbox}\everypar{}}
At the start of the first paragraph, the \parindent
glue will be removed and be put into box 0. (The braces around the \setbox
command are to keep the scope of this box assignment local.) Finally we clear \everypar
such that subsequent paragraphs behave normally.
Remark: One might be tempted to set \everypar{\hskip -\parindent}
, but if the user has issued a \noindent
command at the start of the environment body then this has an undesirable effect.