summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfpi2018-04-14 10:38:27 +0200
committerfpi2018-04-14 10:38:27 +0200
commitffb4261ee2a22081a343e459d725b5741caf7527 (patch)
tree3dbcf05f5150032b3549f67da6365d75ee4332ca
parentChanged indentation level of src blocks (diff)
Added auto tangle hook
-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