Search code examples
shellemacsorg-mode

send command to emacs daemon from shell


Emacs command org-html-convert-region-to-html can convert org mode to html file and I have a project which is a Java program where I need handle the org mode file and convert it to html.
I want use system call to interactive with emacs daemon, which similar as execute shell command at terminal, and I could get the response from shell output stream to my program.
Can I start a emacs daemon and send the org-html-convert-region-to-html command to it which response a output html format stream in shell?

Thanks.


Solution

  • Emacs can be set-up to run a server. Then you could run emacsclient commands (perhaps with the -e option, to evaluate expressions)

    Emacs could also be started specially to run some Elisp commands (and could be started without opening any windows).

    (however, I don't think your design is a good one. You could consider parsing org files in Java instead, and that is probably more suitable in your case)