From bb1b8846d29cd2203fc04526f7fe2adace039ff6 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Wed, 21 Sep 2022 18:38:44 +0200 Subject: Add code for export and tangle on save --- 2022/organizers-notebook.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/2022/organizers-notebook.org b/2022/organizers-notebook.org index 6ba3f420..17e4c143 100644 --- a/2022/organizers-notebook.org +++ b/2022/organizers-notebook.org @@ -13,6 +13,22 @@ - [[elisp:(progn (org-md-export-to-markdown) (org-babel-tangle))][Export and tangle]] - [[elisp:(emacsconf-org-publish-this-page)][Export, tangle, commit, push]] - [[elisp:(org-babel-execute-buffer)][Execute buffer]] + +** Export and tangle on save +#+begin_src emacs-lisp :eval query +(defun emacsconf-export-markdown-on-save () + "Export markdown on save. +Meant to be used with `after-save-hook'." + (org-md-export-to-markdown) + (org-babel-tangle)) + +(add-hook 'after-save-hook #'emacsconf-export-markdown-on-save nil t) +#+end_src + +Remove the hook: +#+begin_src emacs-lisp :eval query +(remove-hook 'after-save-hook #'emacsconf-export-markdown-on-save t) +#+end_src * Current tasks / status Planned dates and phases: -- cgit v1.2.3