-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
144 lines (119 loc) · 3.6 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
;; .emacs.d structure based on https://github.com/magnars/.emacs.d
;; Set path to dependencies
(setq settings-dir (expand-file-name "settings" user-emacs-directory))
(setq site-lisp-dir (expand-file-name "site-lisp" user-emacs-directory))
;; Set up load path
(add-to-list 'load-path settings-dir)
(add-to-list 'load-path site-lisp-dir)
;; Keep emacs Custom-settings in separate file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)
;; Add external projects to load path
(dolist (project (directory-files site-lisp-dir t "\\w+"))
(when (file-directory-p project)
(add-to-list 'load-path project)))
;; Write all autosave files in the tmp dir
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Don't write lock-files, I'm the only one here
(setq create-lockfiles nil)
;; Make backups of files, even when they're in version control
(setq vc-make-backup-files t)
;; Setup packages
(require 'setup-package)
;; Install extensions if they're missing
(defun init--install-packages ()
(packages-install
'(
anzu
better-defaults
cider
circe
clojure-mode
clojure-mode-extra-font-locking
dash
diminish
dockerfile-mode
expand-region
fennel-mode
flycheck
flycheck-joker
git-timemachine
groovy-mode
inf-clojure
json-reformat
ledger-mode
lua-mode
magit
markdown-mode
multiple-cursors
org
org-roam
paredit
powershell
rainbow-mode
restclient
smex
spacemacs-theme
typescript-mode
undo-tree
virtualenvwrapper
yafolding
yaml-mode
zenburn-theme)))
(condition-case nil
(init--install-packages)
(error
(package-refresh-contents)
(init--install-packages)))
;; Let's start with a smattering of sanity
(require 'better-defaults) ; https://github.com/technomancy/better-defaults
(require 'sane-defaults)
;; Setup extensions
(eval-after-load 'dired '(require 'setup-dired))
(eval-after-load 'ido '(require 'setup-ido))
(eval-after-load 'magit '(require 'setup-magit))
(require 'setup-org)
(require 'setup-paredit)
;; Enable flycheck linting
(add-hook 'after-init-hook #'global-flycheck-mode)
;; Font lock dash.el
(eval-after-load "dash" '(dash-enable-font-lock))
;; Language-specific setup files
(eval-after-load 'python '(require 'setup-python))
(eval-after-load 'csharp-mode '(require 'setup-csharp))
(eval-after-load 'clojure-mode '(require 'setup-clojure))
(eval-after-load 'css-mode '(require 'setup-css))
(eval-after-load 'js '(require 'setup-javascript))
;; Load stuff on demand
(eval-after-load 'flycheck '(require 'setup-flycheck))
;; Map files to modes
(require 'mode-mappings)
;; Functions (load all files in defuns-dir)
(setq defuns-dir (expand-file-name "defuns" user-emacs-directory))
(dolist (file (directory-files defuns-dir t "\\w+"))
(when (file-regular-p file)
(load file)))
;; Smart M-x is smart
(smex-initialize)
;; Anzu shows isearch match count
(require 'anzu)
(global-anzu-mode)
;; Setup key mappings
(require 'key-bindings)
;; Misc
(require 'appearance)
(require 'miscellaneous)
(when (equal system-type 'gnu/linux) (require 'linux))
(when (equal system-type 'windows-nt) (require 'windows))
;; Emacs server
(require 'server)
(unless (server-running-p)
(server-start))
;; Run at full power
(put 'downcase-region 'disabled nil)
(put 'narrow-to-region 'disabled nil)
;; Load 'expat' settings from outside .emacs.d (credentials, etc.)
(setq expat-settings-dir "~/.emacs-expat/")
(when (file-exists-p expat-settings-dir)
(mapc 'load (directory-files expat-settings-dir t "^[^#].*el$")))