-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
161 lines (132 loc) · 4.92 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
;;; init.el --- Startup file for Emacs. -*- lexical-binding: t; -*-
;-; Copyright (C) 2016 Chris Barrett
;; Author: Chris Barrett <chris+emacs@walrus.cool>
;;; Commentary:
;; Declares some variables and bootstraps the rest of the configuration.
;;
;; One main difference from other configurations out there is that I use git subtrees for
;; many core packages, instead of relying on the Emacs package manager.
;;; Code:
(setq user-init-file (or load-file-name (buffer-file-name)))
(setq user-emacs-directory (file-name-directory user-init-file))
(setq gc-cons-threshold (* 800 1024))
(defconst emacs-start-time (current-time))
(unless noninteractive
(message "Loading %s..." load-file-name))
;; Initialize package.el
;;
;; Most packages are installed using git subtrees, but some packages (such as
;; flycheck) break unless installed via package.el.
(require 'package)
(add-to-list 'package-archives '("MELPA Stable" . "https://stable.melpa.org/packages/"))
(add-to-list 'package-archives '("MELPA" . "https://melpa.org/packages/"))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
;; Bootstrap use-package.
(require 'seq)
(require 'subr-x)
(defun x-init/init-load-path (&optional interactive-p)
"Add select subdirs of `user-emacs-directory' to the `load-path'.
If argument INTERACTIVE-P is set, log additional information."
(interactive "p")
(let* ((before load-path)
(lisp-dir (expand-file-name "lisp" user-emacs-directory))
(config-dir (expand-file-name "config" user-emacs-directory))
(git-subtrees
(seq-filter #'file-directory-p
(directory-files lisp-dir t "^[^.]")))
(config-subtrees
(seq-filter #'file-directory-p
(directory-files config-dir t "^[^.]"))))
(dolist (path (append (list lisp-dir config-dir) config-subtrees git-subtrees))
(add-to-list 'load-path path)
(add-to-list 'Info-default-directory-list path)
(add-to-list 'load-path (concat path "/emacs"))
(add-to-list 'load-path (concat path "/elisp"))
(add-to-list 'load-path (concat path "/lisp")))
;; TODO
;; (add-to-list 'load-path (concat lisp-dir "/org-mode/contrib/lisp"))
(add-to-list 'load-path (concat lisp-dir "/gocode/emacs-company"))
(add-to-list 'load-path (concat lisp-dir "/expanderr/lisp/go-expanderr.el"))
(setq load-path (seq-filter #'file-directory-p load-path))
(setq Info-default-directory-list (seq-filter #'file-directory-p Info-default-directory-list))
(when interactive-p
(if-let (added (seq-difference load-path before))
(message "Load path updated. Added: %S" added)
(message "No change to load-path")))))
(x-init/init-load-path)
(defconst use-package-verbose t)
(require 'use-package)
;; Load features
(use-package x-emacs)
(use-package x-darwin :if (equal system-type 'darwin))
(use-package x-basic-settings)
(use-package x-leader-keys)
(use-package x-evil)
(use-package x-ivy)
(use-package x-rg)
(use-package x-projectile)
(use-package x-elisp)
(use-package x-modeline)
(use-package x-company)
(use-package x-autoinsert)
(use-package x-faces)
(use-package x-smartparens)
(use-package x-flycheck)
(use-package x-magit)
(use-package x-avy)
(use-package x-yasnippet)
(use-package x-dired)
(use-package x-undo-tree)
(use-package x-ws-butler)
(use-package x-parentheses)
(use-package x-aggressive-indent)
(use-package x-ibuffer)
(use-package x-markdown)
(use-package x-go)
(use-package x-web-mode)
;; (use-package x-kubernetes)
;; (use-package cb-auto-save)
;; (use-package cb-server)
;; (use-package cb-hexl)
;; (use-package cb-volatile-highlights)
;; (use-package cb-info)
;; (use-package cb-highlight-todo)
;; (use-package cb-neotree)
;; (use-package cb-mu4e)
;; (use-package cb-ahs)
;; (use-package cb-org)
;; (use-package cb-ledger)
;; (use-package cb-scala)
;; (use-package cb-groovy)
;; (use-package cb-rust)
;; (use-package cb-yaml)
;; (use-package cb-spelling)
;; (use-package cb-diff)
;; (use-package cb-coffeescript)
;; (use-package cb-web-mode)
;; (use-package cb-apidoc)
;; (use-package cb-restclient)
;; (use-package cb-calc)
;; (use-package cb-haskell)
;; (use-package cb-shell)
;; (use-package cb-csv)
;; (use-package cb-highlight-thing)
;; (use-package cb-idris)
;; (use-package cb-docker)
;; (use-package personal-config
;; :load-path "~/Sync/emacs")
;;; Print overall startup time.
(unless noninteractive
(let ((elapsed (float-time (time-subtract (current-time) emacs-start-time))))
(message "Loading %s...done (%.3fs)" load-file-name elapsed))
(add-hook 'after-init-hook
`(lambda ()
(let ((elapsed (float-time (time-subtract (current-time)
emacs-start-time))))
(message "Loading %s...done (%.3fs) [after-init]"
,load-file-name elapsed)))
t))
(provide 'init)
;;; init.el ends here