-
Notifications
You must be signed in to change notification settings - Fork 17
/
early-init.el
69 lines (56 loc) · 2.77 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
63
64
65
66
67
68
69
;;; early-init.el --- MinEmacs early initialization tweaks -*- lexical-binding: t; -*-
;; Copyright (C) 2022-2024 Abdelhak Bougouffa
;; Author: Abdelhak Bougouffa (rot13 "[email protected]")
;;; Commentary:
;;; Code:
(setq
;; Do not make installed packages available when Emacs starts (we use `straight')
package-enable-at-startup nil
;; Avoid garbage collections during startup, this will be overwritten by `+minemacs--gc-tweaks-h'
gc-cons-threshold most-positive-fixnum
;; Prefer loading newer files
load-prefer-newer t
;; Remove some unneeded UI elements
default-frame-alist '((tool-bar-lines . 0)
(menu-bar-lines . 0)
(vertical-scroll-bars)
(left-fringe . 8)
(right-fringe . 13)
(internal-border-width . 15)
(mouse-color . "blue")
(fullscreen . maximized))
;; Explicitly set modes disabled in `default-frame-alist' to nil
tool-bar-mode nil
menu-bar-mode nil
scroll-bar-mode nil
;; Set mode-line format to prevent it from showing at startup
mode-line-format nil)
;; It seems like, even when `tool-bar-mode' is nil, `tool-bar-setup' still be called
(advice-add 'tool-bar-setup :override #'ignore)
;; We restore it after starting Emacs so the user can manually enable the `tool-bar'
(add-hook
'emacs-startup-hook
(lambda ()
(advice-remove 'tool-bar-setup #'ignore) ; Remove the advice so the toolbar can be enabled
(when tool-bar-mode (tool-bar-setup)))) ; Ensure running it if toolbar is enabled
;; Frames can have a transparent background via the `alpha-background'
;; parameter. For better experience, this value should be set early before any
;; frame gets created (i.e. in "early-init.el"). MinEmacs uses the
;; `$MINEMACS_ALPHA` environment variable that can be set to an integer value in
;; the [1-100] range. When this variable is set but the value is not valid,
;; MinEmacs will fallback to the default alpha of 93%.
(when-let* ((alpha (getenv "MINEMACS_ALPHA"))
(alpha (string-to-number alpha)))
(push `(alpha-background . ,(if (or (zerop alpha) (> alpha 100)) 93 alpha)) default-frame-alist))
;; Load MinEmacs variables and basic from the `me-vars' core module.
(add-to-list 'load-path (expand-file-name "core" (file-name-directory (file-truename load-file-name))))
(require 'me-vars)
(require 'me-lib)
(when (color-defined-p (+deserialize-sym 'minemacs--background-color nil t))
(push `(background-color . ,minemacs--background-color) default-frame-alist))
;; Better titlebar on MacOS!
(when (featurep 'ns)
(push '(ns-transparent-titlebar . t) default-frame-alist))
;; Load the user early configuration files
(+load-user-configs 'early-config 'local/early-config)
;;; early-init.el ends here