fix to load early-init.el also if init is loaded via --load-file
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
;; `set-language-enviornment' sets `default-input-method', which is unwanted
|
;; `set-language-enviornment' sets `default-input-method', which is unwanted
|
||||||
(setq default-input-method nil)
|
(setq default-input-method nil)
|
||||||
|
|
||||||
(setq config-dir (file-name-directory (file-truename user-init-file))) ;; user-init-file: ~/.config/emacs/init, file-truename: /opt/emacs-conf/init
|
(defvar config-dir (file-name-directory (file-truename load-file-name)))
|
||||||
(setq user-emacs-directory "~/.config/emacs/") ;; for cache etc.
|
(setq user-emacs-directory "~/.config/emacs/") ;; for cache etc.
|
||||||
(defconst user-cache-directory
|
(defconst user-cache-directory
|
||||||
(file-name-as-directory (concat user-emacs-directory ".cache"))
|
(file-name-as-directory (concat user-emacs-directory ".cache"))
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
(add-to-list 'default-frame-alist '(alpha . (95 . 95)))
|
(add-to-list 'default-frame-alist '(alpha . (95 . 95)))
|
||||||
|
|
||||||
;; Custom functions/hooks for persisting/loading frame geometry upon save/load
|
;; Custom functions/hooks for persisting/loading frame geometry upon save/load
|
||||||
(setq my-frame-geometry-file (concat user-cache-directory "frame-geometry.el"))
|
(defvar my-frame-geometry-file (concat user-cache-directory "frame-geometry.el"))
|
||||||
(defun my-frame-geometry-save ()
|
(defun my-frame-geometry-save ()
|
||||||
"Gets the current frame's geometry and save it to `my-frame-geometry-file'."
|
"Gets the current frame's geometry and save it to `my-frame-geometry-file'."
|
||||||
(let ((frameg-font (frame-parameter (selected-frame) 'font))
|
(let ((frameg-font (frame-parameter (selected-frame) 'font))
|
||||||
@@ -87,3 +87,6 @@
|
|||||||
(lambda ()
|
(lambda ()
|
||||||
(if (display-graphic-p)
|
(if (display-graphic-p)
|
||||||
(add-hook 'kill-emacs-hook 'my-frame-geometry-save))))
|
(add-hook 'kill-emacs-hook 'my-frame-geometry-save))))
|
||||||
|
|
||||||
|
(provide 'early-init)
|
||||||
|
;;; early-init.el ends here
|
||||||
|
|||||||
25
init
25
init
@@ -4,16 +4,27 @@
|
|||||||
;; Emacs Startup File --- initialization for Emacs
|
;; Emacs Startup File --- initialization for Emacs
|
||||||
;; https://blog.d46.us/advanced-emacs-startup/
|
;; 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
|
;; Requirements: git gnuplot ledger
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
|
(require 'early-init
|
||||||
;; package and UI initialization happens, and before site files are loaded.
|
(concat
|
||||||
;; In the case that early-init.el wasn't loaded (e.g. using old emacs? Or this
|
(file-name-directory (file-truename (or load-file-name
|
||||||
;; file directly loaded?), we do it explicitly:
|
"~/.config/emacs/init")))
|
||||||
(unless (version<= "27.1" emacs-version)
|
"early-init.el")
|
||||||
(load (concat (file-name-directory (file-truename user-init-file)) "early-init.el")
|
t)
|
||||||
nil 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 'pre-settings) ;; use-package delight functions variables
|
||||||
(require 'which-key-settings) ;; https://melpa.org/#/which-key
|
(require 'which-key-settings) ;; https://melpa.org/#/which-key
|
||||||
(require 'general-settings) ;; requires which-key
|
(require 'general-settings) ;; requires which-key
|
||||||
|
|||||||
Reference in New Issue
Block a user