I like to use htmlize-file in emacs to turn clojure source files into html.
I want to use it from the linux command line instead, or programmatically from clojure itself.
I tried
$ emacs --eval "(htmlize-file \"/home/john/file.clj\" ) (kill-emacs)"
and
$ emacs -batch --eval "(htmlize-file \"/home/john/file.clj\" )"
Both work, with caveats.
The first opens an X-window, which seems a bit inelegant, but it does do exactly the same highlighting that I’d see in a buffer, which is what I want.
The second one works in batch mode, but the only syntax highlighting that it does is to italicize the strings. I hypothesise that it’s not loading clojure-mode or my favourite colour scheme.
Can anyone find a way of getting the second version to give the same results as the first?
They both seem to load my .emacs file before evaling the (htmli….) bit.
Also, is there any way to send the commands to an already running emacs? And thus save the startup time?
Does using the first one with -nw work? that should prevent an X window being opened, but there should still be enough of the ‘GUI’ part of emacs present to be able to initialise the faces system. It’s still not as elegant as -batch (it’ll fail if run from a non-terminal process, eg crontab) but it’ll be less irritating.