[Tex/LaTex] shell-escape is not enabled with emacs

emacsshell-escape

I use Emacs as an editor, and I would like to compile a file that contains PSTricks code with LuaLaTeX.

The version of Emacs is : GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.18).

My operating system is Debian Sid with TeX Live 2013.

I proceed as follows: C-c C-c TAB lualatex.
The error message is as follows:

 ! Package auto-pst-pdf Error: 
"shell escape" (or "write18") is not enabled:
auto-pst-pdf will not work!


See the auto-pst-pdf package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

 l.134         Or turn off auto-pst-pdf.}
                                  %
 ? 

The file is as follows:

 \RequirePackage{ifluatex}
 \documentclass{article}
 \ifluatex
 \usepackage{fontspec}
 \setmainfont{TeX Gyre Pagella}
 \else
 \usepackage{tgpagella}
 \usepackage{pstricks}
 \fi
 \usepackage{auto-pst-pdf}
 \begin{document}
 \paragraph{Hier ein pstricks-Bild}
 \begin{pspicture}(5,3)
 \pspolygon[fillstyle=vlines](0,0)(5,3)(3,0)
 \end{pspicture}
 \end{document} 
 %%% Local Variables: 
 %%% mode: latex
 %%% eval: (TeX-PDF-mode 0)
 %%% LaTeX-command: "latex -shell-escape"
 %%% End:

Best Answer

Works here, but I parse the document for Emacs with C-c C-n before compiling it (C-c C-c ...).

\RequirePackage{ifluatex}
 \documentclass{article}
 \ifluatex
 \usepackage{fontspec}
 \setmainfont{TeX Gyre Pagella}
 \else
 \usepackage{tgpagella}
 \usepackage{pstricks}
 \fi
 \usepackage{auto-pst-pdf}
 \begin{document}
 \paragraph{Hier ein pstricks-Bild}
 \begin{pspicture}(5,3)
 \pspolygon[fillstyle=vlines](0,0)(5,3)(3,0)
 \end{pspicture}
 \end{document}
 %%% Local Variables: 
 %%% mode: LaTeX
 %%% LaTeX-command: "lualatex -shell-escape"
 %%% End: