From 641d3c33e56ddffb335bed01b6c8118273d37ea5 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Wed, 23 Jul 2025 19:00:29 -0400 Subject: [PATCH] Update README.md --- README.md | 25 +++++++++++++++---------- early-init.el | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5aaafb4..e20c1d5 100644 --- a/README.md +++ b/README.md @@ -91,12 +91,12 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's - [A better Emacs *help* buffer](#a-better-emacs-help-buffer) - [Enhancing the Elisp development experience](#enhancing-the-elisp-development-experience) - [Showing the tab-bar](#showing-the-tab-bar) - - [Preventing Emacs from saving custom.el](#preventing-emacs-from-saving-customel) - [Changing the Default Font](#changing-the-default-font) + - [Loading the custom.el file](#loading-the-customel-file) - [Which other customizations can be interesting to add?](#which-other-customizations-can-be-interesting-to-add) - [Customizations: pre-early-init.el](#customizations-pre-early-initel) - [Configuring straight.el](#configuring-straightel) - - [Configuring elpaca (package manager)](#configuring-elpaca-package-manager) + - [Configuring Elpaca (package manager)](#configuring-elpaca-package-manager) - [Frequently asked questions](#frequently-asked-questions) - [Customizing Scroll Recentering](#customizing-scroll-recentering) - [How to display Emacs startup duration?](#how-to-display-emacs-startup-duration) @@ -1466,14 +1466,6 @@ Configure the `tab-bar-show` variable to 1 to display the tab bar exclusively wh (setopt tab-bar-show 1) ``` -### Preventing Emacs from saving custom.el - -To prevent Emacs from saving customization information to a custom file, set `custom-file` to `null-device` by adding to the following to `~/.emacs.d/post-init.el`: -``` emacs-lisp -;; Prevent Emacs from saving customization information to a custom file -(setq custom-file null-device) -``` - ### Changing the Default Font To customize the default font, add the following expression to your `~/.emacs.d/post-init.el`: @@ -1493,6 +1485,19 @@ On Linux, you can display a comprehensive list of all installed font families by fc-list : family | sed 's/,/\n/g' | sort -u ``` +### Loading the custom.el file + +In Emacs, customization variables modified via the UI (e.g., `M-x customize`) are typically stored in a separate file, commonly named `custom.el`. To ensure these settings are loaded during Emacs initialization, it is necessary to explicitly load this file if it exists. + +To accomplish this, add the following form to your `~/.emacs.d/post-init.el`: + +```elisp +(when (file-exists-p custom-file) + (load custom-file)) +``` + +This ensures that any user-defined customizations are applied without interfering with manually maintained configuration files. + ### Which other customizations can be interesting to add? 1. Read the following article from the same author: [Essential Emacs Packages for Efficient Software Development and Text Editing](https://www.jamescherti.com/essential-emacs-packages/) diff --git a/early-init.el b/early-init.el index 9abbfb7..59a86f3 100644 --- a/early-init.el +++ b/early-init.el @@ -150,6 +150,7 @@ pre-early-init.el, and post-early-init.el.") (setq custom-theme-directory (expand-file-name "themes/" minimal-emacs-user-directory)) + (setq custom-file (expand-file-name "custom.el" minimal-emacs-user-directory)) ;;; Garbage collection