From ffb4261ee2a22081a343e459d725b5741caf7527 Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 14 Apr 2018 10:38:27 +0200 Subject: Added auto tangle hook --- ob-spice.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ob-spice.org b/ob-spice.org index 69c3b0e..6aed6f7 100644 --- a/ob-spice.org +++ b/ob-spice.org @@ -31,6 +31,16 @@ (require 'ob) #+END_SRC +* Auto-tangle +#+BEGIN_SRC emacs-lisp :tangle no +(defun my/tangle-ob-spice () + "If the current file is '~/.emacs.d/lisp/ob-spice/ob-spice.org', the code blocks are tangled" + (when (equal buffer-file-name (concat (getenv "HOME") "/.emacs.d/lisp/ob-spice/ob-spice.org")) + (org-babel-tangle) + (message "%s tangled" buffer-file-name))) + +(add-hook 'after-save-hook #'my/tangle-ob-spice) +#+END_SRC * Functionality - Temporary files in working directory are accepted (as they are -- cgit v1.2.3