summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2020-08-29 18:19:30 -0500
committerCase Duckworth2020-08-29 18:19:30 -0500
commitffaddcf06601c52194861176c91c56912b1a7795 (patch)
treeba426fec36e8d623d3555b41e2e721bf87f46d4f
downloademacs-ffaddcf06601c52194861176c91c56912b1a7795.tar.gz
emacs-ffaddcf06601c52194861176c91c56912b1a7795.zip
Add init.el
-rw-r--r--init.el373
1 files changed, 373 insertions, 0 deletions
diff --git a/init.el b/init.el new file mode 100644 index 0000000..53deb3f --- /dev/null +++ b/init.el
@@ -0,0 +1,373 @@
1;; init.el ~ acdw
2
3(server-start)
4(setq custom-file (concat user-emacs-directory "custom.el"))
5
6;;; bootstrap packages
7(require 'package)
8(setq package-user-dir (concat user-emacs-directory "elpa"))
9(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
10(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
11(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/"))
12(unless package--initialized (package-initialize))
13;; bootstrap quelpa
14(unless (package-installed-p 'quelpa)
15 (with-temp-buffer
16 (url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el")
17 (eval-buffer)
18 (quelpa-self-upgrade)))
19;; quelpa config
20(setq quelpa-git-clone-depth nil)
21;; quelpa-use-package
22(quelpa
23 '(quelpa-use-package
24 :fetcher git
25 :url "https://github.com/quelpa/quelpa-use-package.git"))
26(require 'quelpa-use-package)
27
28;;; packages
29;; use-package helpers
30(use-package use-package-ensure-system-package
31 :ensure)
32
33;; emacs
34(use-package emacs
35 :custom
36 (user-full-name "Case Duckworth")
37 (user-mail-address "acdw@acdw.net")
38 (inhibit-startup-screen t)
39 (initial-scratch-message "")
40 (visible-bell nil)
41 (frame-title-format
42 '((:eval (if (buffer-file-name)
43 (abbreviate-file-name (buffer-file-name))
44 "%b"))))
45 (display-time-format " %H:%M ")
46 (display-time-default-load-average nil)
47 (show-paren-style 'mixed)
48 (backup-directory-alist
49 `((".*" . ,(concat user-emacs-directory "saves/"))))
50 (delete-old-versions t)
51 (kept-new-versions 10)
52 (kept-old-versions 10)
53 (version-control t)
54 (auto-save-file-name-transforms
55 `((".*" ,(concat user-emacs-directory "saves/") t)))
56 (create-lockfiles nil)
57 (scroll-conservatively 100)
58 (calendar-latitude 30.39)
59 (calendar-longitude -91.83)
60 (show-paren-style 'mixed)
61 :config
62 (display-time-mode 1)
63 (line-number-mode 1)
64 (column-number-mode 1)
65 (blink-cursor-mode 0)
66 (delete-selection-mode 1)
67 (global-auto-revert-mode t)
68 (prefer-coding-system 'utf-8)
69 (set-default-coding-systems 'utf-8)
70 (set-terminal-coding-system 'utf-8)
71 (set-keyboard-coding-system 'utf-8)
72 (fset 'yes-or-no-p 'y-or-n-p)
73 (global-prettify-symbols-mode t)
74 (menu-bar-mode -1)
75 (tool-bar-mode -1)
76 (scroll-bar-mode -1)
77 (fringe-mode 1)
78 (show-paren-mode 1)
79 :hook
80 ((beforpe-save . delete-trailing-whitespace)
81 (prog-mode . (lambda ()
82 (if (and (fboundp 'display-line-numbers-mode)
83 (display-graphic-p))
84 #'display-line-numbers-mode
85 #'linum-mode))))
86 :bind
87 (("C-z" . nil)))
88
89;; delight
90(use-package delight
91 :ensure)
92
93;; modeline
94(use-package all-the-icons
95 :ensure
96 :config
97 (set-face-attribute 'mode-line nil :height 100)
98 (set-face-attribute 'mode-line-inactive nil :height 100)
99 :custom
100 (all-the-icons-scale-factor 1.0))
101
102(use-package doom-modeline
103 :ensure
104 :custom
105 (doom-modeline-height 16)
106 (doom-modeline-enable-word-count t)
107 (doom-modeline-mu4e t)
108 (doom-modeline-gnus nil)
109 (doom-modeline-irc t)
110 :config
111 (doom-modeline-mode t))
112
113;; themes
114(use-package modus-operandi-theme
115 :if window-system
116 :ensure
117 :custom
118 (modus-operandi-theme-slanted-constructs t)
119 (modus-operandi-theme-bold-constructs t)
120 (modus-operandi-theme-3d-modeline t)
121 :config
122 (load-theme 'modus-operandi t t)
123 (run-at-time (nth 1 (split-string (sunrise-sunset)))
124 (* 60 60 24)
125 (lambda () (enable-theme 'modus-operandi))))
126
127(use-package modus-vivendi-theme
128 :if window-system
129 :ensure
130 :custom
131 (modus-vivendi-theme-slanted-constructs t)
132 (modus-vivendi-theme-bold-constructs t)
133 (modus-vivendi-theme-3d-modeline t)
134 :config
135 (load-theme 'modus-vivendi t t)
136 (run-at-time (nth 4 (split-string (sunrise-sunset)))
137 (* 60 60 24)
138 (lambda () (enable-theme 'modus-vivendi))))
139
140;; minibuffer completion
141(use-package ivy
142 :ensure
143 :delight
144 :custom
145 (ivy-use-virtual-buffers t)
146 (ivy-wrap t)
147 (ivy-count-format "(%d/%d) ")
148 (enable-recursive-minibuffers t)
149 :config
150 (ivy-mode 1))
151
152(use-package swiper
153 :ensure
154 :delight
155 :bind ("C-s" . swiper-isearch))
156
157(use-package counsel
158 :ensure
159 :delight
160 :config
161 (counsel-mode 1))
162
163(use-package ivy-rich
164 :ensure
165 :after (ivy)
166 :config
167 (ivy-rich-mode 1)
168 (setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line))
169
170(use-package savehist
171 :ensure
172 :config
173 (savehist-mode 1))
174
175(use-package ivy-dired-history
176 :after (ivy)
177 :config
178 (add-to-list 'savehist-additional-variables 'ivy-dired-history-variable))
179
180;; completion
181(use-package company
182 :ensure
183 :delight
184 :custom
185 (company-idle-delay 0.2)
186 :hook
187 (after-init . global-company-mode))
188
189;; undo
190(use-package undo-tree
191 :ensure
192 :config
193 (global-undo-tree-mode))
194
195;; git
196(use-package magit
197 :ensure
198 :custom
199 (magit-push-always-verify nil)
200 (git-commit-summary-max-length 50)
201 :bind
202 ("M-g" . magit-status))
203
204;; irc
205(defun my/fetch-password (&rest params)
206 "fetch a password from auth-sources"
207 (require 'auth-source)
208 (let ((match (car (apply 'auth-source-search params))))
209 (if match
210 (let ((secret (plist-get match :secret)))
211 (if (functionp secret)
212 (funcall secret)
213 secret))
214 (error "Password not found for %S" params))))
215
216(defun my/sasl-password (nick server)
217 "fetch an sasl password for $server"
218 (my/fetch-password :user nick :host server))
219
220(use-package circe
221 :ensure
222 :custom
223 (circe-network-options
224 `(("Freenode"
225 :tls t
226 :port 6697
227 :nick "acdw"
228 :sasl-username "acdw"
229 :sasl-password ,(my/sasl-password "acdw" "irc.freenode.net")
230 :channels ("#emacs" "#emacs-circe" "#daydreams"))
231 ("Tilde.chat"
232 :tls t
233 :port 6697
234 :nick "acdw"
235 :sasl-username "acdw"
236 :sasl-password ,(my/sasl-password "acdw" "irc.tilde.chat")
237 :channels ("#gemini" "#meta"))))
238 :custom-face
239 (circe-my-message-face ((t (:foreground "dark violet")))))
240
241
242;; mail
243(use-package mu4e
244 :ensure-system-package mu ; TODO ensure mu4e is also installed
245 :load-path "/usr/share/emacs/site-lisp/mu4e"
246 :custom
247 (mu4e-headers-skip-duplicates t)
248 (mu4e-view-show-images t)
249 (mu4e-view-show-addresses t)
250 (mu4e-compose-format-flowed t)
251 (mu4e-date-format "%Y-%m-%d")
252 (mu4e-headers-date-format "%Y-%m-%d")
253 (mu4e-change-filenames-when-moving t)
254 (mu4e-attachments-dir "~/Downloads")
255 (message-kill-buffer-on-exit t)
256 (mu4e-update-interval (* 60 60))
257 (mu4e-maildir "~/Mail/fastmail")
258 (mu4e-refile-folder "/Archive")
259 (mu4e-sent-folder "/Sent")
260 (mu4e-drafts-folder "/Drafts")
261 (mu4e-trash-folder "/Trash")
262 (message-send-mail-function 'smtpmail-send-it)
263 (smtpmail-default-smtp-server "smtp.fastmail.com")
264 (smtpmail-smtp-server "smtp.fastmail.com")
265 (smtpmail-smtp-service 465)
266 (smtpmail-stream-type 'ssl)
267 :config
268 (fset 'my-move-to-trash "mTrash")
269 (define-key mu4e-headers-mode-map (kbd "d") 'my-move-to-trash)
270 (define-key mu4e-view-mode-map (kbd "d") 'my-move-to-trash))
271
272;; gemini/gopher
273(use-package elpher
274 :quelpa
275 (elpher
276 :fetcher git
277 :url "git://thelambdalab.xyz/elpher.git"))
278
279(use-package visual-fill-column
280 :ensure)
281
282(use-package gemini-mode
283 :after visual-fill-column
284 :quelpa
285 (gemini-mode
286 :fetcher git
287 :url "https://git.carcosa.net/jmcbray/gemini.el.git"))
288
289(use-package gemini-write
290 :after gemini-mode
291 :quelpa
292 (gemini-write
293 :fetcher git
294 :url "https://alexschroeder.ch/cgit/gemini-write"))
295
296;; window manager
297(use-package exwm
298 :ensure
299 :demand
300 :custom
301 (exwm-layout-show-all-buffers t)
302 (mouse-autoselect-window t)
303 (focus-follows-mouse t)
304 (exwm-workspace-number 1)
305 (exwm-input-global-keys
306 `(
307 ([?\s-r] . exwm-reset)
308 ([?\s-w] . exwm-workspace-switch)
309 ([?\s-&] . (lambda (command)
310 (interactive (list (read-shell-command "$ ")))
311 (start-process-shell-command command nil command)))
312 ,@(mapcar (lambda (i)
313 `(,(kbd (format "s-%d" i)) .
314 (lambda ()
315 (interactive)
316 (exwm-workspace-switch-create ,i))))
317 (number-sequence 0 9))))
318 (exwm-input-simulation-keys
319 '(([?\C-b] . [left])
320 ([?\C-f] . [right])
321 ([?\C-p] . [up])
322 ([?\C-n] . [down])
323 ([?\C-a] . [home])
324 ([?\C-e] . [end])
325 ([?\M-v] . [prior])
326 ([?\C-v] . [next])
327 ([?\C-d] . [delete])
328 ([?\C-k] . [S-end delete])))
329 :hook
330 ((exwm-update-class .
331 (lambda () "Rename buffer to window's class name"
332 (exwm-workspace-rename-buffer exwm-class-name)))
333 (exwm-update-title .
334 (lambda () "Update workspace name to window title"
335 (when (not exwm-instance-name)
336 (exwm-workspace-rename-buffer exwm-title))))
337 (exwm-manage-finish .
338 (lambda () "Disable simulation keys for Firefox"
339 (when (and exwm-class-name
340 (string= exwm-class-name "Firefox"))
341 (exwm-input-set-local-simulation-keys nil)))))
342 :config
343 (exwm-enable)
344 (require 'exwm-systemtray)
345 (exwm-systemtray-enable))
346
347(use-package exwm-mff
348 :ensure
349 :hook (exwm-init . exwm-mff-mode))
350
351(use-package exwm-edit
352 :ensure)
353
354(use-package desktop-environment
355 :ensure
356 :hook (exwm-init . desktop-environment-mode)
357 :custom
358 (desktop-environment-update-exwm-global-keys :global)
359 (desktop-environment-brightness-get-command "light")
360 (desktop-environment-brightness-set-command "light %s")
361 (desktop-environment-brightness-get-regexp "^\\([0-9]+\\)")
362 (desktop-environment-brightness-normal-increment "-A 10")
363 (desktop-environment-brightness-normal-decrement "-U 10")
364 (desktop-environment-brightness-small-increment "-A 5")
365 (desktop-environment-brightness-small-decrement "-U 5")
366 (desktop-environment-volume-get-command "pavolume get")
367 (desktop-environment-volume-set-command "pavolume %s")
368 (desktop-environment-volume-toggle-command "pavolume mute toggle")
369 (desktop-environment-volume-get-regexp "^\\([0-9]+\\)")
370 (desktop-environment-volume-normal-increment "inc 10")
371 (desktop-environment-volume-normal-decrement "dec 10")
372 (desktop-environment-volume-small-increment "inc 5")
373 (desktop-environment-volume-small-decrement "dec 5"))