diff options
author | Case Duckworth | 2020-09-22 20:16:01 -0500 |
---|---|---|
committer | Case Duckworth | 2020-09-22 20:16:01 -0500 |
commit | c64216002b685cce810b3ba23eed6e4337b73dae (patch) | |
tree | 64860475168cfdc81f80f17f4c0614e94ee562ac | |
parent | Add visual-fill-column to elpher-mode-hook (diff) | |
download | emacs-c64216002b685cce810b3ba23eed6e4337b73dae.tar.gz emacs-c64216002b685cce810b3ba23eed6e4337b73dae.zip |
Rewrite to take advantage of outshine-mode
-rw-r--r-- | early-init.el | 127 | ||||
-rw-r--r-- | init.el | 1386 |
2 files changed, 819 insertions, 694 deletions
diff --git a/early-init.el b/early-init.el index e7595a9..c67eadb 100644 --- a/early-init.el +++ b/early-init.el | |||
@@ -1,60 +1,67 @@ | |||
1 | ;;; early-init.el ~ acdw | 1 | ;;; early-init.el ~ acdw -*- lexical-binding: t; coding: utf-8; fill-column: 85 -*- |
2 | 2 | ||
3 | ;;; this needs to happen first -- speed up init | 3 | ;;; Commentary: |
4 | (setq gc-cons-threshold most-positive-fixnum) | 4 | ;; `early-init.el' is new as of Emacs 27.1. It contains ... /early initiation/. |
5 | (defvar file-name-handler-alist-old file-name-handler-alist) | 5 | ;; What does that mean? Who knows. What I /do know/ is that it runs /before/ |
6 | (setq file-name-handler-alist nil) | 6 | ;; `package.el' is loaded, so I can stop it from loading, since I use `straight.el'. |
7 | (setq message-log-max 16384) | 7 | ;; Other than that, there's some other init stuff that needs to happen as early |
8 | (setq byte-compile-warnings | 8 | ;; as possible -- think bootstrap-level. |
9 | '(not free-vars unresolved noruntime lexical make-local)) | 9 | |
10 | 10 | ;;; Speed up startup | |
11 | (add-hook 'after-init-hook | 11 | (setq gc-cons-threshold most-positive-fixnum) |
12 | (lambda () | 12 | |
13 | (setq file-name-handler-alist file-name-handler-alist-old) | 13 | (defvar file-name-handler-alist-old file-name-handler-alist) |
14 | (setq gc-cons-threshold (* 32 1024 1024))) | 14 | (setq file-name-handler-alist nil) |
15 | t) | 15 | |
16 | 16 | (setq message-log-max 16384) | |
17 | ;;(setq debug-on-error t) | 17 | (setq byte-compile-warnings |
18 | 18 | '(not free-vars unresolved noruntime lexical make-local)) | |
19 | ;;; different platforms | 19 | |
20 | (defconst *acdw/at-work* (eq system-type 'windows-nt)) | 20 | ;;; Restore stuff after startup |
21 | (defconst *acdw/at-larry* (string= (system-name) "larry")) | 21 | (add-hook 'after-init-hook |
22 | (defconst *acdw/at-bax* (string= (system-name) "bax")) | 22 | (lambda () |
23 | (defconst *acdw/at-home* (or *acdw/at-larry* *acdw/at-bax*)) | 23 | (setq file-name-handler-alist file-name-handler-alist-old) |
24 | 24 | (setq gc-cons-threshold (* 32 1024 1024)) | |
25 | ;; this needs to be before bootstrapping straight.el | 25 | (garbage-collect)) |
26 | (when *acdw/at-work* | 26 | t) |
27 | (add-to-list 'exec-path "~/bin") | 27 | |
28 | (add-to-list 'exec-path "C:/Users/aduckworth/Downloads/PortableGit/bin")) | 28 | ;; (setq debug-on-error t) |
29 | 29 | ||
30 | ;;; gui | 30 | ;;; Define the platforms I work on |
31 | (add-to-list 'default-frame-alist '(tool-bar-lines . 0)) | 31 | (defconst *acdw/at-work* (eq system-type 'windows-nt)) |
32 | (add-to-list 'default-frame-alist '(menu-bar-lines . 0)) | 32 | (defconst *acdw/at-larry* (string= (system-name) "larry")) |
33 | 33 | (defconst *acdw/at-bax* (string= (system-name) "bax")) | |
34 | (setq inhibit-startup-buffer-menu t) | 34 | (defconst *acdw/at-home* (or *acdw/at-larry* *acdw/at-bax*)) |
35 | (setq inhibit-startup-screen t) | 35 | |
36 | (setq initial-buffer-choice t) | 36 | ;;;; When at work, I have to use Portable Git. |
37 | (setq initial-scratch-message nil) | 37 | (when *acdw/at-work* |
38 | 38 | (add-to-list 'exec-path "~/bin") | |
39 | ;;; straight.el ~ github.com/raxod502/straight.el | 39 | (add-to-list 'exec-path "C:/Users/aduckworth/Downloads/PortableGit/bin")) |
40 | 40 | ||
41 | (setq straight-use-package-by-default t) ; use use-package | 41 | ;;; `straight.el' ~ github.com/raxod502/straight.el |
42 | (setq use-package-hook-name-suffix nil) ; don't assume -hook | 42 | |
43 | 43 | ;;;; Bootstrap | |
44 | ;; bootstrap | 44 | ;; NOTE: this doesn't work on Windows (download straight directly) |
45 | (defvar bootstrap-version) | 45 | (defvar bootstrap-version) |
46 | (let ((bootstrap-file | 46 | (let ((bootstrap-file |
47 | (expand-file-name "straight/repos/straight.el/bootstrap.el" | 47 | (expand-file-name "straight/repos/straight.el/bootstrap.el" |
48 | user-emacs-directory)) | 48 | user-emacs-directory)) |
49 | (bootstrap-version 5)) | 49 | (bootstrap-version 5)) |
50 | (unless (file-exists-p bootstrap-file) | 50 | (unless (file-exists-p bootstrap-file) |
51 | (with-current-buffer | 51 | (with-current-buffer |
52 | (url-retrieve-synchronously | 52 | (url-retrieve-synchronously |
53 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" | 53 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" |
54 | 'silent 'inhibit-cookies) | 54 | 'silent 'inhibit-cookies) |
55 | (goto-char (point-max)) | 55 | (goto-char (point-max)) |
56 | (eval-print-last-sexp))) | 56 | (eval-print-last-sexp))) |
57 | (load bootstrap-file nil 'nomessage)) | 57 | (load bootstrap-file nil 'nomessage)) |
58 | 58 | ||
59 | ;; install use-package with straight | 59 | ;;; Bootstrap `use-package' |
60 | (straight-use-package 'use-package) | 60 | (setq-default use-package-verbose nil |
61 | use-package-expand-minimally t | ||
62 | use-package-enable-imenu-support t | ||
63 | use-package-hook-name-suffix nil) | ||
64 | |||
65 | (straight-use-package 'use-package) | ||
66 | |||
67 | (setq straight-use-package-by-default t) | ||
diff --git a/init.el b/init.el index 57a2c47..4d5cb48 100644 --- a/init.el +++ b/init.el | |||
@@ -1,634 +1,752 @@ | |||
1 | ;;; init.el ~ acdw -*- lexical-binding: t -*- | 1 | ;;; init.el -*- lexical-binding: t; coding: utf-8; fill-column: 70 -*- |
2 | 2 | ||
3 | ;;; emacs configuration - general | 3 | ;;; Commentary: |
4 | 4 | ;; I /was/ going to convert this to org-mode, but then I found this | |
5 | (use-package emacs | 5 | ;; page: https://yiufung.net/post/pure-emacs-lisp-init-skeleton/, |
6 | :demand | 6 | ;; which pointed out that I could use `outline-mode' (or in my case, |
7 | :init | 7 | ;; `outshine') to fold and navigate a pure-elisp `init.el'. So that's |
8 | (setq calendar-location-name "Baton Rouge, LA") | 8 | ;; what I'm doing. |
9 | (setq calendar-latitude 30.39) | 9 | |
10 | (setq calendar-longitude -91.83) | 10 | ;;; Basic emacs config & built-in packages |
11 | 11 | ;;;; /Really/ basic emacs config | |
12 | (setq browse-url-browser-function 'browse-url-generic) | 12 | ;; I /did/ use `better-defaults', but it turns out that that package |
13 | (setq browse-url-generic-program "firefox")) | 13 | ;; is (a) short and (b) mostly overriden by other settings. |
14 | 14 | (use-package emacs | |
15 | (use-package no-littering | 15 | :demand ; make sure this stuff loads |
16 | :config | 16 | :init |
17 | (require 'recentf) | 17 | ;; where I am |
18 | (add-to-list 'recentf-exclude no-littering-var-directory) | 18 | (setq calendar-location-name "Baton Rouge, LA") |
19 | (add-to-list 'recentf-exclude no-littering-etc-directory) | 19 | (setq calendar-latitude 30.39) |
20 | 20 | (setq calendar-longitude -91.83) | |
21 | (setq delete-old-versions t) | 21 | |
22 | (setq kept-new-versions 6) | 22 | ;; firefox is love, firefox is life |
23 | (setq kept-old-versions 2) | 23 | (setq browse-url-browser-function 'browse-url-firefox |
24 | (setq version-control t) | 24 | browse-url-new-window-flag t |
25 | (setq backup-directory-alist | 25 | browse-url-firefox-new-window-is-tab t) |
26 | `((".*" . ,(no-littering-expand-var-file-name "backup/")))) | 26 | |
27 | 27 | ;; honestly not sure if this is necessary | |
28 | (setq auto-save-file-name-transforms | 28 | (autoload 'zap-up-to-char "misc" |
29 | `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))) | 29 | "Kill up to, but not including, ARGth occurence of CHAR." t) |
30 | (auto-save-mode) | 30 | |
31 | 31 | ;; show parentheses | |
32 | (setq custom-file (no-littering-expand-etc-file-name "custom.el")) | 32 | (setq show-paren-style 'mixed) |
33 | 33 | (show-paren-mode) | |
34 | (setq create-lockfiles nil)) | 34 | |
35 | 35 | ;; always work on visual lines | |
36 | (use-package auth-source | 36 | (global-visual-line-mode) |
37 | :init | 37 | |
38 | (setq auth-sources '("~/.authinfo")) ;; TODO: gpg | 38 | ;; make the mouse avoid where I'm typing |
39 | (setq user-full-name "Case Duckworth") | 39 | (mouse-avoidance-mode 'jump) |
40 | (setq user-mail-address "acdw@acdw.net")) | 40 | |
41 | 41 | ;; delete the selection when I start typing, like a normal editor | |
42 | (use-package better-defaults | 42 | (delete-selection-mode) |
43 | :demand | 43 | |
44 | :config ; add other "better defaults" of my own | 44 | ;; ignore case |
45 | (when *acdw/at-larry* | 45 | (setq-default completion-ignore-case t |
46 | (setq visible-bell nil)) | 46 | read-buffer-completion-ignore-case t |
47 | 47 | read-file-name-completion-ignore-case t) | |
48 | (auto-save-mode) | 48 | |
49 | 49 | ;; etc defaults | |
50 | (defun full-auto-save () | 50 | (fset 'yes-or-no-p 'y-or-n-p) |
51 | (interactive) | 51 | (setq-default indent-tabs-mode nil |
52 | (save-excursion | 52 | save-interprogram-paste-before-kill t |
53 | (dolist (buf (buffer-list)) | 53 | apropos-do-all t |
54 | (set-buffer buf) | 54 | mouse-yank-at-point t |
55 | (if (and (buffer-file-name) (buffer-modified-p)) | 55 | require-final-newline t |
56 | (basic-save-buffer))))) | 56 | visible-bell (not *acdw/at-larry*) |
57 | (add-hook 'auto-save-hook 'full-auto-save) | 57 | ediff-window-setup-function 'ediff-setup-windows-plain |
58 | (add-hook 'focus-out-hook 'full-auto-save) ; might be resource-intensive | 58 | use-dialog-box nil |
59 | 59 | mark-even-if-inactive nil | |
60 | ;; follow the split! | 60 | sentence-end-double-space t) |
61 | (defun split-and-follow-below () | 61 | |
62 | (interactive) | 62 | ;; utf-8 is now, old man |
63 | (split-window-below) | 63 | (set-charset-priority 'unicode) |
64 | (balance-windows) | 64 | (set-language-environment "UTF-8") |
65 | (other-window 1)) | 65 | (set-default-coding-systems 'utf-8) |
66 | 66 | (set-terminal-coding-system 'utf-8) | |
67 | (defun split-and-follow-right () | 67 | (set-keyboard-coding-system 'utf-8) |
68 | (interactive) | 68 | (set-selection-coding-system 'utf-8) |
69 | (split-window-right) | 69 | (prefer-coding-system 'utf-8) |
70 | (balance-windows) | 70 | (setq default-buffer-file-coding-system 'utf-8 |
71 | (other-window 1)) | 71 | default-process-coding-system '(utf-8-unix . utf-8-unix) |
72 | 72 | locale-coding-system 'utf-8) | |
73 | (setq save-place-file (no-littering-expand-var-file-name "places")) | 73 | |
74 | (save-place-mode) | 74 | ;; don't confirm killing |
75 | 75 | (setq confirm-kill-processes nil | |
76 | (set-language-environment "UTF-8") | 76 | confirm-kill-emacs nil) |
77 | (prefer-coding-system 'utf-8) | 77 | |
78 | (set-default-coding-systems 'utf-8) | 78 | ;; simplify the GUI |
79 | (set-terminal-coding-system 'utf-8) | 79 | (setq default-frame-alist '((tool-bar-lines . 0) |
80 | (set-keyboard-coding-system 'utf-8) | 80 | (menu-bar-lines . 0) |
81 | (setq default-buffer-file-coding-system 'utf-8) | 81 | (vertical-scroll-bars . nil) |
82 | 82 | (horizontal-scroll-bars . nil) | |
83 | (fset 'yes-or-no-p 'y-or-n-p) | 83 | (right-divider-width . 2) |
84 | 84 | (bottom-divider-width . 2) | |
85 | (global-visual-line-mode) | 85 | (left-fringe-width . 2) |
86 | (mouse-avoidance-mode 'jump) | 86 | (right-fringe-width . 2)) |
87 | (setq show-paren-style 'mixed) | 87 | inhibit-startup-buffer-menu t |
88 | (delete-selection-mode 1) | 88 | inhibit-startup-screen t |
89 | 89 | initial-buffer-choice t | |
90 | ;; TODO figure out how to add this to the :hook block | 90 | initial-scratch-message nil) |
91 | (add-hook 'prog-mode-hook (if (and (fboundp 'display-line-numbers-mode) | 91 | |
92 | (display-graphic-p)) | 92 | ;; When at larry, fullscreen emacs. |
93 | #'display-line-numbers-mode | 93 | (when *acdw/at-larry* |
94 | #'linum-mode)) | 94 | (add-to-list 'default-frame-alist '(fullscreen . maximized))) |
95 | 95 | ||
96 | (setq completion-ignore-case t) | 96 | ;; set up the cursor |
97 | (setq read-buffer-completion-ignore-case t) | 97 | (blink-cursor-mode 0) |
98 | (setq read-file-name-completion-ignore-case t) | 98 | (setq-default cursor-type 'bar |
99 | 99 | cursor-in-non-selected-windows 'hollow) | |
100 | ;; don't confirm death | 100 | |
101 | (setq confirm-kill-processes nil) | 101 | ;; display line numbers in `prog-mode' |
102 | (setq confirm-kill-emacs nil) | 102 | (add-hook 'prog-mode-hook |
103 | 103 | (if (and (fboundp 'display-line-numbers-mode) | |
104 | ;; cursor betterment | 104 | (display-graphic-p)) |
105 | (blink-cursor-mode 0) | 105 | #'display-line-numbers-mode |
106 | (setq-default cursor-type 'bar) | 106 | #'linum-mode)) |
107 | 107 | ||
108 | :bind | 108 | ;; custom functions |
109 | ([remap split-window-below] . split-and-follow-below) | 109 | (defun split-and-follow-below () |
110 | ([remap split-window-right] . split-and-follow-right) | 110 | "Split the window below and switch to the split." |
111 | 111 | (interactive) | |
112 | :hook | 112 | (split-window-below) |
113 | (prog-mode-hook . prettify-symbols-mode) | 113 | (balance-windows) |
114 | (auto-save-hook . full-auto-save) | 114 | (other-window 1)) |
115 | (focus-out-hook . full-auto-save) | 115 | |
116 | (before-save-hook . delete-trailing-whitespace)) | 116 | (defun split-and-follow-right () |
117 | 117 | "Split the window right and switch to the split." | |
118 | (use-package async | 118 | (interactive) |
119 | :config | 119 | (split-window-right) |
120 | (dired-async-mode 1)) | 120 | (balance-windows) |
121 | 121 | (other-window 1)) | |
122 | (use-package auto-compile | 122 | |
123 | :config | 123 | (defun full-auto-save () |
124 | (auto-compile-on-load-mode) | 124 | "Save all buffers that (a) have files associated and (b) are modified." |
125 | (setq load-prefer-newer t)) | 125 | (interactive) |
126 | 126 | (save-excursion | |
127 | ;; start the server when at home | 127 | (dolist (buf (buffer-list)) |
128 | 128 | (set-buffer buf) | |
129 | (if *acdw/at-home* | 129 | (if (and (buffer-file-name) (buffer-modified-p)) |
130 | (server-start)) | 130 | (basic-save-buffer))))) |
131 | 131 | ||
132 | ;;; quality-of-life improvements | 132 | (defun kill-this-buffer () |
133 | 133 | "Kill the current buffer." | |
134 | (use-package diminish) | 134 | (interactive) |
135 | 135 | (kill-buffer nil)) | |
136 | (use-package which-key | 136 | |
137 | :diminish which-key-mode | 137 | :bind |
138 | :config | 138 | ("C-x C-b" . ibuffer) |
139 | (which-key-mode)) | 139 | ("M-z" . zap-up-to-char) |
140 | 140 | ([remap split-window-below] . split-and-follow-below) | |
141 | (use-package recentf | 141 | ([remap split-window-right] . split-and-follow-right) |
142 | :init | 142 | ("C-x f" . find-file) |
143 | (setq recentf-max-menu-items 100) | 143 | ("C-z" . nil) |
144 | (setq recentf-max-saved-items 100) | 144 | ("C-x k" . kill-this-buffer) |
145 | :config | 145 | ("C-x K" . kill-buffer) |
146 | (recentf-mode)) | 146 | |
147 | 147 | :hook | |
148 | (use-package savehist | 148 | (prog-mode-hook . prettify-symbols-mode) |
149 | :config | 149 | ((auto-save-hook focus-out-hook) . full-auto-save) |
150 | (savehist-mode) | 150 | (before-save-hook . delete-trailing-whitespace)) |
151 | (setq savehist-additional-variables | 151 | |
152 | '(kill-ring search-ring regexp-search-ring))) | 152 | ;;;; Keep .emacs.d clean |
153 | 153 | ;; load this early for other packages to use | |
154 | (use-package restart-emacs) | 154 | (use-package no-littering |
155 | 155 | :demand | |
156 | (use-package volatile-highlights | 156 | :config |
157 | :config | 157 | (setq custom-file (no-littering-expand-etc-file-name "custom.el")) |
158 | (volatile-highlights-mode t)) | 158 | |
159 | 159 | (setq create-lockfiles nil) | |
160 | (use-package zop-to-char | 160 | |
161 | :bind | 161 | (setq delete-old-versions t |
162 | ([remap zap-to-char] . zop-to-char) | 162 | kept-new-versions 6 |
163 | ([remap zap-up-to-char] . zop-up-to-char)) | 163 | kept-old-versions 2 |
164 | 164 | version-control t) | |
165 | (use-package easy-kill | 165 | |
166 | :bind | 166 | (setq backup-directory-alist |
167 | ([remap kill-ring-save] . easy-kill) | 167 | `((".*" . ,(no-littering-expand-var-file-name "backup/")))) |
168 | ([remap mark-sexp] . easy-mark)) | 168 | |
169 | 169 | (setq auto-save-file-name-transforms | |
170 | (use-package whole-line-or-region | 170 | `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))) |
171 | :config | 171 | (auto-save-mode)) |
172 | (whole-line-or-region-global-mode 1)) | 172 | |
173 | 173 | ;;;; Uniquily name buffers | |
174 | (use-package avy | 174 | (use-package uniquify |
175 | :bind | 175 | :straight nil |
176 | ("M-s" . avy-goto-char-timer)) | 176 | :init |
177 | 177 | (setq uniquify-buffer-name-style 'forward)) | |
178 | (use-package selectrum | 178 | |
179 | :config | 179 | ;;;; Use async when possible |
180 | (ido-mode -1) ;; not sure why this is necessary | 180 | (use-package async |
181 | (setq enable-recursive-minibuffers t) | 181 | :config |
182 | (minibuffer-depth-indicate-mode) | 182 | (dired-async-mode)) |
183 | (selectrum-mode 1)) | 183 | |
184 | 184 | ;;;; Autocompile elisp files (like this one) | |
185 | (use-package prescient) | 185 | (use-package auto-compile |
186 | 186 | :init | |
187 | (use-package selectrum-prescient | 187 | (setq load-prefer-newer t) |
188 | :config | 188 | :config |
189 | (selectrum-prescient-mode 1) | 189 | (auto-compile-on-load-mode)) |
190 | (prescient-persist-mode 1)) | 190 | |
191 | 191 | ;;;; Recent files | |
192 | (use-package ctrlf | 192 | (use-package recentf |
193 | :config | 193 | :init |
194 | (ctrlf-mode 1)) | 194 | (setq recentf-max-menu-items 100 |
195 | 195 | recentf-max-saved-items 100) | |
196 | ;;; programming | 196 | :config |
197 | 197 | (add-to-list 'recentf-exclude no-littering-var-directory) | |
198 | (use-package aggressive-indent | 198 | (add-to-list 'recentf-exclude no-littering-etc-directory) |
199 | :diminish aggressive-indent-mode | 199 | (recentf-mode)) |
200 | :hook | 200 | ;;;; Save places in files |
201 | (prog-mode-hook . aggressive-indent-mode)) | 201 | (use-package saveplace |
202 | 202 | :init | |
203 | (use-package magit | 203 | (setq save-place-file (no-littering-expand-var-file-name "places")) |
204 | :if *acdw/at-home* | 204 | (when *acdw/at-work* |
205 | :bind | 205 | (setq save-place-forget-unreadable-files nil)) |
206 | ("C-x g" . magit)) | 206 | :config |
207 | 207 | (save-place-mode)) | |
208 | (use-package forge | 208 | |
209 | :if *acdw/at-home* | 209 | ;;;; Save history of commands, etc. |
210 | :after magit | 210 | (use-package savehist |
211 | :custom | 211 | :init |
212 | (forge-owned-accounts '(("duckwork")))) | 212 | (setq savehist-additional-variables |
213 | 213 | '(kill-ring | |
214 | (use-package company | 214 | search-ring |
215 | :commands company-mode | 215 | regexp-search-ring)) |
216 | :init | 216 | :config |
217 | (setq company-idle-delay 0.1) | 217 | (savehist-mode)) |
218 | :hook | 218 | |
219 | (prog-mode-hook . company-mode) | 219 | ;;;; Authority sources for logins |
220 | :bind (:map company-active-map | 220 | ;; TODO: use gpg |
221 | ("C-n" . company-select-next) | 221 | (use-package auth-source |
222 | ("C-p" . company-select-previous)) | 222 | :init |
223 | :config | 223 | (setq auth-sources '("~/.authinfo")) |
224 | (use-package company-quickhelp | 224 | (setq user-full-name "Case Duckworth") |
225 | :hook | 225 | (setq user-mail-address "acdw@acdw.net")) |
226 | (company-mode-hook . (lambda () | 226 | |
227 | (company-quickhelp-local-mode))))) | 227 | ;;; General-ish Packages |
228 | 228 | ;;;; General improvements | |
229 | (use-package helpful | 229 | ;;;;; Diminish TODO: is this necessary? |
230 | :bind | 230 | (use-package diminish) |
231 | ("C-h f" . helpful-callable) | 231 | |
232 | ("C-h v" . helpful-variable) | 232 | ;;;;; Restart emacs /from within/ emacs |
233 | ("C-h k" . helpful-key) | 233 | (use-package restart-emacs) |
234 | ("C-c C-d" . helpful-at-point) | 234 | |
235 | ("C-h F" . helpful-function) | 235 | ;;;; User interface |
236 | ("C-h C" . helpful-command)) | 236 | ;;;;; Pop-up help for keys |
237 | 237 | (use-package which-key | |
238 | (when *acdw/at-home* | 238 | :diminish which-key-mode |
239 | (use-package su | 239 | :init |
240 | :config | 240 | (setq which-key-enable-extended-define-key t) |
241 | (su-mode)) | 241 | :config |
242 | 242 | (which-key-setup-side-window-right-bottom) | |
243 | (use-package trashed | 243 | (which-key-mode)) |
244 | :init | 244 | |
245 | (setq delete-by-moving-to-trash t))) | 245 | ;;;;; A better help buffer |
246 | 246 | (use-package helpful | |
247 | (use-package smartparens | 247 | :bind |
248 | :config | 248 | ("C-h f" . helpful-callable) |
249 | (require 'smartparens-config) | 249 | ("C-h v" . helpful-variable) |
250 | (smartparens-global-mode)) | 250 | ("C-h k" . helpful-key) |
251 | 251 | ("C-c C-d" . helpful-at-point) | |
252 | 252 | ("C-h F" . helpful-function) | |
253 | (use-package rainbow-mode | 253 | ("C-h C" . helpful-command)) |
254 | :hook | 254 | |
255 | (prog-mode-hook . rainbow-mode)) | 255 | ;;;;; A better `outline-mode' |
256 | 256 | (use-package outshine | |
257 | ;;; writing | 257 | :init |
258 | 258 | (setq outshine-cycle-emulate-tab t) | |
259 | (use-package visual-fill-column | 259 | :bind (:map outshine-mode-map |
260 | :init | 260 | ("<S-iso-lefttab>" . outshine-cycle-buffer) |
261 | (setq split-window-preferred-function 'visual-fill-column-split-window-sensibly) | 261 | ("<backtab>" . outshine-cycle-buffer)) |
262 | (setq visual-fill-column-center-text t) | 262 | :hook |
263 | :config | 263 | (emacs-lisp-mode . outshine-mode)) |
264 | (advice-add 'text-scale-adjust | 264 | |
265 | :after #'visual-fill-column-adjust)) | 265 | ;;;;; Item selection & narrowing |
266 | 266 | (use-package selectrum | |
267 | ;;; window management | 267 | :init |
268 | 268 | (setq enable-recursive-minibuffers t) | |
269 | (use-package switch-window | 269 | (minibuffer-depth-indicate-mode) |
270 | :init | 270 | :config |
271 | (setq switch-window-shortcut-style 'qwerty) | 271 | (selectrum-mode)) |
272 | :bind | 272 | |
273 | ([remap other-window] . switch-window) | 273 | (use-package prescient) |
274 | ("s-o" . switch-window)) | 274 | |
275 | 275 | (use-package selectrum-prescient | |
276 | ;;; theming and looks | 276 | :config |
277 | 277 | (selectrum-prescient-mode) | |
278 | (use-package dynamic-fonts | 278 | (prescient-persist-mode)) |
279 | :init | 279 | |
280 | (setq dynamic-fonts-preferred-monospace-fonts | 280 | ;;;;; Searching |
281 | '("Iosevka Term Slab" | 281 | (use-package ctrlf |
282 | "Consolas" | 282 | :config |
283 | "Fira Code" | 283 | (ctrlf-mode)) |
284 | "DejaVu Sans Mono" | 284 | |
285 | "Courier" | 285 | ;;;;; Visually switch windows |
286 | "Fixed")) | 286 | (use-package switch-window |
287 | (setq dynamic-fonts-preferred-monospace-point-size 11) | 287 | :init |
288 | (setq dynamic-fonts-preferred-proportional-fonts | 288 | (setq switch-window-shortcut-style 'qwerty) |
289 | '("DejaVu Sans" | 289 | :bind |
290 | "Georgia" | 290 | ([remap other-window] . switch-window) |
291 | "Times New Roman" | 291 | ("s-o" . switch-window)) |
292 | "Times")) | 292 | |
293 | (setq dynamic-fonts-preferred-proportional-point-size 12) | 293 | ;;;; Theming, looks, fonts |
294 | :config | 294 | ;;;;; Modeline |
295 | (dynamic-fonts-setup)) | 295 | (use-package doom-modeline |
296 | 296 | :init | |
297 | (use-package doom-modeline | 297 | (setq doom-modeline-icon nil |
298 | :init | 298 | doom-modeline-enable-word-count t) |
299 | (setq doom-modeline-icon nil) | 299 | |
300 | (setq doom-modeline-enable-word-count t) | 300 | (when *acdw/at-larry* |
301 | (when *acdw/at-larry* | 301 | (setq display-time-format "%R") |
302 | (setq display-time-format "%R") | 302 | (display-time-mode)) |
303 | (display-time-mode)) | 303 | |
304 | :hook | 304 | :hook |
305 | (after-init-hook . doom-modeline-mode)) | 305 | (window-setup-hook . doom-modeline-mode)) |
306 | 306 | ;;;;; Ligatures | |
307 | (use-package ligature | 307 | (use-package ligature |
308 | :straight (ligature | 308 | :straight (ligature |
309 | :host github | 309 | :host github |
310 | :repo "mickeynp/ligature.el") | 310 | :repo "mickeynp/ligature.el") |
311 | :config | 311 | :config |
312 | (ligature-set-ligatures 'prog-mode | 312 | (ligature-set-ligatures 'prog-mode |
313 | '("++" "--" "/=" "&&" "||" "||=" | 313 | '("++" "--" "/=" "&&" "||" "||=" |
314 | "->" "=>" "::" "__" | 314 | "->" "=>" "::" "__" |
315 | "==" "===" "!=" "=/=" "!==" | 315 | "==" "===" "!=" "=/=" "!==" |
316 | "<=" ">=" "<=>" | 316 | "<=" ">=" "<=>" |
317 | "/*" "*/" "//" "///" | 317 | "/*" "*/" "//" "///" |
318 | "\\n" "\\\\" | 318 | "\\n" "\\\\" |
319 | "<<" "<<<" "<<=" ">>" ">>>" ">>=" | 319 | "<<" "<<<" "<<=" ">>" ">>>" ">>=" |
320 | "|=" "^=" | 320 | "|=" "^=" |
321 | "**" "--" "---" "----" "-----" | 321 | "**" "--" "---" "----" "-----" |
322 | "==" "===" "====" "=====" | 322 | "==" "===" "====" "=====" |
323 | "</" "<!--" "</>" "-->" "/>" | 323 | "</" "<!--" "</>" "-->" "/>" |
324 | ":=" "..." ":>" ":<" ">:" "<:" | 324 | ":=" "..." ":>" ":<" ">:" "<:" |
325 | "::=" ;; add others here | 325 | "::=" ;; add others here |
326 | )) | 326 | )) |
327 | (global-ligature-mode t)) | 327 | (global-ligature-mode)) |
328 | 328 | ;;;;; Unicode | |
329 | (use-package unicode-fonts | 329 | (use-package unicode-fonts |
330 | :config | 330 | :config |
331 | (unicode-fonts-setup)) | 331 | (unicode-fonts-setup)) |
332 | 332 | ;;;;; Modus themes | |
333 | ;; modus themes | 333 | (use-package modus-operandi-theme |
334 | 334 | :if window-system | |
335 | (use-package modus-operandi-theme | 335 | :config |
336 | :if window-system | 336 | (load-theme 'modus-operandi t t) |
337 | :config | 337 | |
338 | (load-theme 'modus-operandi t t) | 338 | (defun acdw/sunrise () |
339 | 339 | (enable-theme 'modus-operandi) | |
340 | (defun acdw/sunrise () | 340 | (start-process-shell-command "light" nil "light -S 60")) |
341 | (enable-theme 'modus-operandi) | 341 | |
342 | (start-process-shell-command "light" nil "light -S 60")) | 342 | (if *acdw/at-work* |
343 | 343 | (enable-theme 'modus-operandi) | |
344 | (if *acdw/at-work* | 344 | (run-at-time (nth 1 (split-string (sunrise-sunset))) |
345 | (enable-theme 'modus-operandi) | 345 | (* 60 60 24) #'acdw/sunrise))) |
346 | (run-at-time (nth 1 (split-string (sunrise-sunset))) | 346 | |
347 | (* 60 60 24) #'acdw/sunrise))) | 347 | (when *acdw/at-home* |
348 | 348 | (use-package modus-vivendi-theme | |
349 | (when *acdw/at-home* | 349 | :if window-system |
350 | (use-package modus-vivendi-theme | 350 | :config |
351 | :if window-system | 351 | (load-theme 'modus-vivendi t t) |
352 | :config | 352 | |
353 | (load-theme 'modus-vivendi t t) | 353 | (defun acdw/sunset () |
354 | 354 | (enable-theme 'modus-vivendi) | |
355 | (defun acdw/sunset () | 355 | (start-process-shell-command "light" nil "light -S 35")) |
356 | (enable-theme 'modus-vivendi) | 356 | |
357 | (start-process-shell-command "light" nil "light -S 35")) | 357 | (run-at-time (nth 4 (split-string (sunrise-sunset))) |
358 | 358 | (* 60 60 24) #'acdw/sunset) | |
359 | (run-at-time (nth 4 (split-string (sunrise-sunset))) | 359 | (run-at-time "12am" (* 60 60 24) #'acdw/sunset))) |
360 | (* 60 60 24) #'acdw/sunset) | 360 | ;;;; General text editing |
361 | (run-at-time "12am" (* 60 60 24) #'acdw/sunset))) | 361 | ;;;;; Jump to characters fast |
362 | 362 | (use-package avy | |
363 | ;;; gemini/gopher | 363 | :bind |
364 | (use-package elpher | 364 | ("M-s" . avy-goto-char-timer)) |
365 | :straight (elpher | 365 | ;;;;; Show text commands acted on |
366 | :repo "git://thelambdalab.xyz/elpher.git") | 366 | (use-package volatile-highlights |
367 | :bind (:map elpher-mode-map | 367 | :config |
368 | ("n" . elpher-next-link) | 368 | (volatile-highlights-mode)) |
369 | ("p" . elpher-prev-link) | 369 | ;;;;; Visual replacement for `zap-to-char' |
370 | ("o" . elpher-follow-current-link) | 370 | (use-package zop-to-char |
371 | ("G" . elpher-go-current)) | 371 | :bind |
372 | :hook (elpher-mode-hook . (lambda () | 372 | ([remap zap-to-char] . zop-to-char) |
373 | (variable-pitch-mode 1) | 373 | ([remap zap-up-to-char] . zop-up-to-char)) |
374 | (visual-fill-column-mode 1)))) | 374 | ;;;;; Kill & mark things more visually |
375 | 375 | (use-package easy-kill | |
376 | (use-package gemini-mode | 376 | :bind |
377 | :straight (gemini-mode | 377 | ([remap kill-ring-save] . easy-kill) |
378 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) | 378 | ([remap mark-sexp] . easy-mark)) |
379 | 379 | ;;;;; Operate on the current line if no region is active | |
380 | (use-package gemini-write | 380 | (use-package whole-line-or-region |
381 | :straight (gemini-write | 381 | :config |
382 | :repo "https://alexschroeder.ch/cgit/gemini-write")) | 382 | (whole-line-or-region-global-mode)) |
383 | 383 | ||
384 | (defun post-to-gemlog-blue (post-title user pass) | 384 | ;;;;; Expand region |
385 | "Post current buffer to gemlog.blue." | 385 | (use-package expand-region |
386 | (interactive | 386 | :bind |
387 | (let* ((title-maybe (progn ;; TODO this is ... clunky | 387 | ("C-=" . er/expand-region)) |
388 | (goto-char (point-min)) | 388 | ;;;; Programming |
389 | (if (re-search-forward "^# \\(.*\\)" nil t) | 389 | ;;;;; Code completion |
390 | (buffer-substring-no-properties | 390 | (use-package company |
391 | (match-beginning 1) | 391 | :init |
392 | (match-end 1)) | 392 | (setq company-idle-delay 0.1 |
393 | ""))) | 393 | company-show-numbers t) |
394 | (title (read-string | 394 | :config |
395 | (format "Title%s: " | 395 | (let ((map company-active-map)) |
396 | (if (string= "" title-maybe) | 396 | (mapc (lambda (x) |
397 | "" | 397 | (define-key map (format "%d" x) |
398 | (concat " (" title-maybe ")"))) | 398 | `(lambda () |
399 | nil nil title-maybe)) | 399 | (interactive) |
400 | (user (read-string "User: " nil)) | 400 | (company-complete-number ,x)))) |
401 | (pass (read-passwd "Pass: " nil))) | 401 | (number-sequence 0 9))) |
402 | (list title user pass))) | 402 | :hook |
403 | 403 | (prog-mode-hook . company-mode) | |
404 | (require 'mm-url) | 404 | :bind (:map company-active-map |
405 | (let ((url-request-method "POST") | 405 | ("C-n" . company-select-next) |
406 | (url-request-extra-headers | 406 | ("C-p" . company-select-previous))) |
407 | '(("Content-Type" . "application/x-www-form-urlencoded"))) | 407 | |
408 | (url-request-data | 408 | (use-package company-quickhelp |
409 | (mm-url-encode-www-form-urlencoded | 409 | :hook |
410 | `(("title" . ,post-title) | 410 | (company-mode-hook . company-quickhelp-local-mode)) |
411 | ("gemloguser" . ,user) | 411 | |
412 | ("pw" . ,pass) | 412 | (use-package company-prescient |
413 | ("post" . ,(buffer-string)))))) | 413 | :hook |
414 | (with-current-buffer | 414 | (company-mode-hook . company-prescient-mode)) |
415 | (url-retrieve-synchronously "https://gemlog.blue/post.php") | 415 | |
416 | (goto-char (point-min)) | 416 | ;;;;; Git integration |
417 | (re-search-forward "\\(gemini://.*\\.gmi\\)") | 417 | (use-package magit |
418 | (elpher-go (match-string 1))))) | 418 | :if *acdw/at-home* |
419 | 419 | :bind | |
420 | ;;; exwm ~ Emacs X Window Manager | 420 | ("C-x g" . magit-status) |
421 | (when *acdw/at-larry* | 421 | :config |
422 | (use-package exwm | 422 | (add-to-list 'magit-no-confirm 'stage-all-changes)) |
423 | :if window-system | 423 | |
424 | :demand | 424 | ;; use libgit to speed up magit, only at home |
425 | :custom | 425 | (when (and *acdw/at-home* (executable-find "cmake")) |
426 | (exwm-layout-show-all-buffers t) | 426 | (use-package libgit) |
427 | (exwm-workspace-warp-cursor t) | 427 | |
428 | ;;(mouse-autoselect-window t) | 428 | (use-package magit-libgit |
429 | (exwm-workspace-number 4) | 429 | :after (magit libgit)) |
430 | (exwm-input-global-keys | 430 | ) |
431 | `( | 431 | |
432 | ([remap split-window-below] . split-and-follow-below) | 432 | (use-package forge |
433 | ([remap split-window-right] . split-and-follow-right) | 433 | :if *acdw/at-home* |
434 | ([?\s-r] . exwm-reset) | 434 | :after magit |
435 | ([?\s-w] . exwm-workspace-switch) | 435 | :config |
436 | ([?\s-&] . (lambda (command) | 436 | (setq forge-owned-accounts '(("duckwork")))) |
437 | (interactive (list (read-shell-command "$ "))) | 437 | ;;;;; Code formatting & display |
438 | (start-process-shell-command command nil command))) | 438 | ;;;;;; Keep code properly indented |
439 | ,@(mapcar (lambda (i) | 439 | (use-package aggressive-indent |
440 | `(,(kbd (format "s-%d" i)) . | 440 | :diminish aggressive-indent-mode |
441 | (lambda () | 441 | :hook |
442 | (interactive) | 442 | (prog-mode-hook . aggressive-indent-mode)) |
443 | (exwm-workspace-switch-create ,i)))) | 443 | ;;;;;; Smartly deal with pairs |
444 | (number-sequence 0 9)))) | 444 | (use-package smartparens |
445 | (exwm-input-simulation-keys | 445 | :config |
446 | '(([?\C-b] . [left]) | 446 | (require 'smartparens-config) |
447 | ([?\M-b] . [C-left]) | 447 | (smartparens-global-mode)) |
448 | ([?\C-f] . [right]) | 448 | ;;;;;; Show delimiters as different colors |
449 | ([?\M-f] . [C-right]) | 449 | (use-package rainbow-delimiters |
450 | ([?\C-p] . [up]) | 450 | :hook |
451 | ([?\C-n] . [down]) | 451 | (prog-mode-hook . rainbow-delimiters-mode)) |
452 | ([?\C-a] . [home]) | 452 | ;;;;;; Show colors as they appear in the buffer |
453 | ([?\C-e] . [end]) | 453 | (use-package rainbow-mode |
454 | ([?\M-v] . [prior]) | 454 | :hook |
455 | ([?\C-v] . [next]) | 455 | (prog-mode-hook . rainbow-mode)) |
456 | ([?\C-d] . [delete]) | 456 | ;;;; Writing |
457 | ([?\C-k] . [S-end delete]) | 457 | ;;;;; `fill-column', but in `visual-line-mode' |
458 | ([?\C-s] . [?\C-f]) | 458 | (use-package visual-fill-column |
459 | ([?\C-w] . [?\C-x]) | 459 | :init |
460 | ([?\M-w] . [?\C-c]) | 460 | (setq split-window-preferred-function 'visual-fill-column-split-window-sensibly) |
461 | ([?\C-y] . [?\C-v]))) | 461 | (setq visual-fill-column-center-text t) |
462 | :hook | 462 | :config |
463 | ((exwm-update-class-hook . | 463 | (advice-add 'text-scale-adjust |
464 | (lambda () "Rename buffer to window's class name" | 464 | :after #'visual-fill-column-adjust)) |
465 | (exwm-workspace-rename-buffer exwm-class-name))) | 465 | |
466 | (exwm-update-title-hook . | 466 | ;;;; Machine-specific |
467 | (lambda () "Update workspace name to window title" | 467 | ;;;;; Linux at home |
468 | (when (not exwm-instance-name) | 468 | (when *acdw/at-home* |
469 | (exwm-workspace-rename-buffer exwm-title)))) | 469 | ;;;;;; Edit files with `sudo' (I think?) |
470 | (exwm-init-hook . window-divider-mode) | 470 | (use-package su |
471 | (exwm-init-hook . | 471 | :config |
472 | (lambda () "Autostart" | 472 | (su-mode)) |
473 | (start-process-shell-command "cmst" nil "cmst -m -w 5") | 473 | ;;;;;; Implement XDG Trash specification |
474 | (start-process-shell-command "keepassxc" nil "keepassxc") | 474 | (use-package trashed |
475 | (start-process-shell-command | 475 | :init |
476 | "pa-applet" nil | 476 | (setq delete-by-moving-to-trash t)) |
477 | "pa-applet --disable-key-grabbing --disable-notifications") | 477 | ;;;;;; Build exec-path from $PATH |
478 | (start-process-shell-command | 478 | (use-package exec-path-from-shell |
479 | "cbatticon" nil "cbatticon")))) | 479 | :demand |
480 | :config | 480 | :config |
481 | (require 'exwm) | 481 | (exec-path-from-shell-initialize)) |
482 | (exwm-enable) | 482 | ) |
483 | (require 'exwm-systemtray) | 483 | ;;; Specialized packages |
484 | (exwm-systemtray-enable)) | 484 | ;;;; Gemini & Gopher |
485 | 485 | (use-package elpher | |
486 | (use-package exwm-firefox-core | 486 | :straight (elpher |
487 | :after exwm | 487 | :repo "git://thelambdalab.xyz/elpher.git") |
488 | :straight (exwm-firefox-core | 488 | :bind (:map elpher-mode-map |
489 | :type git | 489 | ("n" . elpher-next-link) |
490 | :host github | 490 | ("p" . elpher-prev-link) |
491 | :repo "walseb/exwm-firefox-core")) | 491 | ("o" . elpher-follow-current-link) |
492 | 492 | ("G" . elpher-go-current)) | |
493 | (use-package exwm-firefox | 493 | :hook (elpher-mode-hook . (lambda () |
494 | :after exwm-firefox-core | 494 | (variable-pitch-mode) |
495 | :straight (exwm-firefox | 495 | (set-fill-column 100) |
496 | :type git | 496 | (visual-fill-column-mode)))) |
497 | :host github | 497 | |
498 | :repo "ieure/exwm-firefox") | 498 | (use-package gemini-mode |
499 | :config | 499 | :straight (gemini-mode |
500 | (exwm-firefox-mode)) | 500 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) |
501 | 501 | ||
502 | (use-package exwm-mff | 502 | (use-package gemini-write |
503 | :straight (exwm-mff | 503 | :straight (gemini-write |
504 | :host github | 504 | :repo "https://alexschroeder.ch/cgit/gemini-write")) |
505 | :repo "ieure/exwm-mff" | 505 | |
506 | :fork ( | 506 | (defun post-to-gemlog-blue (post-title user pass) |
507 | :host github | 507 | "Post current buffer to gemlog.blue." |
508 | :repo "duckwork/exwm-mff")) | 508 | (interactive |
509 | :after exwm | 509 | (let* ((title-maybe (progn ;; TODO this is ... clunky |
510 | :hook | 510 | (goto-char (point-min)) |
511 | (exwm-init-hook . exwm-mff-mode)) | 511 | (if (re-search-forward "^# \\(.*\\)" nil t) |
512 | 512 | (buffer-substring-no-properties | |
513 | (use-package exwm-edit) | 513 | (match-beginning 1) |
514 | 514 | (match-end 1)) | |
515 | ) ;; end of *acdw/at-larry* block for exwm | 515 | ""))) |
516 | 516 | (title (read-string | |
517 | ;;; other applications | 517 | (format "Title%s: " |
518 | (use-package circe | 518 | (if (string= "" title-maybe) |
519 | :if *acdw/at-larry* | 519 | "" |
520 | :init | 520 | (concat " (" title-maybe ")"))) |
521 | (defun my/fetch-password (&rest params) | 521 | nil nil title-maybe)) |
522 | "Fetch a password from auth-sources" | 522 | (user (read-string "User: " nil)) |
523 | (require 'auth-source) | 523 | (pass (read-passwd "Pass: " nil))) |
524 | (let ((match (car (apply 'auth-source-search params)))) | 524 | (list title user pass))) |
525 | (if match | 525 | |
526 | (let ((secret (plist-get match :secret))) | 526 | (require 'mm-url) |
527 | (if (functionp secret) | 527 | (let ((url-request-method "POST") |
528 | (funcall secret) | 528 | (url-request-extra-headers |
529 | secret)) | 529 | '(("Content-Type" . "application/x-www-form-urlencoded"))) |
530 | (error "Password not found for %S" params)))) | 530 | (url-request-data |
531 | 531 | (mm-url-encode-www-form-urlencoded | |
532 | (defun my/sasl-password (nick server) | 532 | `(("title" . ,post-title) |
533 | "Fetch a password for $server and $nick" | 533 | ("gemloguser" . ,user) |
534 | (my/fetch-password :user nick :host server)) | 534 | ("pw" . ,pass) |
535 | (require 'lui-autopaste) | 535 | ("post" . ,(buffer-string)))))) |
536 | (defun my/circe-prompt () | 536 | (with-current-buffer |
537 | (lui-set-prompt | 537 | (url-retrieve-synchronously "https://gemlog.blue/post.php") |
538 | (concat (propertize (concat (buffer-name) ">") | 538 | (goto-char (point-min)) |
539 | 'face 'circe-prompt-face) | 539 | (re-search-forward "\\(gemini://.*\\.gmi\\)") |
540 | " "))) | 540 | (elpher-go (match-string 1))))) |
541 | (defun my/lui-setup () | 541 | |
542 | (setq right-margin-width 5 | 542 | ;;;; exwm ~ Emacs X Window Manager |
543 | fringes-outside-margins t | 543 | (when *acdw/at-larry* |
544 | word-wrap t | 544 | (use-package exwm |
545 | wrap-prefix " ") | 545 | :if window-system |
546 | (setf (cdr (assoc 'continuation fringe-indicator-alist)) nil)) | 546 | :demand |
547 | :hook | 547 | :custom |
548 | (circe-channel-mode-hook . enable-lui-autopaste) | 548 | (exwm-layout-show-all-buffers t) |
549 | (circe-chat-mode-hook . my/circe-prompt) | 549 | (exwm-workspace-warp-cursor t) |
550 | (lui-mode-hook . my/lui-setup) | 550 | ;;(mouse-autoselect-window t) |
551 | :config | 551 | (exwm-workspace-number 4) |
552 | (setq circe-default-part-message "Peace out, cub scouts") | 552 | (exwm-input-global-keys |
553 | (setq circe-default-quit-message "See You Space Cowpokes ......") | 553 | `( |
554 | (setq circe-default-realname "Case D") | 554 | ([remap split-window-below] . split-and-follow-below) |
555 | (setq circe-highlight-nick-type 'all) | 555 | ([remap split-window-right] . split-and-follow-right) |
556 | (setq circe-reduce-lurker-spam t) | 556 | ([?\s-r] . exwm-reset) |
557 | (setq circe-format-say "{nick:-12s} {body}") | 557 | ([?\s-w] . exwm-workspace-switch) |
558 | (setq circe-format-self-say "{nick:-11s}> {body}") | 558 | ([?\s-&] . (lambda (command) |
559 | (setq lui-time-stamp-position 'right-margin) | 559 | (interactive (list (read-shell-command "$ "))) |
560 | (setq lui-fill-type nil) | 560 | (start-process-shell-command command nil command))) |
561 | (setq lui-time-stamp-format "%H:%M") | 561 | ,@(mapcar (lambda (i) |
562 | (setq lui-track-bar-behavior 'before-switch-to-buffer) | 562 | `(,(kbd (format "s-%d" i)) . |
563 | (setq circe-network-options | 563 | (lambda () |
564 | `(("Freenode" | 564 | (interactive) |
565 | :tls t | 565 | (exwm-workspace-switch-create ,i)))) |
566 | :port 6697 | 566 | (number-sequence 0 9)))) |
567 | :nick "acdw" | 567 | (exwm-input-simulation-keys |
568 | :sasl-username "acdw" | 568 | '(([?\C-b] . [left]) |
569 | :sasl-password ,(my/sasl-password "acdw" "irc.freenode.net") | 569 | ([?\M-b] . [C-left]) |
570 | :channels ("#emacs" "#daydreams")) | 570 | ([?\C-f] . [right]) |
571 | ("Tilde.chat" | 571 | ([?\M-f] . [C-right]) |
572 | :tls t | 572 | ([?\C-p] . [up]) |
573 | :port 6697 | 573 | ([?\C-n] . [down]) |
574 | :nick "acdw" | 574 | ([?\C-a] . [home]) |
575 | :sasl-username "acdw" | 575 | ([?\C-e] . [end]) |
576 | :sasl-password ,(my/sasl-password "acdw" "irc.tilde.chat") | 576 | ([?\M-v] . [prior]) |
577 | :channels ("#gemini" "#meta")))) | 577 | ([?\C-v] . [next]) |
578 | (enable-lui-track-bar) | 578 | ([?\C-d] . [delete]) |
579 | :custom-face | 579 | ([?\C-k] . [S-end delete]) |
580 | (circe-my-message-face ((t (:inherit 'circe-highlight-nick-face :weight normal)))) | 580 | ([?\C-s] . [?\C-f]) |
581 | (circe-originator-face ((t (:weight bold)))) | 581 | ([?\C-w] . [?\C-x]) |
582 | (circe-prompt-face ((t (:inherit 'circe-my-message-face))))) | 582 | ([?\M-w] . [?\C-c]) |
583 | 583 | ([?\C-y] . [?\C-v]))) | |
584 | ;;; eshell | 584 | :hook |
585 | 585 | ((exwm-update-class-hook . | |
586 | (use-package eshell | 586 | (lambda () "Rename buffer to window's class name" |
587 | :init | 587 | (exwm-workspace-rename-buffer exwm-class-name))) |
588 | (defun eshell/emacs (&rest args) | 588 | (exwm-update-title-hook . |
589 | "Open a file in emacs." | 589 | (lambda () "Update workspace name to window title" |
590 | (if (null args) | 590 | (when (not exwm-instance-name) |
591 | (bury-buffer) | 591 | (exwm-workspace-rename-buffer exwm-title)))) |
592 | (mapc #'find-file | 592 | (exwm-init-hook . window-divider-mode) |
593 | (mapcar #'expand-file-name | 593 | (exwm-init-hook . |
594 | (eshell-flatten-list (reverse args)))))) | 594 | (lambda () "Autostart" |
595 | (defun eshell/info (&optional subject) | 595 | (start-process-shell-command "cmst" nil "cmst -m -w 5") |
596 | "Invoke `info', optionally opening Info to SUBJECT." | 596 | (start-process-shell-command "keepassxc" nil "keepassxc") |
597 | (require 'cl) | 597 | (start-process-shell-command |
598 | (let ((buf (current-buffer))) | 598 | "pa-applet" nil |
599 | (Info-directory) | 599 | "pa-applet --disable-key-grabbing --disable-notifications") |
600 | (if (not (null subject)) | 600 | (start-process-shell-command |
601 | (let ((node-exists (ignore-errors (Info-menu subject)))) | 601 | "cbatticon" nil "cbatticon")))) |
602 | (if (not node-exists) | 602 | :config |
603 | (format "No menu item `%s' in node `(dir)Top'." | 603 | (require 'exwm) |
604 | subject))))))) | 604 | (exwm-enable) |
605 | 605 | (require 'exwm-systemtray) | |
606 | (use-package eshell-syntax-highlighting | 606 | (exwm-systemtray-enable)) |
607 | :after esh-mode | 607 | |
608 | :config | 608 | (use-package exwm-firefox-core |
609 | (eshell-syntax-highlighting-global-mode 1)) | 609 | :after exwm |
610 | 610 | :straight (exwm-firefox-core | |
611 | ;;; org-mode | 611 | :type git |
612 | (use-package org | 612 | :host github |
613 | :init | 613 | :repo "walseb/exwm-firefox-core")) |
614 | (setq org-startup-indented t) | 614 | |
615 | (setq org-src-tab-acts-natively t) | 615 | (use-package exwm-firefox |
616 | (setq org-hide-emphasis-markers t) | 616 | :after exwm-firefox-core |
617 | (setq org-fontify-done-headline t) | 617 | :straight (exwm-firefox |
618 | (setq org-hide-leading-stars t) | 618 | :type git |
619 | (setq org-pretty-entities t) | 619 | :host github |
620 | 620 | :repo "ieure/exwm-firefox") | |
621 | (font-lock-add-keywords 'org-mode | 621 | :config |
622 | '(("^ *\\([-+*]\\) " | 622 | (exwm-firefox-mode)) |
623 | (0 (prog1 () (compose-region (match-beginning 1) | 623 | |
624 | (match-end 1) | 624 | (use-package exwm-mff |
625 | "•")))))) | 625 | :straight (exwm-mff |
626 | :hook | 626 | :host github |
627 | (org-mode-hook . (lambda () | 627 | :repo "ieure/exwm-mff" |
628 | (variable-pitch-mode 1) | 628 | :fork ( |
629 | (visual-line-mode) | 629 | :host github |
630 | (visual-fill-column-mode)))) | 630 | :repo "duckwork/exwm-mff")) |
631 | 631 | :after exwm | |
632 | (use-package org-bullets | 632 | :hook |
633 | :hook | 633 | (exwm-init-hook . exwm-mff-mode)) |
634 | (org-mode-hook . (lambda () (org-bullets-mode 1)))) | 634 | |
635 | (use-package exwm-edit) | ||
636 | |||
637 | ) ;; end of *acdw/at-larry* block for exwm | ||
638 | |||
639 | ;;;; IRC | ||
640 | (use-package circe | ||
641 | :if *acdw/at-larry* | ||
642 | :init | ||
643 | (defun my/fetch-password (&rest params) | ||
644 | "Fetch a password from auth-sources" | ||
645 | (require 'auth-source) | ||
646 | (let ((match (car (apply 'auth-source-search params)))) | ||
647 | (if match | ||
648 | (let ((secret (plist-get match :secret))) | ||
649 | (if (functionp secret) | ||
650 | (funcall secret) | ||
651 | secret)) | ||
652 | (error "Password not found for %S" params)))) | ||
653 | |||
654 | (defun my/sasl-password (nick server) | ||
655 | "Fetch a password for $server and $nick" | ||
656 | (my/fetch-password :user nick :host server)) | ||
657 | (require 'lui-autopaste) | ||
658 | (defun my/circe-prompt () | ||
659 | (lui-set-prompt | ||
660 | (concat (propertize (concat (buffer-name) ">") | ||
661 | 'face 'circe-prompt-face) | ||
662 | " "))) | ||
663 | (defun my/lui-setup () | ||
664 | (setq right-margin-width 5 | ||
665 | fringes-outside-margins t | ||
666 | word-wrap t | ||
667 | wrap-prefix " ") | ||
668 | (setf (cdr (assoc 'continuation fringe-indicator-alist)) nil)) | ||
669 | :hook | ||
670 | (circe-channel-mode-hook . enable-lui-autopaste) | ||
671 | (circe-chat-mode-hook . my/circe-prompt) | ||
672 | (lui-mode-hook . my/lui-setup) | ||
673 | :config | ||
674 | (setq circe-default-part-message "Peace out, cub scouts") | ||
675 | (setq circe-default-quit-message "See You Space Cowpokes ......") | ||
676 | (setq circe-default-realname "Case D") | ||
677 | (setq circe-highlight-nick-type 'all) | ||
678 | (setq circe-reduce-lurker-spam t) | ||
679 | (setq circe-format-say "{nick:-12s} {body}") | ||
680 | (setq circe-format-self-say "{nick:-11s}> {body}") | ||
681 | (setq lui-time-stamp-position 'right-margin) | ||
682 | (setq lui-fill-type nil) | ||
683 | (setq lui-time-stamp-format "%H:%M") | ||
684 | (setq lui-track-bar-behavior 'before-switch-to-buffer) | ||
685 | (setq circe-network-options | ||
686 | `(("Freenode" | ||
687 | :tls t | ||
688 | :port 6697 | ||
689 | :nick "acdw" | ||
690 | :sasl-username "acdw" | ||
691 | :sasl-password ,(my/sasl-password "acdw" "irc.freenode.net") | ||
692 | :channels ("#emacs" "#daydreams")) | ||
693 | ("Tilde.chat" | ||
694 | :tls t | ||
695 | :port 6697 | ||
696 | :nick "acdw" | ||
697 | :sasl-username "acdw" | ||
698 | :sasl-password ,(my/sasl-password "acdw" "irc.tilde.chat") | ||
699 | :channels ("#gemini" "#meta")))) | ||
700 | (enable-lui-track-bar) | ||
701 | :custom-face | ||
702 | (circe-my-message-face ((t (:inherit 'circe-highlight-nick-face :weight normal)))) | ||
703 | (circe-originator-face ((t (:weight bold)))) | ||
704 | (circe-prompt-face ((t (:inherit 'circe-my-message-face))))) | ||
705 | |||
706 | ;;;; eshell | ||
707 | (use-package eshell | ||
708 | :init | ||
709 | (defun eshell/emacs (&rest args) | ||
710 | "Open a file in emacs." | ||
711 | (if (null args) | ||
712 | (bury-buffer) | ||
713 | (mapc #'find-file | ||
714 | (mapcar #'expand-file-name | ||
715 | (eshell-flatten-list (reverse args)))))) | ||
716 | (defun eshell/info (&optional subject) | ||
717 | "Invoke `info', optionally opening Info to SUBJECT." | ||
718 | (require 'cl) | ||
719 | (let ((buf (current-buffer))) | ||
720 | (Info-directory) | ||
721 | (if (not (null subject)) | ||
722 | (let ((node-exists (ignore-errors (Info-menu subject)))) | ||
723 | (if (not node-exists) | ||
724 | (format "No menu item `%s' in node `(dir)Top'." | ||
725 | subject))))))) | ||
726 | |||
727 | (use-package eshell-syntax-highlighting | ||
728 | :after esh-mode | ||
729 | :config | ||
730 | (eshell-syntax-highlighting-global-mode)) | ||
731 | |||
732 | ;;;; org-mode | ||
733 | (use-package org | ||
734 | :init | ||
735 | (setq org-startup-indented t) | ||
736 | (setq org-src-tab-acts-natively t) | ||
737 | (setq org-hide-emphasis-markers t) | ||
738 | (setq org-fontify-done-headline t) | ||
739 | (setq org-hide-leading-stars t) | ||
740 | (setq org-pretty-entities t) | ||
741 | |||
742 | (font-lock-add-keywords 'org-mode | ||
743 | '(("^ *\\([-+*]\\) " | ||
744 | (0 (prog1 () (compose-region (match-beginning 1) | ||
745 | (match-end 1) | ||
746 | "•")))))) | ||
747 | :hook | ||
748 | (org-mode-hook . variable-pitch-mode)) | ||
749 | |||
750 | (use-package org-bullets | ||
751 | :hook | ||
752 | (org-mode-hook . (lambda () (org-bullets-mode)))) | ||