原是个 reddit 上的问题, 下面给出的事答案.
I added the following to my .emacs
;; Auto-export org files to html when saved (defun org-mode-export-hook () (when (equal major-mode 'org-mode) (add-hook 'after-save-hook 'org-html-export-to-html h h) ) )
However, when I open org file, make some changes, and save, the corresponding html file does not get updated. What's wrong here?
Edit. The problem was my org version. This works as intended:
;; Auto-export org files to html when saved (defun org-mode-export-hook() "Auto export html" (when (eq major-mode 'org-mode) (org-export-as-html t))) (add-hook 'after-save-hook 'org-mode-export-hook)
(defun toggle-org-html-export-on-save () (interactive) (if (memq 'org-html-export-to-html after-save-hook) (progn (remove-hook 'after-save-hook 'org-html-export-to-html t) (message "Disabled org html export on save for current buffer...")) (add-hook 'after-save-hook 'org-html-export-to-html nil t) (message "Enabled org html export on save for current buffer...")))
You can run this on your org buffers to toggle export-on-save for the buffer.
原文时间: 2016-04-27 22:02
整理时间: 2016-06-05 21:14
本文由 Hick 整理，转载请保留以上信息;
The articles on this site come from Internet, thanks to all the original authors.
If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .