# shell-escape is not enabled with emacs

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:

-
Did you close the buffer and reopen it after adding the local variable? – egreg Oct 20 '13 at 12:46
@Fabrice you didn't answer egreg's question. Can you report the first line of the AUCTeX log buffer when you compile a document? You should read something like (note the -shell-escape) Running LaTeX' on foo' with pdflatex -shell-escape -interaction=nonstopmode "\input" foo.tex'' – giordano Oct 21 '13 at 15:34
I tried to add the comment "Yes I did", but I did not succeed. If I understand, adding %%% LaTeX-command" LuaLaTeX-shell-escape "at the end of the file, I need to compile as follows : C-c C-c Command : (default LaTeX) RET. But I did : C-c C-c TAB lualatex (command added in my .emacs).Running LaTeX' on fab' with lualatex -shell-escape -interaction=nonstopmode "\input" fab.tex'' This is LuaTeX, Version beta-0.76.0-2013061708 (rev 4627) \write18 enabled. – Fabrice Oct 21 '13 at 23:07

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:

-
File variables in that format must go to the end of a file, more precisely the start of the local variables list should be no more than 3000 characters from the end of the file, and must be on the last page if the file is divided into pages. – giordano Oct 20 '13 at 14:17
@giordano Thank you, I placed the variables at the end of the file, just to prevent anybody else to copy my mistakes. – Keks Dose Oct 20 '13 at 14:26
I compiled this file and I have the same problem. – Fabrice Oct 21 '13 at 9:24
@Fabrice The problem resists to obey to our well considered advice? Could you provide OS, Version of Emacs, TeX-Installation and whatever may usefull? Sounds like Windows... – Keks Dose Oct 21 '13 at 9:32