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: ;;; 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 ;;; Speed up init
;; Garbage collection
(setq gc-cons-threshold most-positive-fixnum) (setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook (add-hook 'emacs-startup-hook
(defun emacs-startup@restore-values () (defun emacs-startup@restore-values ()
"Restore values set during early-init for speed." "Restore values set during early-init for speed."
(setq gc-cons-threshold 134217728 ; 128mb (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 ;;; Set up extra load paths and functionality
(push (locate-user-emacs-file "lisp") load-path) (push (locate-user-emacs-file "lisp") load-path)
@ -54,12 +53,6 @@ See `no-littering' for examples.")
(+define-dir sync/ (expand-file-name "~/Sync") (+define-dir sync/ (expand-file-name "~/Sync")
"My Syncthing directory.") "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 ;;; Default frame settings
(setq default-frame-alist '((tool-bar-lines . 0) (setq default-frame-alist '((tool-bar-lines . 0)
@ -77,21 +70,19 @@ See `no-littering' for examples.")
;;; Fonts ;;; Fonts
(+with-ensure-after-init (+with-ensure-after-init
;; Emoji fonts ;; Emoji fonts
(+with-message "Adding emoji fonts" (let ((ffl (font-family-list)))
(let ((ffl (font-family-list))) (dolist (font '("Noto Color Emoji"
(dolist (font '("Noto Color Emoji" "Noto Emoji"
"Noto Emoji" "Segoe UI Emoji"
"Segoe UI Emoji" "Apple Color Emoji"
"Apple Color Emoji" "FreeSans"
"FreeSans" "FreeMono"
"FreeMono" "FreeSerif"
"FreeSerif" "Unifont"
"Unifont" "Symbola"))
"Symbola")) (when (member font ffl)
(when (member font ffl) (set-fontset-font t 'symbol
(message "Found font: %s" font) (font-spec :family font) nil :append)))))
(set-fontset-font t 'symbol
(font-spec :family font) nil :append))))))
;;; Packages ;;; Packages