~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.
This commit is contained in:
2020-08-23 14:21:28 +01:00
parent 8f6792e912
commit 11a3ef9cf9

View File

@@ -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))))
;; Killing Emacs hook
(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))
;; Killing Emacs hook
(add-hook
'kill-emacs-hook
#'(lambda ()
(unless (y-or-n-p "Really exit emacs?: ")
(keyboard-quit))
(+literate/compile-config)))
#'+literate/compile-config)
;; When no output files exist, compile
(unless (+literate/org-files-exist)
(+literate/compile-config))
(+literate/compile-config)))
(+literate/load-config)