Closes #40: Add function that verifies that the Emacs config has loaded.

This commit is contained in:
James Cherti
2025-03-06 12:11:14 -05:00
parent 2bef2c2ba9
commit 224fb1216b
3 changed files with 19 additions and 6 deletions

View File

@@ -931,7 +931,7 @@ To prevent Emacs from saving customization information to a custom file, set `cu
(add-hook 'dired-mode-hook #'dired-omit-mode) (add-hook 'dired-mode-hook #'dired-omit-mode)
;; Enable on-the-fly spell checking (Flyspell mode). ;; Enable on-the-fly spell checking (Flyspell mode).
(add-hook text-mode-hook #'flyspell-mode) (add-hook 'text-mode-hook #'flyspell-mode)
``` ```
It is also recommended to read the following articles: It is also recommended to read the following articles:

View File

@@ -71,18 +71,29 @@ minimalistic appearance during startup.")
;;; Load pre-early-init.el ;;; Load pre-early-init.el
(defvar minimal-emacs--success nil)
(defvar minimal-emacs--stage "early-init.el")
(defun minimal-emacs--check-success ()
"Verify that the Emacs configuration has loaded successfully."
(unless minimal-emacs--success
(error (concat "Configuration error in: '%s'. Debug by starting Emacs "
"with: emacs --debug-init")
minimal-emacs--stage)))
(add-hook 'emacs-startup-hook #'minimal-emacs--check-success 102)
;; Prefer loading newer compiled files ;; Prefer loading newer compiled files
(setq load-prefer-newer t) (setq load-prefer-newer t)
(defun minimal-emacs-load-user-init (filename) (defun minimal-emacs-load-user-init (filename)
"Execute a file of Lisp code named FILENAME." "Execute a file of Lisp code named FILENAME."
(let ((user-init-file (let ((init-file (expand-file-name filename
(expand-file-name filename minimal-emacs-user-directory)))
minimal-emacs-user-directory))) (when (file-exists-p init-file)
(when (file-exists-p user-init-file) (setq minimal-emacs--stage init-file)
(load user-init-file nil t t)))) (load init-file nil t t))))
(minimal-emacs-load-user-init "pre-early-init.el") (minimal-emacs-load-user-init "pre-early-init.el")
(setq minimal-emacs--stage "early-init.el")
(setq custom-theme-directory (setq custom-theme-directory
(expand-file-name "themes/" minimal-emacs-user-directory)) (expand-file-name "themes/" minimal-emacs-user-directory))

View File

@@ -16,6 +16,7 @@
;;; Load pre-init.el ;;; Load pre-init.el
(minimal-emacs-load-user-init "pre-init.el") (minimal-emacs-load-user-init "pre-init.el")
(setq minimal-emacs--stage "init.el")
;;; Before package ;;; Before package
@@ -542,6 +543,7 @@
;;; Load post init ;;; Load post init
(minimal-emacs-load-user-init "post-init.el") (minimal-emacs-load-user-init "post-init.el")
(setq minimal-emacs--success t)
(provide 'init) (provide 'init)
;;; init.el ends here ;;; init.el ends here