In the following minimal working example, the text of the listing is aligned with the surrounding text, thus the border on the left protrudes into the margin. I prefer to have the frame align with the surrounding text and do not mind the code to be indented as a result.
\documentclass{article}
\usepackage{listings}
\lstset{frame=l}
\begin{document}
\noindent
test
\begin{lstlisting}
code
\end{lstlisting}
More text
\end{document}
I would provide an attempt which you guys can fix, but I have no clue how to tackle this problem. Any help would be greatly appreciated.