Emacs26.3 で機嫌よく使えていたし、27.1にupdateして何がメリットなのかもよくわからなかったので放置していたのですが、early-init.elが気になったので試してみところ、意外や意外、起動時間が少し早くなりましたので紹介しておきます。
early-init.elに関して詳しいことはわからず、他のtipsの見様見真似です。
early-init.el
;;; early-init.el --- Early Initialization. -*- lexical-binding: t; no-byte-compile: t -*-
;;; Commentary:
;;
;; Emacs 27+ introduces early-init.el, which is run before init.el,
;; before package and UI initialization happens.
;;
;;; Code:
;; Defer garbage collection further back in the startup process
(setq gc-cons-threshold most-positive-fixnum)
;; For slightly faster startup
(setq package-enable-at-startup nil)
;; Always load newest byte code
(setq load-prefer-newer t)
;; Inhibit resizing frame
(setq frame-inhibit-implied-resize t)
;; Faster to disable these here (before they've been initialized)
(push '(fullscreen . maximized) default-frame-alist)
(push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
;; Suppress flashing at startup
(setq inhibit-redisplay t)
(setq inhibit-message t)
(add-hook 'emacs-startup-hook
(lambda ()
(setq inhibit-redisplay nil)
(setq inhibit-message nil)
(redisplay)))
;; Startup setting
(setq inhibit-splash-screen t)
(setq inhibit-startup-message t)
(setq byte-compile-warnings '(cl-functions))
(custom-set-faces '(default ((t (:background "#282a36")))))
(provide 'early-init)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; early-init.el ends here
[2022.8.3 下記を修正]
- 初期画面が表示(私の場合 Dashboard)されるまではブラックアウト
- ブラックアウト時の背景色を設定
init.el
;;; init.el --- Emacs first Configuration. -*- lexical-binding: t; no-byte-compile: t -*-
;;; Commentary:
;;; Code:
;; (setq debug-on-error t)
;; Speed up startup
(unless (or (daemonp) noninteractive init-file-debug)
(let ((old-file-name-handler-alist file-name-handler-alist))
(setq file-name-handler-alist nil)
(add-hook 'emacs-startup-hook
(lambda ()
"Recover file name handlers."
(setq file-name-handler-alist
(delete-dups (append file-name-handler-alist
old-file-name-handler-alist)))))))
;; Defer garbage collection further back in the startup process
(setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook
(lambda ()
"Recover GC values after startup."
(setq gc-cons-threshold 800000)))
;; Package
(eval-and-compile
(custom-set-variables
'(warning-suppress-types '((bytecomp)))
'(package-archives '(("org" . "https://orgmode.org/elpa/")
("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/"))))
(package-initialize)
(unless (package-installed-p 'leaf)
(package-refresh-contents)
(package-install 'leaf))
(leaf leaf-keywords
:ensure t
:init
(leaf el-get :ensure t)
(leaf hydra :ensure t)
:config
(leaf-keywords-init)))
;; Load inits files
(leaf init-loader
:ensure t
:custom `((custom-file . "~/.emacs.d/tmp/custom.el")
(init-loader-show-log-after-init . 'error-only))
:config
(init-loader-load))
(provide 'init)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init.el ends here
なぜ、early-init.el と init.el とに分けないといけないのかがわかっていない。こんな面倒なことはしなくてもいいように改善してほしい。