Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automate org-mode html export via elisp

I wanted to automate the html export of two org-mode files using a elisp defun defined in ~/.emacs. I wrote the following code:

(defun publish-custom-orgs ()
  "publish certain org files as html files"
  (interactive)
  (find-file "~/org/a.org")
  (org-export-as-html)
  (find-file "~/org/b.org")
  (org-export-as-html)
)

But this does not export the files; instead, it shows a strange output in the minibuffer:

enter image description here

What am I doing wrong?

like image 499
daniel kullmann Avatar asked Dec 01 '25 02:12

daniel kullmann


1 Answers

You can try org-export-as-html-batch

(defun publish-custom-orgs ()
  "publish certain org files as html files"
  (interactive)
  (find-file "~/org/a.org")
  (org-export-as-html-batch)
  (find-file "~/org/b.org")
  (org-export-as-html-batch)
)
like image 158
slitvinov Avatar answered Dec 03 '25 16:12

slitvinov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!