Reducing Emacs Startup Flicker: Choosing Between early-init.el and init.el
Learn how to split Emacs configuration between early-init.el and init.el to remove startup flicker and speed up boot.
24 May 2026, 11:15 UTC

The Problem: Visual Flicker and Slow Boot
When Emacs starts, it creates the GUI frame before reading your init.el. If your configuration disables the toolbar, menu bar, or scroll bar, Emacs first draws them and then removes them a few milliseconds later, causing a visible flicker. Loading heavy packages during this initial phase also delays the moment the editor becomes interactive.
Decision Guide: Where to Place Configuration
The decision hinges on whether a setting affects the creation of the initial frame or the behavior of the editor after the frame exists.
Configuration Placement Table
| Feature | early-init.el | init.el |
|---|---|---|
| GUI elements (tool bar, menu bar, scroll bar) | Recommended (prevents flicker) | Supported (causes flicker) |
| Package load paths and package-user-dir | Recommended (sets base before package system) | Supported (after package-initialize) |
| Mode‑specific settings (hooks, mode variables) | Not supported (no buffers yet) | Recommended |
| Global keybindings | Limited (only before frame) | Recommended |
| Package installation and activation | Too early | Recommended |
Trade‑offs and Constraints
early-init.el runs before the GUI frame is fully initialized, so any function that expects an active window, a selected buffer, or a defined major mode will signal an error. Over‑using deferred loading (:defer t) in init.el can create “lazy‑loading gaps” where a keybinding is unavailable until you trigger the associated mode, which may feel like a missing shortcut.
Implementation Example
Both files belong in ~/.emacs.d/. Adjust paths as needed for your system.
early-init.el – environment and UI setup
;; ~/.emacs.d/early-init.el
;; Inhibit the startup splash screen
(setq inhibit-startup-screen t)
;; Disable unnecessary UI elements before the frame appears
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
init.el – package management and user customizations
;; ~/.emacs.d/init.el
(require 'package)
(package-initialize)
;; Example of deferred loading to keep startup fast
(use-package magit
:ensure t
:defer t)
Verification and Diagnostics
Restart Emacs. The splash screen, menu bar, tool bar, and scroll bar should be absent from the very first frame, with no visible jump or flicker.
To measure startup time, run inside Emacs:
M-x benchmark-init
If benchmark-init is not available, you can invoke Emacs from a shell to check for errors:
emacs --doctor
Risk note: Moving package-initialize into early-init.el may break packages that rely on user-emacs-directory being fully set, leading to load‑path errors.
Rollback Procedure
If Emacs fails to start or shows odd GUI behavior after adding early-init.el:
- Rename
~/.emacs.d/early-init.elto~/.emacs.d/early-init.el.bak - Restart Emacs. It will ignore the backup file and use only
init.el.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.