org-mode

How can a setupfile being considered as safe while exporting through a batch process?


In my org-mode-file I have a source cell which contains the various formats I want to export this file to.

#+title: How to export this document?
#+author: me
#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup

* Export feature
#+BEGIN_SRC sh :exports code :results none :var filename=(buffer-name)
emacs -Q "$filename" --batch -f org-html-export-to-html --kill
emacs -Q "$filename" --batch -f org-ascii-export-to-ascii --kill
emacs -Q "$filename" --batch -f org-latex-export-to-pdf --kill
#+END_SRC

When I execute the cell I get the error: The remote resource "https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup" is considered unsafe, and will not be downloaded. The export into html is now a plain export.

How can I have the file being exported to html using the setup file?


Solution

  • I solved it this way, by creating .export.el file with this content:

    (setq org-safe-remote-resources '("https://raw.githubusercontent.com/fniessen/org-html-themes/master/org/theme-readtheorg.setup"))
    (find-file "README.org")
    (org-html-export-to-html)
    

    And then running batch mode will succeed:

    emacs --batch --eval '(load-file ".export.el")'