I'm using a Makefile to generate HTML for my org folder to turn into a website, but I'm just starting to use org-journal which doesn't put filename extensions on it's files. When trying to run a command on the file...

emacs -Q --batch journal/2021-05-27 -f org-html-export-to-html

Gives the output

Debugger entered--Lisp error: (void-function org-html-export-to-html)
  command-line-1(("journal/2021-05-27" "-f" "org-html-export-to-html"))

I presume this is because it doesn't recognise the file as an org file, but I'm uncertain at what to do. I've thought of temporarily renaming all the files to org, but I was hoping to have a more... elegant solution just by a different emacs command.

I tried the following command but I also get a void-function error.

emacs -Q --batch journal/2021-05-27 -e "(progn (org-mode) (org-html-export-to-html))"

So... the question is: How can I use emacs to convert an org-journal file to html?

  • --batch implies -q so if you are loading the exporter from your init file, you will need to load it explicitly: emacs --batch -l /path/to/init.el .... Usually however, init.el files are bloated beasts for interactrive usage, so most people use a minimal init file for such purposes. – NickD May 24 at 19:29
  • What NickD said. Perhaps: emacs --batch -f package-initialize -l org -l ox-html ... The package-initialize helps when you do not use the built-in Org version but one installed from orgmode.org. – Tobias May 25 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.