Commit 2ada1a52c227

Vincent Demeester <vincent@sbr.pm>
2017-06-24 13:33:12
Clean tangle-config functions
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent c09268c
Changed files (1)
.emacs.d
.emacs.d/emacs.org
@@ -3260,12 +3260,6 @@
   it on save instead of tangling it every time I open it again.
 
   #+BEGIN_SRC emacs-lisp
-    (defun tangle-if-config ()
-      "If the current buffer is a config '*.org' the code-blocks are
-        tangled, and the tangled file is compiled."
-      (when (member (file-name-nondirectory buffer-file-name) '("emacs.org" "provided/go-config.org"))
-        (tangle-config buffer-file-name)))
-
     (defun tangle-config-sync (file-name)
       (interactive)
 
@@ -3282,48 +3276,8 @@
        (with-current-buffer byte-compile-log-buffer
             (buffer-string)))))
 
-    (defun tangle-config-async (file-name)
-      (async-start
-       (lambda ()
-         ;; make async emacs aware of packages (for byte-compilation)
-         (package-initialize)
-         (setq package-enable-at-startup nil)
-         (require 'org)
-
-         ;; Avoid running hooks when tangling.
-         (let* ((prog-mode-hook nil)
-                (src  file-name)
-                (dest (format "%s.el" (file-name-sans-extension file-name))))
-        (message (format "%s -> %s" src dest))
-        (require 'ob-tangle)
-        (org-babel-tangle-file src dest)
-        (if (byte-compile-file dest)
-               (byte-compile-dest-file dest)
-             (with-current-buffer byte-compile-log-buffer
-               (buffer-string))))
-         )))
-
-    (defun tangle-config (file-name)
-      "Tangle init.org asynchronously."
-
-      (interactive)
-      (message (format "Tangling %s" file-name))
-      (tangle-config-async file-name))
-
     (defun tangle-emacs-config ()
       (interactive)
       (message (format "Tangling emacs config"))
       (tangle-config-sync (substitute-env-in-file-name "$HOME/src/configs/emacs-config/.emacs.d/emacs.org")))
   #+END_SRC
-
-  This is the magic line(s) to make the tangle on save automatic.
-
-  #+BEGIN_SRC emacs-lisp :tangle no
-# Local Variables:
-# eval: (when (fboundp #'tangle-if-config) (add-hook 'after-save-hook #'tangle-if-config))
-# End:
-  #+END_SRC
-
-  # Local Variables:
-  # eval: (when (fboundp #'tangle-if-config) (add-hook 'after-save-hook #'tangle-if-config))
-  # End: