diff options
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/init.org | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 18a6f97..1f0dd1e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1,7 +1,7 @@ #+TITLE: Emacs Configuration for Alan Pearce #+PROPERTY: results silent #+PROPERTY: eval no-export -#+PROPERTY: header-args :tangle yes :comments link +#+PROPERTY: header-args :comments link * Introduction This is a living document, detailing my Emacs configuration using org-mode * Basics @@ -2464,7 +2464,8 @@ the buffer for me. * Tangling Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with -my current dotfiles repository structure. +my current dotfiles repository structure and work asynchronously, +thanks to [[https://github.com/jwiegley/emacs-async][jwiegley/emacs-async]]. We can use =C-c C-v t= to run =org-babel-tangle=, which extracts the code blocks from the current file into a source-specific file (in this @@ -2475,15 +2476,25 @@ to the =after-save-hook= ensuring to always tangle and byte-compile the =org=-document after changes. #+BEGIN_SRC emacs-lisp + (req-package async) + (defun tangle-init () "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled." (when (string-suffix-p "init.org" (buffer-file-name)) - ;; Avoid running hooks when tangling. - (let ((prog-mode-hook nil)) - (org-babel-tangle) - (byte-compile-file (concat user-emacs-directory "init.el"))))) + (async-start + `(lambda () + ;; Avoid running hooks when tangling. + (let ((prog-mode-hook nil) + (dest (concat user-emacs-directory "init.el"))) + (find-file ,(buffer-file-name)) + (require 'ob-tangle) + (org-babel-tangle nil dest) + (byte-compile-file dest) + dest)) + (lambda (result) + (message "Init tangling completed: %s" result))))) #+END_SRC # Local Variables: |