summary refs log tree commit diff stats
path: root/init.el
blob: e8a67fd27cd3f12994dca8b1822f0ede032ee591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
;; init.el -*- lexical-binding: t -*-
;; This file is automatically tangled from config.org.
;; Hand edits will be overwritten!

(setq-default load-prefer-newer t)

(let* (;; Speed up init
       (gc-cons-threshold most-positive-fixnum)
       (file-name-handler-alist nil)
       ;; Config file names
       (config (expand-file-name "config"
				 user-emacs-directory))
       (config.el (concat config ".el"))
       (config.org (concat config ".org"))
       (straight-org-dir (expand-file-name "straight/build/org"
					   user-emacs-directory)))
       ;; Unless config.org is /newer/ than config.el, *or* the config
       ;; is able to be loaded without errors, load the config from
       ;; config.org.
       (unless (or (file-newer-than-file-p config.org config.el)
		   (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)))