forked from Ergus/mini_dotemacs
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
early-init.el
62 lines (51 loc) · 1.66 KB
/
early-init.el
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
;;; early-init.el --- Emacs 27 early init file
;; Copyright (C) 2019 Jimmy Aguilar Mena
;; Author: Jimmy Aguilar Mena
;; Version: 0.1
;; Package-Requires: (())
;; Keywords:
;; URL:
;;; Commentary:
;;
;; Emacs HEAD (27+) introduces early-init.el, which is run before init.el,
;; before package and UI initialization happens.
;;
;;; Code:
;; Profiling since here when in debug-mode
(when init-file-debug
(profiler-start 'cpu)
(add-hook 'window-setup-hook #'profiler-stop 0))
(defconst file-name-handler-alist-save file-name-handler-alist)
(defconst my/gc-cons-threshold (* 2 gc-cons-threshold))
(defsubst my/unset-gc ()
"Disable the gc."
(setq gc-cons-threshold most-positive-fixnum ;; Defer Garbage collection
gc-cons-percentage 1.0))
(defsubst my/restore-gc ()
"Restore the gc."
(setq gc-cons-threshold my/gc-cons-threshold
gc-cons-percentage 0.1))
(setq-default file-name-handler-alist nil
message-log-max 16384)
(my/unset-gc)
;; This hook is always added, set to 90 to go to the end
(add-hook 'window-setup-hook
(lambda ()
(setq file-name-handler-alist file-name-handler-alist-save)
(my/restore-gc)
;; (garbage-collect)
(let ((curtime (current-time)))
(message "Times: init:%.06f total:%.06f gc-done:%d"
(float-time (time-subtract after-init-time before-init-time))
(float-time (time-subtract curtime before-init-time))
gcs-done)))
90)
(if (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
(menu-bar-mode -1)
(tooltip-mode -1) ;; Tool tip in the echo
(electric-indent-mode -1)
(provide 'early-init)
;;; early-init.el ends here