From a2657993bad828af6743c68931a0e848bfcdec53 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 21 Nov 2021 23:57:41 -0600 Subject: I DECLARE BANKRUPTCY ... 8 Didn't think to do this till pretty .. written, so here we are. --- early-init.el | 229 ++++++++++++++++++++-------------------------------------- 1 file changed, 78 insertions(+), 151 deletions(-) (limited to 'early-init.el') diff --git a/early-init.el b/early-init.el index 64bf3cc..ccd1ff4 100644 --- a/early-init.el +++ b/early-init.el @@ -1,135 +1,76 @@ ;;; early-init.el -*- lexical-binding: t; coding: utf-8-unix -*- -;; Author: Case Duckworth <(rot13-string "npqj@npqj.arg")> + +;; Author: Case Duckworth ;; Created: Sometime during Covid-19, 2020 ;; Keywords: configuration ;; URL: https://tildegit.org/acdw/emacs -;; This file is NOT part of GNU Emacs. - ;;; License: -;; Everyone is permitted to do whatever with this software, without -;; limitation. This software comes without any warranty whatsoever, -;; but with two pieces of advice: -;; - Don't hurt yourself. + +;; Everyone is permitted to do whatever they like with this software +;; without limitation. This software comes without any warranty +;; whatsoever, but with two pieces of advice: +;; - Be kind to yourself. ;; - Make good choices. -;;; Comentary: -;; Starting with Emacs 27.1, `early-init' is sourced before `package' -;; or any frames. So those are the settings I run in this file. +;;; Commentary: + +;; Starting with Emacs 27.1, early-init.el is sourced before +;; package.el and any graphical frames. In this file, I set up frame +;; parameters and packaging infrastructure. ;;; Code: -;;; Add `acdw.el' -(push (expand-file-name "lisp/" user-emacs-directory) - load-path) +(push (locate-user-emacs-file "lisp") load-path) +(add-to-list 'load-path (locate-user-emacs-file "lisp/compat") :append) + (require 'acdw) -(require 'acdw-frame) - -;;; Frame settings -(when (acdw/system :home) - (setq initial-frame-alist '((fullscreen . maximized)))) - -(setq default-frame-alist - `((tool-bar-lines . 0) - (menu-bar-lines . 0) - (vertical-scroll-bars . nil) - (horizontal-scroll-bars . nil) - ;; (width . 84) - ;; (height . 30) - (left-fringe . 8) - (right-fringe . 8) - (font . ,(acdw/system - (:home "DejaVu Sans Mono 10") - (:work "Consolas 12") - (:other "monospace 10")))) + +(+define-dir .etc (locate-user-emacs-file ".etc") + "Directory for all of Emacs's various files. +See `no-littering' for examples.") + +(+define-dir sync/ (expand-file-name "~/Sync") + "My Syncthing directory.") + +;;; Default frame settings + +(setq default-frame-alist '((tool-bar-lines . 0) + (menu-bar-lines . 0) + (vertical-scroll-bars) + (horizontal-scroll-bars)) frame-inhibit-implied-resize t - frame-resize-pixelwise t - inhibit-x-resources t) - -(add-hook 'after-init-hook - (defun after-init@disable-ui-modes () - "Disable UI modes after init. -I already disable them from the `default-frame-alist' for speed -and anti-flickering reasons, but this function allows running, -say, `tool-bar-mode' once to toggle the tool bar back on." - (dolist (mode ;; each mode is of the form (MODE . FRAME-ALIST-VAR) - '((tool-bar-mode . tool-bar-lines) - (menu-bar-mode . menu-bar-lines) - (scroll-bar-mode . vertical-scroll-bars) - (horizontal-scroll-bar-mode . horizontal-scroll-bars))) - (let ((setting (alist-get (cdr mode) default-frame-alist))) - (when (or (not setting) - (zerop setting)) - (funcall (car mode) -1)))))) - -(add-hook 'after-make-frame-functions - (defun after-make-frame@setup (&rest args) - (ignore args) - (let ((fixed-pitch-faces - '((:font "Fantasque Sans Mono" :height 115) - (:font "Go Mono" :height 110) - (:font "DejaVu Sans Mono" :height 110) - (:font "monospace" :height 100))) - (variable-pitch-faces - '((:font "Inter" :height 120) - (:font "Go" :height 120) - (:font "sans-serif" :height 100)))) - (acdw/set-first-face-attribute 'default - fixed-pitch-faces) - (acdw/set-first-face-attribute 'fixed-pitch - fixed-pitch-faces) - (acdw/set-first-face-attribute 'variable-pitch - variable-pitch-faces)) - (acdw/set-emoji-fonts "Noto Color Emoji" - "Noto Emoji" - "Segoe UI Emoji" - "Apple Color Emoji" - "FreeSans" - "FreeMono" - "FreeSerif" - "Unifont" - "Symbola") - (acdw/set-fringes '((left-curly-arrow [#b01100000 - #b00110000 - #b00011000 - #b00001100] - 4 8 center) - (right-curly-arrow [#b00000011 - #b00000110 - #b00001100 - #b00011000] - 4 8 center) - (left-arrow [#b01100000 - #b01010000] - 2 8 (top t)) - (right-arrow [#b00000011 - #b00000101] - 2 8 (top t)))) - (setq indicate-empty-lines nil - indicate-buffer-boundaries '((top . right) - (bottom . right))) - (custom-set-faces '(fringe ((t (:foreground "dim gray"))))))) -(add-hook 'server-after-make-frame-hook #'after-make-frame@setup) - -;; I have this here because ... the first frame doesn't ? run ? the hook ??? -(add-function :after after-focus-change-function - (defun after-focus-change@first-frame-setup (&rest args) - (ignore args) - (after-make-frame@setup) - (remove-function after-focus-change-function - #'after-focus-change@first-frame-setup))) - -;;; Bootstrap package manager (`straight.el') - -;; Set `package' and `straight' variables. + frame-resize-pixelwise t + window-resize-pixelwise t + inhibit-x-resources t + indicate-empty-lines nil + indicate-buffer-boundaries '((top . right) + (bottom . right))) + +;; Fonts +(let ((font-name "Go Mono") + (font-size 105)) + (set-face-attribute 'default nil :family font-name + :height font-size :weight 'book) + (set-face-attribute 'italic nil :family font-name + :height font-size :slant 'italic)) + +;;; Packages + (setq package-enable-at-startup nil package-quickstart nil straight-host-usernames '((github . "duckwork") - (gitlab . "acdw")) - straight-base-dir (acdw/dir) - straight-check-for-modifications '(check-on-save find-when-checking)) + (gitlab . "acdw")) + straight-check-for-modifications '(check-on-save + find-when-checking)) + +(setq no-littering-etc-directory .etc + no-littering-var-directory .etc + straight-base-dir .etc) + +;; Bootstrap straight.el +;; https://github.com/raxod502/straight.el -;; Bootstrap `straight'. (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name @@ -146,44 +87,30 @@ say, `tool-bar-mode' once to toggle the tool bar back on." (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) -;; Helper package, good commands here. +;; Early-loaded packages -- those that, for some reason or another, +;; need to be ensured to be loaded first. + (require 'straight-x) -;; Appendix. Get rid of a dumb alias. -;; straight-ಠ_ಠ-mode really slows down all minibuffer completion functions. -;; Since it's a (rarely-used, even) alias anyway, I just define it back to nil. -;; By the way, the alias is `straight-package-neutering-mode'. -(defalias 'straight-ಠ_ಠ-mode nil) +(dolist (pkg '(el-patch + no-littering + setup)) + (straight-use-package pkg) + (require pkg) + (require (intern (format "+%s" pkg)) nil :noerror)) -;;; Message startup time for profiling -;; This just redefines the Emacs function -;; `display-startup-echo-area-message', so no hooks needed. -(defun display-startup-echo-area-message () - "Show Emacs's startup time in the message buffer. For profiling." - (message "Emacs ready in %s with %d garbage collections." - (format "%.2f seconds" - (float-time (time-subtract after-init-time - before-init-time))) - gcs-done)) - -;;; Early-loaded packages -;; These packages are here because they need to be loaded /before/ -;; everything else in init.el. - -(straight-use-package '(setup - :host nil - :repo "https://git.sr.ht/~pkal/setup")) -(require 'setup) -(require 'acdw-setup) - -(setup (:straight no-littering) - (:option no-littering-etc-directory (acdw/dir) - no-littering-var-directory (acdw/dir)) - (require 'no-littering)) - -(setup (:straight el-patch)) - -;; My private variables and stuff -(require 'private (acdw/sync-dir "private") :noerror) +;;; Appendix +;; I've patched setup to look at `setup-ensure-function-inhibit' to decide +;; whether to ensure functions or not with local macros. +(setq setup-ensure-function-inhibit t) + +;; Get rid of a dumb alias. straight-ಠ_ಠ-mode really slows down all +;; minibuffer completion functions. Since it's a (rarely-used, even) +;; alias anyway, I just define it back to nil. By the way, the alias +;; is `straight-package-neutering-mode'. +(defalias 'straight-ಠ_ಠ-mode nil) + +(provide 'early-init) ;;; early-init.el ends here + -- cgit 1.4.1-21-gabe81