From 0c3aad6d9962874d802682c910a884fdced1c4c2 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Wed, 19 Jun 2024 15:19:30 -0400 Subject: [PATCH] Add function: load-user-lisp --- early-init.el | 11 +++++++++++ init.el | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/early-init.el b/early-init.el index 049b49c..1b20358 100644 --- a/early-init.el +++ b/early-init.el @@ -14,6 +14,15 @@ ;;; Code: +(defun load-user-lisp (filename) + "Execute a file of Lisp code named FILENAME." + (let ((user-init-file (expand-file-name filename + user-emacs-directory))) + (when (file-exists-p user-init-file) + (load user-init-file)))) + +(load-user-lisp "user-pre-early-init.el") + ;; Garbage collection significantly affects startup times. This setting delays ;; garbage collection during startup but will be reset later. (setq gc-cons-threshold most-positive-fixnum) @@ -40,6 +49,8 @@ (when (fboundp 'horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode -1)) +(load-user-lisp "user-post-early-init.el") + (provide 'early-init) ;;; early-init.el ends here diff --git a/init.el b/init.el index a9b512c..9196061 100644 --- a/init.el +++ b/init.el @@ -14,6 +14,9 @@ ;;; Code: +;;; Load user-pre-init.el +(load-user-lisp "user-pre-init.el") + ;;; package: Set package archives for package installation (progn (require 'package) @@ -49,11 +52,8 @@ (eval-when-compile (require 'use-package))) -;;; Load user-init.el -(let ((user-init-file (expand-file-name "user-init.el" - user-emacs-directory))) - (when (file-exists-p user-init-file) - (load user-init-file))) +;;; Load user-pre-init.el +(load-user-lisp "user-post-init.el") (provide 'init)