Update early-init
This commit is contained in:
parent
f4e794e9b0
commit
9cf098bfb7
|
@ -23,22 +23,35 @@
|
||||||
|
|
||||||
;;; Speed up init
|
;;; Speed up init
|
||||||
|
|
||||||
;; Garbage collection
|
;; Restore things after init
|
||||||
(setq gc-cons-threshold most-positive-fixnum)
|
(defvar +emacs--startup-restore-alist nil
|
||||||
|
"Variables and values to restore after init.")
|
||||||
|
|
||||||
(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 init.
|
||||||
(setq gc-cons-threshold 134217728 ; 128mb
|
This applies values in `+emacs--startup-restore-alist'."
|
||||||
)))
|
(dolist (a +emacs--startup-restore-alist)
|
||||||
|
(set (car a) (cdr a)))))
|
||||||
|
|
||||||
|
(defun +set-during-startup (variable value &optional restore)
|
||||||
|
"Set VARIABLE to VALUE during startup, but restore to RESTORE.
|
||||||
|
If RESTORE is nil or not passed, save the original value and
|
||||||
|
restore that."
|
||||||
|
(unless nil ;after-init-time
|
||||||
|
(setf (alist-get variable +emacs--startup-restore-alist)
|
||||||
|
(or restore (symbol-value variable)))
|
||||||
|
(set-default variable value)))
|
||||||
|
|
||||||
|
;; Garbage collection
|
||||||
|
(+set-during-startup 'gc-cons-threshold most-positive-fixnum (* 128 1024 1024))
|
||||||
|
|
||||||
;; Don't prematurely re-display
|
;; Don't prematurely re-display
|
||||||
(setq-default inhibit-redisplay t
|
(+set-during-startup 'inhibit-redisplay t)
|
||||||
inhibit-message t)
|
(+set-during-startup 'inhibit-message t)
|
||||||
(add-hook 'window-setup-hook
|
|
||||||
(defun window-setup@restore-values ()
|
;; Debug during init
|
||||||
"Restore values set during early-init for visuals."
|
(+set-during-startup 'debug-on-error t)
|
||||||
(setq-default inhibit-redisplay nil
|
|
||||||
inhibit-message nil)))
|
|
||||||
|
|
||||||
;;; Set up extra load paths and functionality
|
;;; Set up extra load paths and functionality
|
||||||
|
|
||||||
|
@ -67,22 +80,17 @@ See `no-littering' for examples.")
|
||||||
indicate-buffer-boundaries '((top . right)
|
indicate-buffer-boundaries '((top . right)
|
||||||
(bottom . right)))
|
(bottom . right)))
|
||||||
|
|
||||||
;;; Fonts
|
;;; No littering!
|
||||||
(+with-ensure-after-init
|
;; We install `no-littering' package below, but we can set the variables now.
|
||||||
;; Emoji fonts
|
|
||||||
(let ((ffl (font-family-list)))
|
(setq no-littering-etc-directory .etc
|
||||||
(dolist (font '("Noto Color Emoji"
|
no-littering-var-directory .etc
|
||||||
"Noto Emoji"
|
straight-base-dir .etc)
|
||||||
"Segoe UI Emoji"
|
|
||||||
"Apple Color Emoji"
|
;; https://github.com/emacscollective/no-littering/wiki/Setting-gccemacs'-eln-cache
|
||||||
"FreeSans"
|
|
||||||
"FreeMono"
|
(when (boundp 'comp-eln-load-path)
|
||||||
"FreeSerif"
|
(setcar comp-eln-load-path (expand-file-name (.etc "eln-cache" t))))
|
||||||
"Unifont"
|
|
||||||
"Symbola"))
|
|
||||||
(when (member font ffl)
|
|
||||||
(set-fontset-font t 'symbol
|
|
||||||
(font-spec :family font) nil :append)))))
|
|
||||||
|
|
||||||
;;; Packages
|
;;; Packages
|
||||||
|
|
||||||
|
@ -93,10 +101,6 @@ See `no-littering' for examples.")
|
||||||
straight-check-for-modifications '(check-on-save
|
straight-check-for-modifications '(check-on-save
|
||||||
find-when-checking))
|
find-when-checking))
|
||||||
|
|
||||||
(setq no-littering-etc-directory .etc
|
|
||||||
no-littering-var-directory .etc
|
|
||||||
straight-base-dir .etc)
|
|
||||||
|
|
||||||
;; Bootstrap straight.el
|
;; Bootstrap straight.el
|
||||||
;; https://github.com/raxod502/straight.el
|
;; https://github.com/raxod502/straight.el
|
||||||
|
|
||||||
|
@ -147,7 +151,5 @@ See `no-littering' for examples.")
|
||||||
;; is `straight-package-neutering-mode'.
|
;; is `straight-package-neutering-mode'.
|
||||||
(defalias 'straight-ಠ_ಠ-mode nil)
|
(defalias 'straight-ಠ_ಠ-mode nil)
|
||||||
|
|
||||||
(message "Loading early-init.el...Done.")
|
|
||||||
|
|
||||||
(provide 'early-init)
|
(provide 'early-init)
|
||||||
;;; early-init.el ends here
|
;;; early-init.el ends here
|
||||||
|
|
Loading…
Reference in New Issue