I'd like to give an answer which is complementary to the one given by @Tyler.
I'd recommend that you set this in your init file:
(setq TeX-parse-self t)
restart your Emacs and open your .tex file again. The difference is that AUCTeX provides a support file minted.el
for minted
package which does a lot more besides fixing the fontification in environments and macros provided by minted
package. You can hit C-c C-e minted RET and will be asked for optional argument and the language for your code; both with auto-completion. Your .tex file could look like this:
\documentclass{article}
\usepackage[newfloat]{minted}
\begin{document}
\begin{minted}{bash}
$ echo "Hello"
$ echo World
\end{minted}
\begin{Minted}
$ echo "Hello"
$ echo World
\end{Minted}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-command-extra-options: "-shell-escape"
%%% End:
Note that Minted
is just an arbitrary environment to show the difference that code will be indented with 2 spaces where spaces are significant. Here a screenshot for the fontification:

The line
%%% TeX-command-extra-options: "-shell-escape"
allows you to use C-c C-a in Emacs and your file gets compiled correctly with minted
.