summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ob-spice.org10
1 files changed, 10 insertions, 0 deletions
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