summaryrefslogtreecommitdiff
path: root/lisp/td-theme.el
blob: b2640d9f8291c711cab05d0e4ffc3ba483b28097 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;;; td-theme.el --- emacs appearance -*- lexical-binding: t; -*-

;;; Code:

;;; Functions

(defun td/set-font ()
  (when (display-graphic-p)
    (message "Setting font...")
    (set-face-attribute 'default nil
                        :font "Aporetic Sans Mono"
                        :weight 'normal
                        :height 200)
    (set-face-attribute 'fixed-pitch nil
                        :font "Aporetic Sans Mono"
                        :weight 'normal
                        :height 200)
    (set-face-attribute 'variable-pitch nil
                        :font "Aporetic Sans Mono"
                        :weight 'normal
                        :height 200)))

(defun td/disable-theme ()
  "Disable all currently enabled themes."
  (interactive)
  (dolist (theme custom-enabled-themes)
    (disable-theme theme)))

(defun td/toggle-theme ()
  "Toggle between light and dark modes."
  (interactive)
  (let ((theme (if (eq (car custom-enabled-themes) 'ef-dark)
                   'ef-day
                 'ef-dark)))
    (td/disable-theme)
    (load-theme theme t)))

(defun td/display-startup-time ()
    (message (if (daemonp)
                 "emacs daemon loaded in %s with %d garbage collections."
               "emacs loaded in %s with %d garbage collections.")
             (format "%.2f seconds"
                     (float-time
                      (time-subtract after-init-time before-init-time)))
             gcs-done))

;;; Packages

(use-package doom-modeline
  :ensure t
  :init
  (doom-modeline-mode 1)
  :custom
  (doom-modeline-height 10)
  (doom-modeline-buffer-encoding nil)
  (doom-modeline-modal-icon nil))

(use-package ef-themes
  :ensure t
  :config
  ;; By default start with a light theme.
  (load-theme 'ef-day t))

(use-package emacs
  :ensure nil
  :config
  (add-hook 'emacs-startup-hook #'td/display-startup-time)

  ;; Fix font issues when opening a client window.
  (if (daemonp)
      (add-hook 'after-make-frame-functions (lambda (frame)
                                              (with-selected-frame frame
                                                (td/set-font))))
    (td/set-font))

  ;; Disable line numbers for some modes.
  (dolist (mode '(eat-mode-hook
                  eshell-mode-hook
                  dired-mode-hook
                  olivetti-mode-hook
                  org-mode-hook
                  shell-mode-hook
                  term-mode-hook
                  vterm-mode-hook))
    (add-hook mode (lambda ()
                     (display-line-numbers-mode 0))))

  ;; Prettify the lambda symbol.
  (dolist (mode '(emacs-lisp-mode-hook
                  lisp-mode-hook
                  scheme-mode-hook))
    (add-hook mode 'prettify-symbols-mode)))

(provide 'td-theme)
;;; td-theme.el ends here