Re: [O] Bug: org-preview-latex-fragment does not work with pygmentize (-shell-escape missing) [with patch] [7.8.11]

2012-09-29 Thread Bastien
Hi Arne,

"Arne Babenhauserheide (IMK)"  writes:

> When using the minted package, latex requires the -shell-escape argument
> to call pygmentize. Due to this, org-preview-latex-fragment fails for me
> (used via C-c C-x C-l).

I use minted too and C-c C-x C-l works here.

Can you let us know how to reproduce the error?

-- 
 Bastien



[O] Bug: org-preview-latex-fragment does not work with pygmentize (-shell-escape missing) [with patch] [7.8.11]

2012-09-12 Thread Arne Babenhauserheide (IMK)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
- 

Dear org hackers,

When using the minted package, latex requires the -shell-escape argument
to call pygmentize. Due to this, org-preview-latex-fragment fails for me
(used via C-c C-x C-l).

If I change the function org-create-formula-image to call latex with
- -shell-escape, it works for me.

In MikTex --enable-write18 should do the same.

Note, though, that -shell-escape is disabled for security
reasons, since it can call arbitrary code (
http://scrolls.mafgani.net/2011/03/latex-shell-escape/ )

The reason why texmf does not activate shell-escape for pygmentize by
default is

% pygmentize - but is the filter feature insecure?
? /etc/texmf/web2c/texmf.cnf
? info: http://pygments.org/docs/filters/

I think the best solution would be to check pygmentize, maybe define a
subset of the functionality (without the filters) and get it into
the shell_escape_commands (setting it myself did not work for me?).

But since that is not readily accessible, I adapted the preview function
instead:

diff -u /usr/share/emacs/site-lisp/org-mode/org.el /home/arne/org.el.new
- --- /usr/share/emacs/site-lisp/org-mode/org.el2012-05-25
23:12:51.0 +0200
+++ /home/arne/org.el.new   2012-09-12 09:37:00.788632982 +0200
@@ -17075,7 +17075,7 @@
   (condition-case nil
  (progn
(cd tmpdir)
- - (call-process "latex" nil nil nil texfile))
+   (call-process "latex" nil nil nil "-shell-escape" texfile))
(error nil))
   (cd dir))
 (if (not (file-exists-p dvifile))

Best wishes,
Arne

Emacs  : GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-07-10 on imkpcghg
Package: Org-mode version 7.8.11

current state:
==
(setq
 org-ditaa-jar-path "~/.emacs.d/private/org/ditaa0_9/ditaa0_9.jar"
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-export-latex-listings 'minted
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-agenda-custom-commands '(("o" "Agenda and TODOs"
   ((tags "KANBAN") (agenda nil) (todo ""
"~/plan.org")))
  )
 org-agenda-files '("~/plan.org")
 org-agenda-include-diary t
 org-babel-load-languages '((python . t) (sh . t) (emacs-lisp . t)
(ditaa . t) (dot . t)
(C . t) (R . t) (gnuplot . t) (org . t))
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-tangle-lang-exts '(("C++" . "cpp") ("python" . "py")
("emacs-lisp" . "el"))
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-agenda-skip-scheduled-if-done t
 org-latex-to-pdf-process '("pdflatex -interaction nonstopmode
- -shell-escape -output-directory %o %f" "bibtex $(basename %b)"
"pdflatex -interaction nonstopmode -shell-escape -output-directory %o
%f" "pdflatex -interaction nonstopmode -shell-escape -output-directory
%o %f")
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
  org-babel-hide-result-toggle-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-export-latex-packages-alist '(("" "color") ("" "minted"))
 org-default-notes-file "~/.emacs.d/private/org/emacs-remember-mode.org"
 org-directory "~/.emacs.d/private/org"
 outline-mode-hook '((lambda nil (require (quote outline-magic
 org-babel-pre-tangle-hook '(save-buffer)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-export-latex-classes '(("article" "\\documentclass[11pt]{scrartcl}"
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{scrreprt}"
 ("\\part{%s}" . "\\part*{%s}")
 ("\\chapter{%s}" . "\\chapter*{%s}")
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")