aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/early-init.el
blob: 9d4ce2ccb3f26af19758f0d77efdfeb2830c795a (plain)
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
;; I don't use any of these
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

;; Do not resize when font size changes
(setq frame-resize-pixelwise t)

;; By default, start maximized, undecorated
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(add-to-list 'default-frame-alist '(undecorated . t))

;; Extend this list from to add more startup frames.
(defvar rul-startup-frames
  '(("main" . nil)
    ("terminals" . multi-vterm))
  "Startup frame specifications.
Each entry has the form (NAME . SETUP).  NAME is the frame name.
SETUP is an optional function or interactive command called in that frame.")

(defun rul-run-startup-frame-setup (setup)
  "Run startup frame SETUP."
  (cond
   ((null setup) nil)
   ((commandp setup) (call-interactively setup))
   ((functionp setup) (funcall setup))
   (t (message "Ignoring invalid startup frame setup: %S" setup))))

(defun rul-apply-startup-frame-name (frame name)
  "Set FRAME name and title to NAME."
  (with-selected-frame frame
    (set-frame-name name)
    (modify-frame-parameters frame `((title . ,name)))))

(defun rul-create-startup-frames ()
  "Create the configured startup frames."
  (when (display-graphic-p)
    (let ((initial-frame (selected-frame))
          (specs rul-startup-frames))
      (when specs
        (pcase-let ((`(,name . ,setup) (car specs)))
          (rul-apply-startup-frame-name initial-frame name)
          (with-selected-frame initial-frame
            (rul-run-startup-frame-setup setup)))
        (dolist (spec (cdr specs))
          (pcase-let ((`(,name . ,setup) spec))
            (let ((frame (make-frame `((name . ,name)
                                       (title . ,name)))))
              (rul-apply-startup-frame-name frame name)
              (with-selected-frame frame
                (rul-run-startup-frame-setup setup)))))
        (select-frame initial-frame)))))

(add-hook 'emacs-startup-hook #'rul-create-startup-frames)

;; Initialise installed packages, otherwise, basic functions are not
;; available during the initialization stage.
(setq package-enable-at-startup t)

;; Do not report warnings. It's too noisy.
(setq native-comp-async-report-warnings-errors 'silent)

;; Keep things minimal
(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message user-login-name)
nihil fit ex nihilo