blob: abe008e6959146a87eaa6376fe6a05e39455e54b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
;;; early-init.el -- Early init -*- lexical-binding: t -*-
;; Copyright (C) 2023 Free Software Foundation.
;; Author: Yuchen Pei <id@ypei.org>
;; 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 <https://www.gnu.org/licenses/>.
;;; 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
|