summary refs log tree commit diff
path: root/emacs/init.el
blob: 1c575b38d2dfceae1b8dac56da69daddb3a283d0 (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
90
91
92
93
94
95
96
97
98
99
100
101
;;; init.el --- Initialize my Emacs configuration
;;; Commentary:

;;; Code:

(setq gc-cons-threshold 64000000)
(add-hook 'after-init-hook #'(lambda ()
                               ;; restore after startup
                               (setq gc-cons-threshold 800000)))

(require 'package)

(add-to-list 'package-archives
	     '("melpa" .
	       "https://melpa.org/packages/"))

(defvar my/package-list '(chef-mode
                          dockerfile-mode
                          eglot
                          exec-path-from-shell
                          go-mode
                          gotest
                          hcl-mode
                          jq-format
                          magit
                          git-modes
                          git-commit
                          git-link
                          markdown-mode
                          nix-mode
                          notmuch
                          protobuf-mode
                          systemd
                          terraform-doc
                          terraform-mode
                          use-package
                          yaml-mode
                          yasnippet)
  "List of packages to be installed.")

(defun my/packages-installed-p ()
  "Check if all packages in `my/package-list' are installed."
  (cl-every #'package-installed-p my/package-list))

(defun my/require-package (package)
  "Install PACKAGE unless already installed."
  (unless (memq package my/package-list)
    (add-to-list 'my/package-list package))
  (unless (package-installed-p package)
    (package-install package)))

(defun my/require-packages (packages)
  "Ensure PACKAGES are installed.
Missing packages are installed automatically."
  (mapc #'my/require-package packages))

(defun my/install-packages ()
  "Install all packages listed in `my/package-list'."
  (unless (my/packages-installed-p)
    ;; check for new packages (package versions)
    (message "%s" "Reloading packages DB...")
    (package-refresh-contents)
    (message "%s" " done.")
    ;; install the missing packages
    (my/require-packages my/package-list)))

;; run package installation
(my/install-packages)

(eval-when-compile (require 'use-package))

(setq use-package-verbose t)
(setq use-package-always-ensure nil)

(add-to-list 'load-path (expand-file-name "custom/" user-emacs-directory))
(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory))

(require 'my-settings)
(require 'my-ui)
(require 'my-dired)
(require 'my-navigation)
(require 'my-completion)
(require 'my-edit)
(require 'my-text)
(require 'my-git)
(require 'my-org)
(require 'my-conf)
(require 'my-prog)
(require 'my-eshell)
(require 'my-tramp)
(require 'my-notmuch)
(require 'my-elfeed)

(require 'my-buffers)
(require 'my-git-extra)
(require 'my-strings)
(require 'my-web)
(require 'my-work)
(require 'my-packages-extra)

;;; init.el ends here