From 679b0c30dc13a813762bae505bef9ac6911e87c4 Mon Sep 17 00:00:00 2001 From: Ashley Duckworth Date: Fri, 22 Jan 2021 13:07:59 -0600 Subject: Finally sort out the config.org/el loading thing --- config.org | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'config.org') diff --git a/config.org b/config.org index d99c918..8945ab1 100644 --- a/config.org +++ b/config.org @@ -1559,18 +1559,29 @@ the needed boolean expression to tangle config.org. Booleans, yall! (config.org (concat config ".org")) (straight-org-dir (expand-file-name "straight/build/org" user-emacs-directory))) - (unless (load config 'no-error)) - ;; A plain require here just loads the older `org' - ;; in Emacs' install dir. We need to add the newer - ;; one to the `load-path', hopefully that's all. - (when (file-exists-p straight-org-dir) - (add-to-list 'load-path straight-org-dir)) - ;; Load config.org - (require 'org) - (org-babel-load-file config.org :compile)) -#+end_src - -*** early-init.el + ;; Okay, let's figure this out. + ;; `and' evaluates each form, and returns nil on the first that + ;; returns nil. `unless' only executes its body if the test + ;; returns nil. So. + ;; 1. Test if config.org is newer than config.el. If it is (t), we + ;; *want* to evaluate the body, so we need to negate that test. + ;; 2. Try to load the config. If it errors (nil), it'll bubble that + ;; to the `and' and the body will be evaluated. + (unless (and (not (file-newer-than-file-p config.org config.el)) + (load config :noerror)) + ;; A plain require here just loads the older `org' + ;; in Emacs' install dir. We need to add the newer + ;; one to the `load-path', hopefully that's all. + (when (file-exists-p straight-org-dir) + (add-to-list 'load-path straight-org-dir)) + ;; Load config.org + (require 'org) + (org-babel-load-file config.org))) + + ;;; init.el ends here +#+end_src + +** early-init.el :PROPERTIES: :header-args: :tangle early-init.el :noweb yes :END: -- cgit 1.4.1-21-gabe81