Optimizing Emacs for speed and efficiency involves fine-tuning its startup process, managing essential settings, and handling package installations, etc. The minimal-emacs.d repository hosts a minimal Emacs configuration with early-init.el and init.el files designed to serve as a base for your vanilla Emacs configuration, offering a robust foundation for a better vanilla Emacs experience.
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)
Features
- Performance Improvements:
- Increases the amount read from processes in a single chunk.
- 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 UI updates.
- Disables font compacting to avoid high memory usage.
- Customizes
file-name-handler-alist
for improved startup time and package load time. - 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.
- 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.
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.