diff --git a/README.md b/README.md index ab7a68e..dd16645 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ The author is using **[minimal-emacs.d](https://github.com/jamescherti/minimal-e - [Why the reflexive disabling of the menu bar?](#why-the-reflexive-disabling-of-the-menu-bar) - [Why did the author develop minimal-emacs.d?](#why-did-the-author-develop-minimal-emacsd) - [How to keep minimal-emacs.d pre-\*.el and post-\*.el files in a separate directory?](#how-to-keep-minimal-emacsd-pre-el-and-post-el-files-in-a-separate-directory) + - [How to make minimal-emacs.d install packages in the early-init phase, instead of init?](#how-to-make-minimal-emacsd-install-packages-in-the-early-init-phase-instead-of-init) - [Are there any comments from users?](#are-there-any-comments-from-users) - [Features](#features) - [Author and license](#author-and-license) @@ -720,6 +721,25 @@ To ensure the `minimal-emacs.d` configuration loads `post-early-init.el`, `pre-i This will ensure that the `minimal-emacs.d` configuration loads `post-early-init.el`, `pre-init.el`, and `post-init.el` from `~/.config/minimal-emacs.d/`. +### How to make minimal-emacs.d install packages in the early-init phase, instead of init? + +To load packages in the early-init phase, add the following to `post-early-init.el`: +```elisp +(setq minimal-emacs-package-initialize-and-refresh nil) + +;; Initialize packages in the early-init phase instead of init +(progn + (package-initialize) + (unless package-archive-contents + (package-refresh-contents)) + (unless (package-installed-p 'use-package) + (package-install 'use-package)) + (eval-when-compile + (require 'use-package))) +``` + +The drawback of using early-init phase instead of init.el is that if a package fails, you will not be able to see anything in the Emacs GUI. You will need to open the terminal to view Emacs's stdout. + ### Are there any comments from users? A [user commented on Reddit](https://www.reddit.com/r/emacs/comments/1feaf37/comment/lmw7ijd/) that after switching to `minimal-emacs.d`, their configuration execution time decreased from 3 seconds to just 1 second by simply replacing their `init.el` and `early-init.el` files with those from the project. Please [send me](https://www.jamescherti.com/contact/) your feedback and I'll add it to this README.md file.