;;; early-init.el -- Early init -*- lexical-binding: t -*- ;; Copyright (C) 2023 Free Software Foundation. ;; Author: Yuchen Pei ;; Package-Requires: ((emacs "28.2")) ;; This file is part of dotfiles. ;; dotfiles is free software: you can redistribute it and/or modify it under ;; the terms of the GNU Affero General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; dotfiles is distributed in the hope that it will be useful, but WITHOUT ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General ;; Public License for more details. ;; You should have received a copy of the GNU Affero General Public ;; License along with dotfiles. If not, see . ;;; Commentary: ;; Early init. ;;; Code: (defconst my-emacs-start-time (current-time)) ;; Use this to control what kind of emacs we want to use. For emms, ;; erc, home, or work etc. (defvar my-profile (getenv "EMACS_PROFILE")) ;;; Copied from John Wiegley's .emacs file (defun my-report-time-since-load (&optional suffix) (message "Loading init...done (%.3fs)%s" (float-time (time-subtract (current-time) my-emacs-start-time)) suffix)) (add-hook 'after-init-hook #'(lambda () (my-report-time-since-load " [after-init]")) t) ;; Much of the following is copied from prot-dotfiles ;; Disable the damn thing by making it disposable. (setq custom-file (make-temp-file "emacs-custom-")) (menu-bar-mode -1) (scroll-bar-mode -1) (tool-bar-mode -1) (setq frame-resize-pixelwise t frame-inhibit-implied-resize t) (setq use-dialog-box t ; only for mouse events use-file-dialog nil inhibit-splash-screen t inhibit-startup-screen t inhibit-x-resources t inhibit-startup-echo-area-message user-login-name ; read the docstring inhibit-startup-buffer-menu t make-backup-files nil backup-inhibited nil ; Not sure if needed, given `make-backup-files' create-lockfiles nil) ;; Temporarily increase the garbage collection threshold. These ;; changes help shave off about half a second of startup time. (defvar my-emacs--gc-cons-threshold gc-cons-threshold) (setq gc-cons-threshold most-positive-fixnum) (add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold my-emacs--gc-cons-threshold))) ;; Initialise installed packages (setq package-enable-at-startup t) (defvar package-quickstart) ;; Allow loading from the package cache (setq package-quickstart t) (when (native-comp-available-p) (setq native-comp-async-report-warnings-errors 'silent) ; emacs28 with native compilation (setq native-compile-prune-cache t)) ; Emacs 29 ;;; early-init.el ends here