-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
100 lines (76 loc) · 3.01 KB
/
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
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
;;; init.el --- Emacs config entry -*- lexical-binding: t; -*-
;;
;;; Commentary:
;;; License: MIT
;;; Code:
(setq-default user-full-name "Inge Jørgensen"
user-mail-address "[email protected]")
;;-----------------------------------------------------------------------------
;; Startup
;;-----------------------------------------------------------------------------
(add-hook 'emacs-startup-hook
(lambda ()
(message "Emacs started in %s with %d garbage collections."
(format "%.2fs seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done)))
(setq load-prefer-newer t
large-file-warning-threshold 100000000)
;;-----------------------------------------------------------------------------
;; Packages and paths
;;-----------------------------------------------------------------------------
;; Initialize elpaca
(require 'nyx-elpaca (concat user-emacs-directory "nyx-elpaca.el"))
;; Configure use-package
(require 'use-package)
(setq use-package-compute-statistics t)
;; Keep .emacs.d clean
(use-package no-littering
:ensure (:wait t)
:demand t)
;; Enable auto-compile
(use-package auto-compile
:ensure (:wait t)
:init
(setq auto-compile-display-buffer nil)
(setq auto-compile-mode-line-counter t)
:config
(auto-compile-on-load-mode)
(auto-compile-on-save-mode))
;; Required third-party packages
(use-package dash
:ensure (:wait t)
:demand t)
;;-----------------------------------------------------------------------------
;; Server
;;-----------------------------------------------------------------------------
;; Automatically start server
(require 'server)
(setq server-port 12345)
(unless (server-running-p) (server-start))
;;-----------------------------------------------------------------------------
;; Load configuration
;;-----------------------------------------------------------------------------
(defun init-dirs (dirs)
"Add DIRS to load path, then require all files within."
(let ((paths (mapcar (lambda (dir) (expand-file-name dir user-emacs-directory)) dirs)))
(mapc (lambda (path) (add-to-list 'load-path path)) paths)
(mapc (lambda (path)
(mapc (lambda (file)
(require (intern (file-name-sans-extension file))))
(directory-files path nil "\\.elc?$"))) paths)))
(defun init-all-dirs (dirname)
"Run init-dirs on all subdirs in DIRNAME."
(let* ((dir (expand-file-name dirname user-emacs-directory))
(subdirs (cl-remove-if-not #'file-directory-p (directory-files dir t "^[^.]")))
(relative-dirs (mapcar
(lambda (d) (concat dirname "/" (file-name-nondirectory d)))
subdirs)))
(init-dirs relative-dirs)))
(init-all-dirs "modules")
;; Load custom settings
(setq custom-file (no-littering-expand-etc-file-name "custom.el"))
(load custom-file)
(setq gc-cons-threshold (* 16 1024 1024)) ;; 16mb
;;; init.el ends here