diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-08-23 14:21:28 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-08-23 14:21:28 +0100 |
commit | 11a3ef9cf9e92d87e821beaf9003065021f0f407 (patch) | |
tree | 1f66aa6eeb51297703f14e3f89706f2160a5739b /Emacs/.config/emacs/init.el | |
parent | 8f6792e912f6cb5c82eec343564bc3f451f3c4c8 (diff) | |
download | dotfiles-11a3ef9cf9e92d87e821beaf9003065021f0f407.tar.gz dotfiles-11a3ef9cf9e92d87e821beaf9003065021f0f407.tar.bz2 dotfiles-11a3ef9cf9e92d87e821beaf9003065021f0f407.zip |
~moved all ob-tangle code to a with-eval-after-load
Instead of using an autoload which may or may not work, rely on
with-eval-after-load to handle the loading period.
Diffstat (limited to 'Emacs/.config/emacs/init.el')
-rw-r--r-- | Emacs/.config/emacs/init.el | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/Emacs/.config/emacs/init.el b/Emacs/.config/emacs/init.el index 1080d01..f3d6aa4 100644 --- a/Emacs/.config/emacs/init.el +++ b/Emacs/.config/emacs/init.el @@ -26,11 +26,8 @@ (straight-use-package 'use-package) ;;; Load literate -;; setup autoload for org-tangle -(autoload 'org-babel-tangle-file "ob-tangle") ;; Setup directories and constants -(setq user-emacs-directory "~/.config/emacs/") (defconst +literate/org-files (list (concat user-emacs-directory "config.org"))) (defconst +literate/output-files (mapcar #'(lambda (x) (replace-regexp-in-string ".org" ".el" x)) +literate/org-files)) @@ -47,21 +44,25 @@ :initial-value t) (file-exists-p (car +literate/output-files)))) -(defun +literate/compile-config () - "Compile all files in +literate/org-files via org-babel-tangle." - (mapc #'org-babel-tangle-file +literate/org-files)) - ;; Killing Emacs hook -(add-hook - 'kill-emacs-hook - #'(lambda () - (unless (y-or-n-p "Really exit emacs?: ") - (keyboard-quit)) - (+literate/compile-config))) +(unless (daemonp) + (add-hook + 'kill-emacs-hook + #'(lambda () + (unless (y-or-n-p "Really exit emacs? ") + (keyboard-quit))))) + +(with-eval-after-load "ob-tangle" + (defun +literate/compile-config () + "Compile all files in +literate/org-files via org-babel-tangle." + (mapc #'org-babel-tangle-file +literate/org-files)) + + (add-hook + 'kill-emacs-hook + #'+literate/compile-config) -;; When no output files exist, compile -(unless (+literate/org-files-exist) - (+literate/compile-config)) + (unless (+literate/org-files-exist) + (+literate/compile-config))) (+literate/load-config) |