summary refs log tree commit diff stats
path: root/early-init.el
blob: b0314aee86a17f5f8b5a46a563de9d96d0da141c (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
;;; early-init.el ~ acdw -*- lexical-binding: t; no-byte-compile: t -*-

;;; Commentary:
;; `early-init.el' is new as of Emacs 27.1.  It contains ... /early initiation/.
;; What does that mean?  Who knows.  What I /do know/ is that it runs /before/
;; `package.el' is loaded, so I can stop it from loading, since I use `straight.el'.
;; Other than that, there's some other init stuff that needs to happen as early
;; as possible -- think bootstrap-level.

;;; Settings

;; (setq debug-on-error t)

(setq load-prefer-newer t)

;;; Speed up startup
(setq gc-cons-threshold most-positive-fixnum)
(defconst *acdw/gc-cons* 800000 "'Regular' garbage collection amount")

(defvar file-name-handler-alist-old file-name-handler-alist)
(setq file-name-handler-alist nil)

(setq message-log-max 16384)
(setq byte-compile-warnings
      '(not free-vars unresolved noruntime lexical make-local))

;;; Restore stuff after startup
(add-hook 'after-init-hook
          (lambda ()
            (setq file-name-handler-alist file-name-handler-alist-old)
            (setq gc-cons-threshold *acdw/gc-cons*)
            (garbage-collect))
          t)

;;; Define the platforms I work on
(defconst *acdw/at-work* (eq system-type 'windows-nt))
(defconst *acdw/at-larry* (string= (system-name) "larry"))
(defconst *acdw/at-bax* (string= (system-name) "bax"))
(defconst *acdw/at-home* (or *acdw/at-larry* *acdw/at-bax*))

;;;; When at work, I have to use Portable Git.
(when *acdw/at-work*
  (add-to-list 'exec-path "~/bin")
  (add-to-list 'exec-path "C:/Users/aduckworth/Downloads/PortableGit/bin"))

;;; `straight.el' ~ github.com/raxod502/straight.el

;;;; Bootstrap
;; NOTE: this doesn't work on Windows (download straight directly)
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el"
                         user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

;;; Bootstrap `use-package'
(setq-default use-package-verbose nil
              use-package-expand-minimally t
              use-package-enable-imenu-support t
	      use-package-hook-name-suffix nil)

(straight-use-package 'use-package)

(setq straight-use-package-by-default t)