I'm trying to make an indented theorem environment as in A theoremstyle with complete indentation using amsthm.
Here's a minimal (non-)working example:
\documentclass{article}
\usepackage{amsthm}
\usepackage[english]{babel}
\usepackage{blindtext}
\makeatletter
\newtheoremstyle{indent}
{3pt}% space before
{3pt}% space after
{
\setlength{\leftskip}{2.5em}
\setlength{\rightskip}{2.5em}
\addtolength{\@totalleftmargin}{2.5em}
}% body font
{}% indent
{\bfseries}% header font
{.}% punctuation
{.5em}% after theorem header
{}% header specification (empty for default)
\makeatother
\theoremstyle{indent}\newtheorem{theorem}{Theorem}
\begin{document}
\blindtext
\begin{theorem}[correct spacing]
\blindtext
\begin{itemize}
\item This is ok.
\item \blindtext
\end{itemize}
\end{theorem}
\end{document}
Whether or not I add that extra rightskip, my problem is that as soon as an item in a list within my theorem gets longer than one line (as in the third blindtext) it extends over the original right margin of the page, a case not considered in the original post.
Any suggestions?

etoolbox, since the one included in texlive-full doesn't support\AtBeginEnvironmentyet it seems (1.8 -> 2.1). – May 27 '13 at 15:22\AtEndEnvironment{theorem}{}instruction? And it also affects the "space before" I believe... – pluton Aug 16 '19 at 21:10