speed up init

This commit is contained in:
Case Duckworth 2022-02-02 18:28:33 -06:00
parent 3c89c1ee06
commit 89a12141dc
1 changed files with 23 additions and 32 deletions

View File

@ -21,26 +21,25 @@
;;; Code:
;;(setq debug-on-error t)
(message "Loading early-init.el...")
(define-advice load (:before (feature &rest _))
"Message the user when loading a library."
(with-temp-message (format "Now loading: '%s'" feature)))
;;; Speed up init
;; Garbage collection
(setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook
(defun emacs-startup@restore-values ()
"Restore values set during early-init for speed."
(setq gc-cons-threshold 134217728 ; 128mb
;; I don't do the common `file-name-handler-alist' thing here
;; because of a weirdness where my Emacs doesn't know how to
;; load bookmark.el.gz when initializing.
)))
;; Don't prematurely re-display
(setq-default inhibit-redisplay t
inhibit-message t)
(add-hook 'window-setup-hook
(defun window-setup@restore-values ()
"Restore values set during early-init for visuals."
(setq-default inhibit-redisplay nil
inhibit-message nil)))
;;; Set up extra load paths and functionality
(push (locate-user-emacs-file "lisp") load-path)
@ -54,12 +53,6 @@ See `no-littering' for examples.")
(+define-dir sync/ (expand-file-name "~/Sync")
"My Syncthing directory.")
;; Load system-specific changes.
;; (progn (require 'system)
;; (setq system-default-font "DejaVu Sans Mono"
;; system-variable-pitch-font "DejaVu Sans")
;; (system-settings-load))
;;; Default frame settings
(setq default-frame-alist '((tool-bar-lines . 0)
@ -77,21 +70,19 @@ See `no-littering' for examples.")
;;; Fonts
(+with-ensure-after-init
;; Emoji fonts
(+with-message "Adding emoji fonts"
(let ((ffl (font-family-list)))
(dolist (font '("Noto Color Emoji"
"Noto Emoji"
"Segoe UI Emoji"
"Apple Color Emoji"
"FreeSans"
"FreeMono"
"FreeSerif"
"Unifont"
"Symbola"))
(when (member font ffl)
(message "Found font: %s" font)
(set-fontset-font t 'symbol
(font-spec :family font) nil :append))))))
(let ((ffl (font-family-list)))
(dolist (font '("Noto Color Emoji"
"Noto Emoji"
"Segoe UI Emoji"
"Apple Color Emoji"
"FreeSans"
"FreeMono"
"FreeSerif"
"Unifont"
"Symbola"))
(when (member font ffl)
(set-fontset-font t 'symbol
(font-spec :family font) nil :append)))))
;;; Packages