summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el472
1 files changed, 209 insertions, 263 deletions
diff --git a/init.el b/init.el index a97ac16..5b6b72c 100644 --- a/init.el +++ b/init.el
@@ -1,8 +1,90 @@
1;; init.el ~ acdw 1;; init.el ~ acdw -*- lexical-binding: t -*-
2 2
3(setq custom-file (concat user-emacs-directory "custom.el")) 3(setq gc-cons-threshold (* 256 1024 1024))
4(defvar file-name-handler-alist-old file-name-handler-alist)
5(setq file-name-handler-alist nil)
6(setq message-log-max 16384)
7(setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local))
8;; post-init
9(add-hook 'after-init-hook
10 (lambda ()
11 (setq file-name-handler-alist file-name-handler-alist-old)
12 (setq gc-cons-threshold (* 32 1024 1024)))
13 t)
14
15(unless (display-graphic-p)
16 (tool-bar-mode -1)
17 (menu-bar-mode -1))
18(scroll-bar-mode -1)
19(fringe-mode '(7 . 1))
20
21(setq inhibit-startup-buffer-menu t)
22(setq inhibit-startup-screen t)
23(setq inhibit-startup-echo-area-message "acdw")
24(setq initial-buffer-choice t)
25(setq initial-scratch-message nil)
26
27(server-start)
28
29(setq confirm-kill-processes nil)
30
31(setq user-full-name "Case Duckworth")
32(setq user-mail-address "acdw@acdw.net")
33(setq calendar-location-name "Baton Rouge, LA")
34(setq calendar-latitude 30.39)
35(setq calendar-longitude -91.83)
36
37(setq show-paren-style 'mixed)
38(show-paren-mode 1)
39
40(setq backup-directory-alist
41 `((".*" . ,(concat user-emacs-directory "saves/"))))
42(setq delete-old-versions t)
43(setq kept-new-versions 6)
44(setq kept-old-versions 4)
45(setq version-control t)
46
47(setq auto-save-file-name-transforms
48 `((".*" ,(concat user-emacs-directory "saves/") t)))
49(auto-save-mode 1)
50
51(defun full-auto-save ()
52 (interactive)
53 (save-excursion
54 (dolist (buf (buffer-list))
55 (set-buffer buf)
56 (if (and (buffer-file-name) (buffer-modified-p))
57 (basic-save-buffer)))))
58(add-hook 'auto-save-hook 'full-auto-save)
59(add-hook 'focus-out-hook 'full-auto-save) ;; this might be resource intensive?
60
61(setq save-place-file (expand-file-name "places" user-emacs-directory))
62(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
63
64(blink-cursor-mode 0)
65
66(prefer-coding-system 'utf-8)
67(set-default-coding-systems 'utf-8)
68(set-terminal-coding-system 'utf-8)
69(set-keyboard-coding-system 'utf-8)
70(fset 'yes-or-no-p 'y-or-n-p)
71(global-prettify-symbols-mode t)
72
73(save-place-mode 1)
74
75(global-visual-line-mode 1)
76(delight 'global-visual-line-mode)
77
78(display-battery-mode 1)
79(display-time-mode 1)
80
81(add-hook 'before-save-hook #'delete-trailing-whitespace)
82(add-hook 'prog-mode-hook (lambda ()
83 (if (and (fboundp 'display-line-numbers-mode)
84 (display-graphic-p))
85 #'display-line-numbers-mode
86 #'linum-mode)))
4 87
5;;; bootstrap packages
6(require 'package) 88(require 'package)
7(setq package-user-dir (concat user-emacs-directory "elpa")) 89(setq package-user-dir (concat user-emacs-directory "elpa"))
8(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") 90(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
@@ -22,7 +104,9 @@
22 (require 'use-package)) 104 (require 'use-package))
23 105
24(use-package quelpa 106(use-package quelpa
25 :ensure) 107 :ensure
108 :custom
109 (quelpa-git-clone-depth nil))
26 110
27(use-package quelpa-use-package 111(use-package quelpa-use-package
28 :ensure) 112 :ensure)
@@ -32,84 +116,107 @@
32(use-package use-package-ensure-system-package 116(use-package use-package-ensure-system-package
33 :ensure) 117 :ensure)
34 118
35;; emacs 119(use-package delight
36(use-package emacs
37 :custom
38 (user-full-name "Case Duckworth")
39 (user-mail-address "acdw@acdw.net")
40 (inhibit-startup-screen t)
41 (initial-scratch-message "")
42 (visible-bell nil)
43 (frame-title-format
44 '((:eval (if (buffer-file-name)
45 (abbreviate-file-name (buffer-file-name))
46 "%b"))))
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-location-name "Baton Rouge, LA")
59 (calendar-latitude 30.39)
60 (calendar-longitude -91.83)
61 (show-paren-style 'mixed)
62 (save-place-file (expand-file-name "places" user-emacs-directory))
63 :config
64 (blink-cursor-mode 0)
65 (delete-selection-mode 1)
66 (global-auto-revert-mode t)
67 (prefer-coding-system 'utf-8)
68 (set-default-coding-systems 'utf-8)
69 (set-terminal-coding-system 'utf-8)
70 (set-keyboard-coding-system 'utf-8)
71 (fset 'yes-or-no-p 'y-or-n-p)
72 (global-prettify-symbols-mode t)
73 (menu-bar-mode -1)
74 (tool-bar-mode -1)
75 (scroll-bar-mode -1)
76 (fringe-mode 1)
77 (show-paren-mode 1)
78 (global-visual-line-mode 1)
79 (save-place-mode 1)
80 :hook
81 ((beforpe-save . delete-trailing-whitespace)
82 (prog-mode . (lambda ()
83 (if (and (fboundp 'display-line-numbers-mode)
84 (display-graphic-p))
85 #'display-line-numbers-mode
86 #'linum-mode))))
87 :bind
88 (("C-z" . nil)
89 ("M-1" . delete-other-windows)
90 ("M-o" . mode-line-other-buffer)))
91
92;; async
93(use-package async
94 :ensure) 120 :ensure)
95 121
96;; sudo 122;; exwm
97(use-package su 123(use-package exwm
98 :ensure 124 :ensure
125 :demand
126 :custom
127 (exwm-layout-show-all-buffers t)
128 (mouse-autoselect-window t)
129 (exwm-workspace-number 4)
130 (exwm-input-global-keys
131 `(
132 ([?\s-r] . exwm-reset)
133 ([?\s-w] . exwm-workspace-switch)
134 ([?\s-&] . (lambda (command)
135 (interactive (list (read-shell-command "$ ")))
136 (start-process-shell-command command nil command)))
137 ,@(mapcar (lambda (i)
138 `(,(kbd (format "s-%d" i)) .
139 (lambda ()
140 (interactive)
141 (exwm-workspace-switch-create ,i))))
142 (number-sequence 0 9))))
143 (exwm-input-simulation-keys
144 '(([?\C-b] . [left])
145 ([?\M-b] . [C-left])
146 ([?\C-f] . [right])
147 ([?\M-f] . [C-right])
148 ([?\C-p] . [up])
149 ([?\C-n] . [down])
150 ([?\C-a] . [home])
151 ([?\C-e] . [end])
152 ([?\M-v] . [prior])
153 ([?\C-v] . [next])
154 ([?\C-d] . [delete])
155 ([?\C-k] . [S-end delete])
156 ([?\C-s] . [?\C-f])
157 ([?\C-w] . [?\C-x])
158 ([?\M-w] . [?\C-c])
159 ([?\C-y] . [?\C-v])))
160 :hook
161 ((exwm-update-class .
162 (lambda () "Rename buffer to window's class name"
163 (exwm-workspace-rename-buffer exwm-class-name)))
164 (exwm-update-title .
165 (lambda () "Update workspace name to window title"
166 (when (not exwm-instance-name)
167 (exwm-workspace-rename-buffer exwm-title))))
168 (exwm-init .
169 (lambda () "Autostart"
170 (start-process-shell-command "cmst" nil "cmst -m -w 5")
171 (start-process-shell-command "keepassxc" nil "keepassxc")
172 (start-process-shell-command "pa-applet" nil
173 "pa-applet --disable-key-grabbing --disable-notifications"))))
99 :config 174 :config
100 (su-mode 1)) 175 (require 'exwm)
176 (exwm-enable)
177 (require 'exwm-systemtray)
178 (exwm-systemtray-enable))
101 179
102;; delight 180(use-package mini-modeline
103(use-package delight 181 :quelpa (mini-modeline
104 :ensure) 182 :repo "kiennq/emacs-mini-modeline"
183 :fetcher github)
184 :delight
185 :custom
186 (mini-modeline-enhance-viusual t)
187 (mini-modeline-display-gui-line t)
188 (mini-modeline-right-padding 7) ;; characters -- for systemtray
189 :config
190 (mini-modeline-mode t))
105 191
106;; startup buffer 192(use-package desktop-environment
107(use-package dashboard
108 :ensure 193 :ensure
194 :delight
195 :hook (exwm-init . desktop-environment-mode)
109 :custom 196 :custom
110 (initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) 197 (desktop-environment-update-exwm-global-keys :global)
111 :config 198 (desktop-environment-brightness-get-command "light")
112 (dashboard-setup-startup-hook)) 199 (desktop-environment-brightness-set-command "light %s")
200 (desktop-environment-brightness-get-regexp "^\\([0-9]+\\)")
201 (desktop-environment-brightness-normal-increment "-A 10")
202 (desktop-environment-brightness-normal-decrement "-U 10")
203 (desktop-environment-brightness-small-increment "-A 5")
204 (desktop-environment-brightness-small-decrement "-U 5")
205 (desktop-environment-volume-get-command "pavolume get")
206 (desktop-environment-volume-set-command "pavolume %s")
207 (desktop-environment-volume-toggle-command "pavolume mute toggle")
208 (desktop-environment-volume-get-regexp "^\\([0-9]+\\)")
209 (desktop-environment-volume-normal-increment "inc 10")
210 (desktop-environment-volume-normal-decrement "dec 10")
211 (desktop-environment-volume-small-increment "inc 5")
212 (desktop-environment-volume-small-decrement "dec 5"))
213
214(use-package switch-window
215 :ensure
216 :custom
217 (switch-window-shortcut-style 'qwerty)
218 :bind
219 ("M-o" . switch-window))
113 220
114;; modeline 221;; modeline
115(use-package all-the-icons 222(use-package all-the-icons
@@ -120,20 +227,27 @@
120 :custom 227 :custom
121 (all-the-icons-scale-factor 1.0)) 228 (all-the-icons-scale-factor 1.0))
122 229
123(use-package doom-modeline 230;; (use-package doom-modeline
231;; :ensure
232;; :custom
233;; (doom-modeline-height 16)
234;; (doom-modeline-icon nil)
235;; (doom-modeline-enable-word-count t)
236;; (doom-modeline-mu4e t)
237;; (doom-modeline-gnus nil)
238;; (doom-modeline-irc t)
239;; :custom-face
240;; (doom-modeline-vspc-face ((t (:inherit nil))))
241;; :config
242;; (doom-modeline-mode t))
243
244(use-package zoom
124 :ensure 245 :ensure
246 :delight
125 :custom 247 :custom
126 (doom-modeline-height 16) 248 (zoom-size '(0.618 . 0.618))
127 (doom-modeline-enable-word-count t)
128 (doom-modeline-mu4e t)
129 (doom-modeline-gnus nil)
130 (doom-modeline-irc t)
131 :config 249 :config
132 (display-time-mode 1) 250 (zoom-mode 1))
133 (line-number-mode 1)
134 (column-number-mode 1)
135 (display-battery-mode 1)
136 (doom-modeline-mode t))
137 251
138;; themes 252;; themes
139(use-package modus-operandi-theme 253(use-package modus-operandi-theme
@@ -163,15 +277,11 @@
163 (lambda () (enable-theme 'modus-vivendi))) 277 (lambda () (enable-theme 'modus-vivendi)))
164 (run-at-time "12am" (* 60 60 24) (lambda () (enable-theme 'modus-vivendi)))) 278 (run-at-time "12am" (* 60 60 24) (lambda () (enable-theme 'modus-vivendi))))
165 279
166;; dired hacks: https://github.com/Fuco1/dired-hacks 280;; sudo
167(use-package dired-hacks-utils 281(use-package su
168 :ensure)
169
170(use-package dired-subtree
171 :ensure 282 :ensure
172 :bind (:map dired-mode-map 283 :config
173 ("i" . dired-subtree-insert) 284 (su-mode 1))
174 (";" . dired-subtree-remove)))
175 285
176;; minibuffer completion 286;; minibuffer completion
177(use-package ivy 287(use-package ivy
@@ -208,69 +318,7 @@
208 :config 318 :config
209 (savehist-mode 1)) 319 (savehist-mode 1))
210 320
211;; completion 321;; mu4e
212(use-package company
213 :ensure
214 :delight
215 :custom
216 (company-idle-delay 0.2)
217 :hook
218 (after-init . global-company-mode))
219
220;; undo
221(use-package undo-tree
222 :ensure
223 :config
224 (global-undo-tree-mode))
225
226;; git
227(use-package magit
228 :ensure
229 :custom
230 (magit-push-always-verify nil)
231 (git-commit-summary-max-length 50)
232 :bind
233 ("M-g" . magit-status))
234
235;; irc
236(defun my/fetch-password (&rest params)
237 "fetch a password from auth-sources"
238 (require 'auth-source)
239 (let ((match (car (apply 'auth-source-search params))))
240 (if match
241 (let ((secret (plist-get match :secret)))
242 (if (functionp secret)
243 (funcall secret)
244 secret))
245 (error "Password not found for %S" params))))
246
247(defun my/sasl-password (nick server)
248 "fetch an sasl password for $server"
249 (my/fetch-password :user nick :host server))
250
251(use-package circe
252 :ensure
253 :custom
254 (circe-network-options
255 `(("Freenode"
256 :tls t
257 :port 6697
258 :nick "acdw"
259 :sasl-username "acdw"
260 :sasl-password ,(my/sasl-password "acdw" "irc.freenode.net")
261 :channels ("#emacs" "#emacs-circe" "#daydreams"))
262 ("Tilde.chat"
263 :tls t
264 :port 6697
265 :nick "acdw"
266 :sasl-username "acdw"
267 :sasl-password ,(my/sasl-password "acdw" "irc.tilde.chat")
268 :channels ("#gemini" "#meta"))))
269 :custom-face
270 (circe-my-message-face ((t (:foreground "dark violet")))))
271
272
273;; mail
274(use-package mu4e 322(use-package mu4e
275 :ensure-system-package mu ; TODO ensure mu4e is also installed 323 :ensure-system-package mu ; TODO ensure mu4e is also installed
276 :load-path "/usr/share/emacs/site-lisp/mu4e" 324 :load-path "/usr/share/emacs/site-lisp/mu4e"
@@ -302,112 +350,10 @@
302 (define-key mu4e-headers-mode-map (kbd "d") 'my-move-to-trash) 350 (define-key mu4e-headers-mode-map (kbd "d") 'my-move-to-trash)
303 (define-key mu4e-view-mode-map (kbd "d") 'my-move-to-trash)) 351 (define-key mu4e-view-mode-map (kbd "d") 'my-move-to-trash))
304 352
305;; gemini/gopher 353;; try packages out
306(use-package elpher 354(use-package try
307 :quelpa
308 (elpher
309 :fetcher git
310 :url "git://thelambdalab.xyz/elpher.git"))
311
312(use-package visual-fill-column
313 :ensure) 355 :ensure)
314 356
315(use-package gemini-mode 357;; vterm babeee
316 :after visual-fill-column 358(use-package vterm
317 :quelpa
318 (gemini-mode
319 :fetcher git
320 :url "https://git.carcosa.net/jmcbray/gemini.el.git"))
321
322(use-package gemini-write
323 :after gemini-mode
324 :quelpa
325 (gemini-write
326 :fetcher git
327 :url "https://alexschroeder.ch/cgit/gemini-write"))
328
329;; window manager
330(use-package exwm
331 :ensure
332 :demand
333 :custom
334 (exwm-layout-show-all-buffers t)
335 (mouse-autoselect-window t)
336 (focus-follows-mouse t)
337 (exwm-workspace-number 4)
338 (exwm-input-global-keys
339 `(
340 ([?\s-r] . exwm-reset)
341 ([?\s-w] . exwm-workspace-switch)
342 ([?\s-&] . (lambda (command)
343 (interactive (list (read-shell-command "$ ")))
344 (start-process-shell-command command nil command)))
345 ,@(mapcar (lambda (i)
346 `(,(kbd (format "s-%d" i)) .
347 (lambda ()
348 (interactive)
349 (exwm-workspace-switch-create ,i))))
350 (number-sequence 0 9))))
351 (exwm-input-simulation-keys
352 '(([?\C-b] . [left])
353 ([?\C-f] . [right])
354 ([?\C-p] . [up])
355 ([?\C-n] . [down])
356 ([?\C-a] . [home])
357 ([?\C-e] . [end])
358 ([?\M-v] . [prior])
359 ([?\C-v] . [next])
360 ([?\C-d] . [delete])
361 ([?\C-k] . [S-end delete])))
362 :hook
363 ((exwm-update-class .
364 (lambda () "Rename buffer to window's class name"
365 (exwm-workspace-rename-buffer exwm-class-name)))
366 (exwm-update-title .
367 (lambda () "Update workspace name to window title"
368 (when (not exwm-instance-name)
369 (exwm-workspace-rename-buffer exwm-title))))
370 (exwm-manage-finish .
371 (lambda () "Disable simulation keys for Firefox"
372 (when (and exwm-class-name
373 (string= exwm-class-name "Firefox"))
374 (exwm-input-set-local-simulation-keys nil))))
375 (exwm-init .
376 (lambda () "Autostart"
377 (start-process-shell-command "cmst" nil "cmst -m -w 5")
378 (start-process-shell-command "keepassxc" nil "keepassxc")
379 (start-process-shell-command "pa-applet" nil
380 "pa-applet --disable-key-grabbing --disable-notifications")
381 (start-process-shell-command "picom" nil "picom"))))
382 :config
383 (exwm-enable)
384 (require 'exwm-systemtray)
385 (exwm-systemtray-enable))
386
387(use-package exwm-mff
388 :ensure
389 :hook (exwm-init . exwm-mff-mode))
390
391(use-package exwm-edit
392 :ensure) 359 :ensure)
393
394(use-package desktop-environment
395 :ensure
396 :hook (exwm-init . desktop-environment-mode)
397 :custom
398 (desktop-environment-update-exwm-global-keys :global)
399 (desktop-environment-brightness-get-command "light")
400 (desktop-environment-brightness-set-command "light %s")
401 (desktop-environment-brightness-get-regexp "^\\([0-9]+\\)")
402 (desktop-environment-brightness-normal-increment "-A 10")
403 (desktop-environment-brightness-normal-decrement "-U 10")
404 (desktop-environment-brightness-small-increment "-A 5")
405 (desktop-environment-brightness-small-decrement "-U 5")
406 (desktop-environment-volume-get-command "pavolume get")
407 (desktop-environment-volume-set-command "pavolume %s")
408 (desktop-environment-volume-toggle-command "pavolume mute toggle")
409 (desktop-environment-volume-get-regexp "^\\([0-9]+\\)")
410 (desktop-environment-volume-normal-increment "inc 10")
411 (desktop-environment-volume-normal-decrement "dec 10")
412 (desktop-environment-volume-small-increment "inc 5")
413 (desktop-environment-volume-small-decrement "dec 5"))