Suppressing indentation of the next paragraph

I'm trying to define an environment/command, with the following property: The immediate paragraph after the environment must not be indented. The following shows my attempt at defining such environment/command:

\makeatletter
\makeatother


Now compare the following two:

\begin{NoIndEnv}
Text ...
\end{NoIndEnv}

Some text ...


and

\NoIndCmd{Text ...}

Some text ...


For some reason, the environment definition works only if it is placed after a \section command; i.e.:

\section{}

\begin{NoIndEnv}
Text ...
\end{NoIndEnv}

Some text ...


-
Simply ending it with \par\noindent doesn't work? – Martin Scharrer Jul 17 '11 at 11:09
@Martin: Peculiarly, it does not work either! – M.S. Dousti Jul 17 '11 at 11:25

The problem is that \@afterindentfalse\@afterheading are done inside a group, in the environment case. Solution: do them after the group has ended.
\newenvironment{NoIndEnv}