The minimal-emacs.d project is a lightweight and optimized Emacs base (init.el
and early-init.el
) that gives you full control over your configuration. It provides better defaults, an optimized startup, and a clean foundation for building your own vanilla Emacs setup.
Building the minimal-emacs.d init.el
and early-init.el
was the result of extensive research and testing to fine-tune the best parameters and optimizations for an Emacs configuration.
If you’re looking for the ideal starter kit to customize Emacs, you’ve found it. The minimal-emacs.d project is:
- Minimal yet effective: A solid starting point.
- Better defaults: Improved settings for usability, UI, garbage collection, and built-in packages.
- 0 packages loaded / No forced modes: Unlike other frameworks or starter kits, minimal-emacs.d does not impose modes or require packages. You have full control over which global or minor modes to enable and which packages to load with
require
. - Customizable foundation: Designed to be extended, not replaced. This README.md offers extensive recommendations for customizing your minimal-emacs.d configuration.
The author uses minimal-emacs.d as his early-init.el
and init.el
, alongside 146 packages (See the packages that the author is using here). Yet, thanks to its efficient design, Emacs still starts in just 0.22 seconds.
Installation
Execute the following command to clone this repository into ~/.emacs.d
:
git clone https://github.com/jamescherti/minimal-emacs.d ~/.emacs.d
Code language: plaintext (plaintext)
Update
To keep your Emacs configuration up to date, you can pull the latest changes from the repository. Run the following command in your terminal:
git -C ~/.emacs.d pull
Customizations
The init.el
and early-init.el
files should never be modified directly because they are intended to be managed by Git during an update.
The minimal-emacs.d init files support additional customization files that are loaded at different stages of the Emacs startup process. These files allow you to further customize the initialization sequence:
~/.emacs.d/pre-init.el
: This file is loaded beforeinit.el
. Use it to set up variables or configurations that need to be available early in the initialization process but afterearly-init.el
.~/.emacs.d/post-init.el
: This file is loaded afterinit.el
. It is useful for additional configurations or package setups that depend on the configurations ininit.el
.~/.emacs.d/pre-early-init.el
: This file is loaded beforeearly-init.el
. Use it for configurations that need to be set even earlier in the startup sequence, typically affecting the initial setup of the Emacs environment.~/.emacs.d/post-early-init.el
: This file is loaded afterearly-init.el
but beforeinit.el
. It is useful for setting up configurations that depend on the early initialization but need to be set before the main initialization begins.
Always begin your pre-init.el
, post-init.el
, post-early-init.el
, and pre-early-init.el
files with the following header to prevent them from being byte-compiled and to activate lexical binding:
;;; FILENAME.el --- DESCRIPTION -*- no-byte-compile: t; lexical-binding: t; -*-
Code language: Lisp (lisp)
Replace FILENAME.el
with the actual name and DESCRIPTION with a brief description of its purpose.
(Only if you know what you’re doing: Removing no-byte-compile: t;
from your init files allows Emacs to compile them, improving load and execution speed. However, if you do so, you may need to add required dependencies. For example, if you’re using use-package
, add (require 'use-package)
at the top of post-init.el
to ensure all necessary use-package
variables and functions are loaded.)
Important: The examples in this README reference pre/post init files in the ~/.emacs.d/
directory, but the files pre-early-init.el
, post-early-init.el
, pre-init.el
, and post-init.el
should be placed in the same directory as init.el
and early-init.el
, regardless of their location.
Features
- Performance Improvements:
- Increases the amount read from processes in a single chunk.
- Prefers loading newer compiled files.
- Reduces startup screen and message noise, including removing the “For information about GNU Emacs…” message.
- Configures Emacs to start with a scratch buffer in
fundamental-mode
to shave seconds off startup time. - Delays garbage collection during startup to improve performance and resets it to a more reasonable value once Emacs has started.
- Customizes
file-name-handler-alist
for improved startup time and package load time (Special thanks to the Doom Emacs developers for thefile-name-handler-alist
optimizations; This function have been inspired by their project and will contribute to improving vanilla Emacs configurations.) - Reduces rendering workload by not rendering cursors or regions in non-focused windows.
- Disables warnings from the legacy advice API and suppresses warnings about aliased variables.
- Avoids unnecessary excessive UI updates.
- Disables font compacting to avoid high memory usage.
- Defer tool bar setup
- Unset command line options irrelevant to the current OS
- Native Compilation and Byte Compilation:
- Configures native compilation and byte compilation settings
- Suppresses compiler warnings and errors during native compilation.
- UI Element Management:
- Disables the startup screen and messages, including menu bar, tool bar, and scroll bars.
- Configures Emacs to avoid resizing frames and minimizes unnecessary UI updates.
- Package Management:
- Configures package archives and priorities for MELPA, ELPA, and other repositories.
- Customizable Initialization Files:
- Supports additional configuration files (
pre-init.el
,post-init.el
,pre-early-init.el
, andpost-early-init.el
) to allow further customization at different stages of the startup process.
- Supports additional configuration files (
- File Management:
- Manages auto-save and backup files, including backup options and version control settings.
- User Experience Enhancements:
- Configures user interface settings such as cursor behavior, scrolling, and response to prompts.
- Disables beeping and blinking to avoid distractions.
- Buffer and Window Configuration:
- Sets default fringe widths and buffer boundaries.
- Configures smooth scrolling and cursor behavior for a more seamless editing experience.
- Miscellaneous
- Verifies that the Emacs configuration has loaded successfully and issues a warning if there are any issues.
- Configure and optimize settings for Eglot, recentf, savehist, auto-save, and others without enabling the modes themselves. This modifies the behavior and preferences to improve performance and usability.
- Configure Ediff to use a single frame and split windows horizontally