From 4abd64101eff010e799a243e20e30d130b5c63c3 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Wed, 21 Sep 2022 19:50:40 +0200 Subject: Add extra actions for exporting markdown on save --- 2022/organizers-notebook.org | 45 +++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/2022/organizers-notebook.org b/2022/organizers-notebook.org index 52be7dfd..8c0d830b 100644 --- a/2022/organizers-notebook.org +++ b/2022/organizers-notebook.org @@ -8,33 +8,44 @@ #+TOC: headlines 4 -* COMMENT How to export this file :noexport: +* How to export this file :noexport: You can open these links (~C-c C-o~) to run their associated actions: - [[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]] +- [[elisp:(org-babel-ref-resolve "md-export-on-save-toggle-on()")][Export on save]] +- [[elisp:(org-babel-ref-resolve "md-export-on-save-toggle-off()")][Stop exporting on save]] -** Export and tangle on save -Press ~C-c C-c~ to run the blocks. You may be asked for confirmation (press ~y~). - -Add the hook: +** Code +#+name: md-export-on-save-setup #+begin_src emacs-lisp :eval query -(defun emacsconf-export-markdown-on-save () +(defun emacsconf-export-md-on-save () "Export markdown on save. Meant to be used with `after-save-hook'." (org-md-export-to-markdown) (org-babel-tangle)) -(when (memq #'emacsconf-export-markdown-on-save after-save-hook) - (message "Hook is active")) +(defvar emacsconf-export-md-on-save-configured t + "Non-nil when the setup code-block has been executed.") #+end_src -Remove the hook: -#+begin_src emacs-lisp :eval query -(remove-hook 'after-save-hook #'emacsconf-export-markdown-on-save t) +#+name: md-export-on-save-toggle-on +#+BEGIN_SRC emacs-lisp :eval query +(unless (bound-and-true-p emacsconf-export-md-on-save-configured) + (org-babel-ref-resolve "md-export-on-save-setup()")) + +(add-hook 'after-save-hook #'emacsconf-export-md-on-save nil t) -(unless (memq #'emacsconf-export-markdown-on-save after-save-hook) +(when (memq #'emacsconf-export-md-on-save after-save-hook) + (message "Hook is active")) +#+END_SRC + +#+name: md-export-on-save-toggle-off +#+begin_src emacs-lisp :eval query :outputs none +(remove-hook 'after-save-hook #'emacsconf-export-md-on-save t) + +(unless (memq #'emacsconf-export-md-on-save after-save-hook) (message "Hook is no longer active")) #+end_src @@ -83,7 +94,7 @@ DEADLINE: <2022-11-20 Sun> ** TODO corwn, zaeph: Work on the OBS scenes :zaeph:corwin: DEADLINE: <2022-11-11 Fri> - [ ] corwin is out from Nov 11-20, and we should start working on them before then. -** TODO ???: Figure out web-based file upload :needsowner: +** TODO ???: Figure out web-based file upload :needsowner: Lesson learned from last year: "Since people kept running into ftp problems, we might want to set up a web-frontend next year to minimise problems." Maybe we could ask some of the volunteers who wanted to help us with the infra? It shouldn’t be complicated to deploy a ready-made solution. ** TODO sacha: Prepare to export talk information to wiki :sacha: @@ -251,7 +262,7 @@ Each role comprises different responsibilities. A person may have multiple role - #emacsconf-org and #emacsconf channels - (?) Join organizer room S -**** Start streaming :stream: +**** Start streaming :stream: :PROPERTIES: :CUSTOM_ID: start-streaming :END: @@ -512,7 +523,7 @@ Exceptions: - Update Toobnix and Youtube captions with =conf-video-share=. - Update Toobnix and Youtube descriptions with chapters. - Update ${conf-year}/${captions}/${slug}.md in the wiki. To make this from scratch, use =M-x conf-prepare-transcript-directives= from the talk heading in the conference Org file. -*** BLOCKED Downsize the server :bandali: +*** BLOCKED Downsize the server :bandali: ** In case of :PROPERTIES: :CUSTOM_ID: exceptions @@ -1341,3 +1352,7 @@ chatter in the other lists Cc'd on this message. Thank you. A copy of these two licenses is available on the EmacsConf wiki, in the [[https://emacsconf.org/COPYING.CC-BY-SA][COPYING.CC-BY-SA]] and [[https://emacsconf.org/COPYING.GPL][COPYING.GPL]] files. + +* COMMENT Local variables +# local variables: +# -- cgit v1.2.3