保存时,我想将我的组织文件导出到HTML文件到特定的目录。我可以使用Emacs和Org模式,但我不知道Elisp。
发布于 2016-09-25 02:28:10
使用Org 8.3和Emacs 24.5.1,可接受的答案创建了一个伪缓冲区*Org HTML Export*
,您必须手动保存,而键C-c C-e h h
则更方便地直接保存文件。
要真正在后台自动导出,请尝试以下代码:
# Local variables:
# eval: (add-hook 'after-save-hook 'org-html-export-to-html t t)
# end:
您可以将此解决方案与.emacs
中的下列函数组合起来
(defun toggle-html-export-on-save ()
"Enable or disable export HTML when saving current buffer."
(interactive)
(when (not (eq major-mode 'org-mode))
(error "Not an org-mode file!"))
(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"))
(add-hook 'after-save-hook 'org-html-export-to-html nil t)
(set-buffer-modified-p t)
(message "Enabled org html export on save")))
发布于 2015-08-05 05:58:48
这个命令是
C-c C-e h h (org-html-export-to-html)
导出为HTML文件。对于一个Org文件myfile.org,myfile.html文件将是myfile.html。该文件将在没有警告的情况下被覆盖。C导出为HTML文件,并立即用浏览器打开它.
https://stackoverflow.com/questions/31834002
复制相似问题