fix to load early-init.el also if init is loaded via --load-file

This commit is contained in:
2022-12-10 17:12:13 +01:00
parent 48a4ef89dd
commit 4cb72a991a
2 changed files with 23 additions and 9 deletions

25
init
View File

@@ -4,16 +4,27 @@
;; Emacs Startup File --- initialization for Emacs
;; https://blog.d46.us/advanced-emacs-startup/
;; Usage:
;; "emacs --init-directory ~/repos/emacs-conf"
;; "emacs --no-splash -q -l ~/repos/emacs-conf/init"
;; Requirements: git gnuplot ledger
;;; Code:
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
;; package and UI initialization happens, and before site files are loaded.
;; In the case that early-init.el wasn't loaded (e.g. using old emacs? Or this
;; file directly loaded?), we do it explicitly:
(unless (version<= "27.1" emacs-version)
(load (concat (file-name-directory (file-truename user-init-file)) "early-init.el")
nil t))
(require 'early-init
(concat
(file-name-directory (file-truename (or load-file-name
"~/.config/emacs/init")))
"early-init.el")
t)
;; Load early-init-el if not already
;; - Emacs 27.1 introduced early-init.el, which is run before
;; init.el, before package and UI initialization happens, and
;; before site files are loaded. In the case that early-init.el
;; wasn't loaded (e.g. using old emacs? Or this file directly
;; loaded?), we do it explicitly
;; - for org export async actions, e.g. as in
;; emacs -l ~/.config/emacs/init -l /tmp/org-export-processXYZ
(require 'pre-settings) ;; use-package delight functions variables
(require 'which-key-settings) ;; https://melpa.org/#/which-key
(require 'general-settings) ;; requires which-key