From 87714bef466e0809f77e5112d5eeb70b7f002c16 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Fri, 5 Sep 2025 17:36:39 -0400 Subject: [PATCH] Update README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 28422e5..e4c72fa 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's - [How to get the latest version of all packages? (unstable)](#how-to-get-the-latest-version-of-all-packages-unstable) - [How to use MELPA stable?](#how-to-use-melpa-stable) - [How to load a local lisp file for machine-specific configurations?](#how-to-load-a-local-lisp-file-for-machine-specific-configurations) + - [How to prevent Emacs from automatically recompiling some Elisp files?](#how-to-prevent-emacs-from-automatically-recompiling-some-elisp-files) - [How to load Emacs customizations?](#how-to-load-emacs-customizations) - [How to increase gc-cons-threshold?](#how-to-increase-gc-cons-threshold) - [How to prevent Emacs from loading .dir-locals.el files?](#how-to-prevent-emacs-from-loading-dir-localsel-files) @@ -2003,6 +2004,31 @@ This allows `local.el` to load, enabling custom configurations specific to the m (Ensure that `local.el` is in the same directory as `post-init.el`.) +### How to prevent Emacs from automatically recompiling some Elisp files? + +In some Emacs configurations, certain files may be repeatedly recompiled during startup or loading: +```elisp +Compiling /snap/emacs/current/usr/share/emacs/lisp/org/org-loaddefs.el.gz... +Compiling /snap/emacs/current/usr/share/emacs/etc/themes/modus-vivendi-theme.el... +``` + +This happens because Emacs attempts native compilation on certain Elisp files. In many cases, you may want to prevent native compilation for specific files. + +You can configure Emacs to skip native compilation for files matching a list of regular expression patterns by setting `native-comp-jit-compilation-deny-list`. Here is an example: +```elisp +(let ((deny-list '("\\(?:[/\\\\]\\.dir-locals\\.el\\(?:\\.gz\\)?$\\)" + "\\(?:[/\\\\]modus-vivendi-theme\\.el\\(?:\\.gz\\)?$\\)" + "\\(?:[/\\\\][^/\\\\]+-loaddefs\\.el\\(?:\\.gz\\)?$\\)" + "\\(?:[/\\\\][^/\\\\]+-autoloads\\.el\\(?:\\.gz\\)?$\\)"))) + (setq native-comp-jit-compilation-deny-list deny-list) + ;; Deprecated + (with-no-warnings + (setq native-comp-deferred-compilation-deny-list deny-list) + (setq comp-deferred-compilation-deny-list deny-list))) +``` + +This deny list causes Emacs to skip native compilation for files matching these patterns, avoiding unnecessary or problematic recompilation while allowing all other files to be compiled as usual. + ### How to load Emacs customizations? To load customizations saved by Emacs (`M-x customize`), add the following code snippet to the `post-init.el` file. This ensures that the custom file, typically set to a separate file for user preferences, is loaded without errors or messages during startup: