Add vars to disable loading pre/post early-init/init files

This commit is contained in:
James Cherti
2026-03-03 11:11:32 -05:00
parent 9ea9d4eb51
commit 41424f2ece
3 changed files with 33 additions and 5 deletions

View File

@@ -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

View File

@@ -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)

11
init.el
View File

@@ -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: