0

When using Orgmode, we can generate/export HTML file or TXT file from ORG file, using C-c C-e(or M-x org-export), as described in https://orgmode.org/manual/The-Export-Dispatcher.html.

I wonder if possible to generate them using shell commands? like emacs --eval org-export --target-file my-notes.org?

absuu
  • 149
  • 6

1 Answers1

2

try...

emacs my-notes.org --batch -l my_init_file.el -f org-latex-export-to-pdf

  • Got it! Thanks! – absuu Dec 12 '22 at 14:24
  • As a supplement, I prefer no `-l` option, that is `emacs my-notes.org --batch -f org-latex-export-to-pdf`, which is more adaptive. – absuu Dec 12 '22 at 14:39
  • 1
    The point however is that `--batch` deliberately skips loading your init file, so if you have any customizations that you need for the export, you will have to use a `-l some-init-file.el`. But `some-init-file.el` can be much simpler than the full `init.el` that you use for your interactive sessions, which generally has a lot of stuff in it that is *not* relevant just for exporting an Org mode file to PDF. – NickD Dec 12 '22 at 14:42
  • See e.g. https://emacs.stackexchange.com/a/40957/14825 – NickD Dec 12 '22 at 15:07