Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's
- [Preventing Emacs from saving custom.el](#preventing-emacs-from-saving-customel)
- [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)
- [Reducing clutter in `~/.emacs.d` by redirecting files to `~/emacs.d/var/`](#reducing-clutter-in-emacsd-by-redirecting-files-to-emacsdvar)
- [Reducing clutter in `~/.emacs.d` by redirecting files to `~/.emacs.d/var/`](#reducing-clutter-in-emacsd-by-redirecting-files-to-emacsdvar)
- [Configuring straight.el?](#configuring-straightel)
- [Configuring elpaca (package manager)](#configuring-elpaca-package-manager)
- [Frequently asked questions](#frequently-asked-questions)
Expand Down Expand Up @@ -1045,15 +1045,15 @@ It is also recommended to read the following articles:

## Customizations: pre-early-init.el

### Reducing clutter in `~/.emacs.d` by redirecting files to `~/emacs.d/var/`
### Reducing clutter in `~/.emacs.d` by redirecting files to `~/.emacs.d/var/`

Emacs, by default, stores various configuration files, caches, backups, and other data in the `~/.emacs.d` directory. Over time, this directory can become cluttered with numerous files, making it difficult to manage and maintain.

A common solution to this issue is installing the no-littering package; however, this package is not essential.

An alternative lightweight approach is to simply change the default `~/.emacs.d` directory to `~/.emacs.d/var/`, which will contain all the files that Emacs typically stores in the base directory. This can be accomplished by adding the following code to `~/.emacs.d/pre-early-init.el`:
``` emacs-lisp
;; Reducing clutter in ~/.emacs.d by redirecting files to ~/emacs.d/var/
;; Reducing clutter in ~/.emacs.d by redirecting files to ~/.emacs.d/var/
;; IMPORTANT: This part should be in the pre-early-init.el file
(setq minimal-emacs-var-dir (expand-file-name "var/" minimal-emacs-user-directory))
(setq package-user-dir (expand-file-name "elpa" minimal-emacs-var-dir))
Expand Down