From 41424f2ece869e9c17f47c02779c9ce147ff5ce3 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Tue, 3 Mar 2026 11:11:32 -0500 Subject: [PATCH] Add vars to disable loading pre/post early-init/init files --- README.md | 8 ++++++++ early-init.el | 19 +++++++++++++++++-- init.el | 11 ++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6709326..f0a8002 100644 --- a/README.md +++ b/README.md @@ -2098,6 +2098,14 @@ These modes are optional and can be added selectively to `~/.emacs.d/post-init.e ("/info/attributes\\'" . gitattributes-mode) ("/git/attributes\\'" . gitattributes-mode))) +;; Configure built-in sgml-mode to automatically enable +;; `sgml-electric-tag-pair-mode' in `html-mode' and `mhtml-mode', providing +;; automatic insertion of matching closing tags. +(use-package sgml-mode + :ensure nil + :commands (sgml-mode sgml-electric-tag-pair-mode) + :hook ((html-mode mhtml-mode) . sgml-electric-tag-pair-mode)) + ;; Support for YAML files. ;; ;; NOTE: Prefer the tree-sitter-based yaml-ts-mode over yaml-mode when diff --git a/early-init.el b/early-init.el index 0fcf5e8..79a98fb 100644 --- a/early-init.el +++ b/early-init.el @@ -95,6 +95,18 @@ of the progress or any relevant activities during startup.") "Directory beneath minimal-emacs.d files are placed. Note that this should end with a directory separator.") +(defvar minimal-emacs-load-pre-early-init t + "If non-nil, attempt to load `pre-early-init.el`.") + +(defvar minimal-emacs-load-post-early-init t + "If non-nil, attempt to load `post-early-init.el`.") + +(defvar minimal-emacs-load-pre-init t + "If non-nil, attempt to load `pre-init.el`.") + +(defvar minimal-emacs-load-post-init t + "If non-nil, attempt to load `post-init.el`.") + ;;; Load pre-early-init.el ;; Prefer loading newer compiled files @@ -143,7 +155,8 @@ pre-early-init.el, and post-early-init.el.") (setq init-file (minimal-emacs--remove-el-file-suffix init-file)) (load init-file :no-error (not minimal-emacs-debug))))) -(minimal-emacs-load-user-init "pre-early-init.el") +(when minimal-emacs-load-pre-early-init + (minimal-emacs-load-user-init "pre-early-init.el")) (setq custom-theme-directory (expand-file-name "themes/" minimal-emacs-user-directory)) @@ -454,7 +467,9 @@ this stage of initialization." ("melpa-stable" . 50))) ;;; Load post-early-init.el -(minimal-emacs-load-user-init "post-early-init.el") + +(when minimal-emacs-load-post-early-init + (minimal-emacs-load-user-init "post-early-init.el")) ;; Local variables: ;; byte-compile-warnings: (not obsolete free-vars) diff --git a/init.el b/init.el index 1da9551..5d21b9f 100644 --- a/init.el +++ b/init.el @@ -22,9 +22,11 @@ ;;; Code: ;;; Load pre-init.el + (if (fboundp 'minimal-emacs-load-user-init) - (minimal-emacs-load-user-init "pre-init.el") - (error "The early-init.el file failed to loaded")) + (when minimal-emacs-load-pre-init + (minimal-emacs-load-user-init "pre-init.el")) + (error "The early-init.el file failed to load")) ;;; Before package @@ -562,8 +564,11 @@ (put cmd 'disabled nil)) ;;; Load post init -(when (fboundp 'minimal-emacs-load-user-init) + +(when (and minimal-emacs-load-post-init + (fboundp 'minimal-emacs-load-user-init)) (minimal-emacs-load-user-init "post-init.el")) + (setq minimal-emacs--success t) ;; Local variables: