I want to export my org files to HTML files to certain directory when save. I can use Emacs and Org-mode but I don't know Elisp.
Note: The below was written for Emacs 23. Check the answer by @AndreasSpindler for an up-to-date solution.
Emacs has a couple of hooks which are called in certain events. The hook you are looking for is probably the after-save-hook
. Just set it to the function you want to run every time you save the file. In your case this would be org-html-export-to-html
.
There are many ways to do this, but the following method is probably the fastest and doesn't involve any "real" elisp. Put the following lines somewhere in your org file:
# Local variables:
# after-save-hook: org-html-export-to-html
# end:
The next time you open that file, you'll get a warning and be asked if the local variable should be set (as that's potentially unsafe, but not a problem here). Press y and everything should just work.