From 0d1ae2883cefc19f08c7b81c5d44858a569964eb Mon Sep 17 00:00:00 2001 From: noa Date: Fri, 15 Nov 2024 02:37:00 +0800 Subject: Add early init file for emacs --- emacs/early-init.el | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 emacs/early-init.el (limited to 'emacs/early-init.el') diff --git a/emacs/early-init.el b/emacs/early-init.el new file mode 100644 index 0000000..fc1027d --- /dev/null +++ b/emacs/early-init.el @@ -0,0 +1,47 @@ +;;; early-init.el -*- lexical-binding: t; -*- + +;; Emacs 27+ introduces early-init.el, which is run before init.el, +;; before package and UI initialization happens. + +;; In noninteractive sessions, prioritize non-byte-compiled source files to prevent the use of stale byte-code. Otherwise, it saves us a little IO time to skip the mtime checks on every *.elc file. +(setopt load-prefer-newer 'noninteractive + native-comp-jit-compilation nil) + +;; is this a bad idea? +;; (setopt site-run-file nil +;; inhibit-default-init t) +(setopt inhibit-x-resources t) + +;; In Emacs 27+, package initialization occurs before `user-init-file' is loaded, but after `early-init-file', so we can disable this here. +;; (setopt package-enable-at-startup nil) + +;; Gui changes are expensive +(setopt frame-inhibit-implied-resize t + default-frame-alist '((fullscreen . maximized) + (font . "Noto Serif-12"))) + +(push '(menu-bar-lines . 0) default-frame-alist) +(push '(tool-bar-lines . 0) default-frame-alist) +(push '(horizontal-scroll-bars) default-frame-alist) +(when (bound-and-true-p tooltip-mode) + (tooltip-mode -1)) +(setq use-file-dialog nil) +(setq use-dialog-box nil) + +;; Override the tool-bar-setup function to prevent it from running during the initial stages of startup +;; h/t https://github.com/jamescherti/minimal-emacs.d/ +(when (fboundp 'tool-bar-setup) + (advice-add #'tool-bar-setup :override #'ignore)) + +;; (setopt default-frame-alist '( +;; (menu-bar-lines . 0) +;; (tool-bar-lines . 0))) + +;; setup package +(setopt package-archives + '(("gnu" . "https://elpa.gnu.org/packages/") + ("nongnu" . "https://elpa.nongnu.org/nongnu/") + ("melpa" . "https://melpa.org/packages/"))) + +;; Ignore X resources; its settings would be redundant with the other settings in this file and can conflict with later config (particularly where the cursor color is concerned). +(advice-add #'x-apply-session-resources :override #'ignore) -- cgit 1.4.1-2-gfad0