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.el479
1 files changed, 399 insertions, 80 deletions
diff --git a/init.el b/init.el index 3cbf3cc..101e220 100644 --- a/init.el +++ b/init.el
@@ -10,57 +10,189 @@
10;; - Make good choices. 10;; - Make good choices.
11 11
12(yoke +emacs (locate-user-emacs-file "lisp/") 12(yoke +emacs (locate-user-emacs-file "lisp/")
13 (require '+emacs) 13 (require* '+emacs '+window)
14 ;; Settings 14 ;; Settings
15 (setq truncate-string-ellipsis "…" 15 (setf truncate-string-ellipsis "…"
16 ring-bell-function #'ignore 16 ring-bell-function #'ignore
17 read-file-name-completion-ignore-case t) 17 read-file-name-completion-ignore-case t
18 comment-auto-fill-only-comments t
19 password-cache t
20 password-cache-expiry (* 60 60))
21 ;; "Safe" variables
22 (dolist (var+pred
23 '((browse-url-browser-function
24 ;; All types defined by custom are safe.
25 . (lambda (f)
26 ;; Whooooo boy
27 (memq f (mapcar (lambda (i)
28 (plist-get (cdr i) :value))
29 (seq-filter
30 (lambda (i)
31 (eq (car i) 'function-item))
32 (cdr (get 'browse-url-browser-function
33 'custom-type)))))))))
34 (put (car var+pred) 'safe-local-variable (cdr var+pred)))
18 ;; Keys 35 ;; Keys
19 (define-keys (current-global-map) 36 (define-key* (current-global-map)
20 "C-x C-k" #'kill-current-buffer 37 "C-x C-k" #'kill-current-buffer
21 "C-/" #'undo-only 38 "C-/" #'undo-only
22 "C-?" #'undo-redo 39 "C-?" #'undo-redo
23 "C-x C-c" #'+save-buffers-quit 40 "C-x C-c" #'+save-buffers-quit
24 "M-SPC" #'+cycle-spacing 41 "M-SPC" #'+cycle-spacing
25 "M-/" #'hippie-expand 42 ;; "M-/" #'hippie-expand ; `hippie-completing-read'
26 "M-=" #'count-words 43 "M-=" #'count-words
27 "C-x C-b" #'ibuffer 44 "C-x C-b" #'ibuffer
28 "C-x 4 n" #'clone-buffer 45 "C-x 4 n" #'clone-buffer
29 "S-<down-mouse-1>" #'mouse-set-mark 46 "S-<down-mouse-1>" #'mouse-set-mark
30 "C-x 0" #'+delete-window-or-bury-buffer 47 "C-x 0" #'+delete-window-or-bury-buffer
31 "M-j" nil 48 "M-j" nil
32 "<Scroll_Lock>" nil) 49 "<Scroll_Lock>" nil
50 "M-o" #'other-window|switch-buffer)
51 (define-key* text-mode-map
52 "C-M-k" #'kill-paragraph)
33 ;; Hooks 53 ;; Hooks
34 (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) 54 (add-hook 'after-save-hook
55 #'executable-make-buffer-file-executable-if-script-p)
35 (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) 56 (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
36 (add-hook 'find-file-not-found-functions #'+auto-create-missing-dirs) 57 (add-hook 'find-file-not-found-functions #'+auto-create-missing-dirs)
58 (add-hook 'text-mode-hook #'abbrev-mode)
59 (add-hook 'find-file-hook #'+vc-off-when-remote)
37 ;; Advice 60 ;; Advice
38 (add-function :after after-focus-change-function #'+save-some-buffers-debounce) 61 (add-function :after after-focus-change-function
39 (advice-add 'keyboard-escape-quit :around #'keyboard-escape-quit-keep-window-open) 62 #'+save-some-buffers-debounce)
63 (advice-add 'keyboard-escape-quit :around
64 #'keyboard-escape-quit-keep-window-open)
40 (define-advice keyboard-escape-quit (:around (fn &rest r)) 65 (define-advice keyboard-escape-quit (:around (fn &rest r))
41 "Don't close quits on `keyboard-escape-quit'." 66 "Don't close quits on `keyboard-escape-quit'."
42 (let ((buffer-quit-function #'ignore)) 67 (let ((buffer-quit-function #'ignore))
43 (apply fn r))) 68 (apply fn r)))
69 (advice-add 'indent-region :before #'with-region-or-buffer)
44 ;; Themes 70 ;; Themes
45 (load-theme 'modus-operandi) 71 (load-theme 'modus-operandi)
46 (set-face-attribute 'default nil :family "Comic Code" :height 100) 72 (set-face-attribute 'default nil :family "Comic Code" :height 100)
47 (set-face-attribute 'variable-pitch nil :family "Comic Code" :height 100)) 73 (set-face-attribute 'bold nil :family "Comic Code" :weight 'bold)
74 (set-face-attribute 'variable-pitch nil :family "Comic Code")
75 ;; Modes
76 (winner-mode))
77
78(yoke whitespace nil
79 (setf whitespace-line-column nil
80 whitespace-style '( face trailing
81 tabs tab-mark
82 indentation
83 space-after-tab space-before-tab))
84 (defun +whitespace-mode-for-writable-buffers ()
85 "Turn on `whitespace-mode' if the buffer is writable, off otherwise."
86 (whitespace-mode (if buffer-read-only -1 t)))
87 (add-hook* '(text-mode-hook
88 prog-mode-hook
89 read-only-mode-hook)
90 #'+whitespace-mode-for-writable-buffers)
91 (add-hook 'before-save-hook #'whitespace-cleanup)
92 (define-advice whitespace-cleanup (:around (fn &rest r) preserve-point)
93 (let ((col (current-column)))
94 (apply fn r)
95 (move-to-column col t)
96 (set-buffer-modified-p nil))))
97
98(yoke elisp-mode nil
99 (setf eval-expression-print-length nil
100 eval-expression-print-level nil)
101 (define-key* '(emacs-lisp-mode-map lisp-interaction-mode-map)
102 "C-c C-c" #'eval-defun
103 "C-c C-k" (defun +elisp-eval-region-or-buffer ()
104 (interactive)
105 (cond
106 ((region-active-p)
107 (eval-region (region-beginning) (region-end))
108 (message "Region evaluated."))
109 (t
110 (eval-buffer)
111 (message "Buffer %s evaluated." (buffer-name)))))
112 "C-c C-z" #'ielm)
113 (define-advice eval-region (:around (fn beg end &rest args) pulse)
114 (apply fn beg end args)
115 (pulse-momentary-highlight-region beg end)))
48 116
49(yoke isearch nil 117(yoke isearch nil
50 (define-keys (current-global-map) 118 (define-key* (current-global-map)
51 "C-s" #'isearch-forward-regexp 119 "C-s" #'isearch-forward-regexp
52 "C-r" #'isearch-backward-regexp 120 "C-r" #'isearch-backward-regexp
53 "C-M-s" #'isearch-forward 121 "C-M-s" #'isearch-forward
54 "C-M-r" #'isearch-backward)) 122 "C-M-r" #'isearch-backward))
55 123
124(yoke ispell nil
125 (eval-after ispell
126 (require '+ispell)
127 (add-hook 'before-save-hook #'+ispell-move-buffer-words-to-dir-locals-hook))
128 (setf ispell-program-name (or (executable-find "ispell")
129 (executable-find "aspell")))
130 (put 'ispell-buffer-session-localwords
131 'safe-local-variable #'+ispell-safe-local-p))
132
133
134(yoke mouse nil
135 ;; Brand new for Emacs 28: see https://ruzkuku.com/texts/emacs-mouse.html
136 ;; Actually, look at this as well: https://www.emacswiki.org/emacs/Mouse3
137 (when (fboundp 'context-menu-mode)
138 (setf context-menu-functions '(context-menu-ffap
139 context-menu-region
140 context-menu-undo
141 ;; context-menu-dictionary
142 ))
143 (context-menu-mode +1))
144 (dolist (click '(;; Fix scrolling in the margin
145 wheel-down double-wheel-down triple-wheel-down
146 wheel-up double-wheel-up triple-wheel-up))
147 (global-set-key (vector 'right-margin click) 'mwheel-scroll)
148 (global-set-key (vector 'left-margin click) 'mwheel-scroll)))
149
150(yoke dired nil
151 (require 'dired-x)
152 (setf dired-recursive-copies 'always
153 dired-recursive-deletes 'always
154 dired-create-destination-dirs 'always
155 dired-do-revert-buffer t
156 dired-hide-details-hide-symlink-targets nil
157 dired-isearch-filenames 'dwim
158 delete-by-moving-to-trash t
159 dired-auto-revert-buffer t
160 dired-listing-switches "-AlF"
161 ls-lisp-dirs-first t
162 dired-ls-F-marks-symlinks t
163 dired-clean-confirm-killing-deleted-buffers nil
164 dired-no-confirm '(byte-compile
165 load chgrp chmod chown
166 copy move hardlink symlink
167 shell touch)
168 dired-dwim-target t)
169 (setq-local-hook dired-mode-hook
170 truncate-lines t)
171 (define-key* (current-global-map)
172 "C-x C-j" #'dired-jump)
173 (eval-after dired
174 (define-key* dired-mode-map
175 "<backspace>" #'dired-up-directory
176 "C-j" #'dired-up-directory))
177 (add-hook* 'dired-mode-hook
178 #'dired-hide-details-mode
179 #'hl-line-mode))
180
181(yoke dired-hacks "https://github.com/Fuco1/dired-hacks"
182 (define-key* dired-mode-map
183 "TAB" #'dired-subtree-sycle
184 "i" #'dired-subtree-toggle)
185 (add-hook* 'dired-mode-hook
186 #'dired-collapse-mode))
187
56(yoke auth-source nil 188(yoke auth-source nil
57 (setq auth-sources `(default "secrets:passwords")) 189 (setf auth-sources `(default "secrets:passwords"))
58 (setq-local-hook authinfo-mode-hook 190 (setq-local-hook authinfo-mode-hook
59 truncate-lines t)) 191 truncate-lines t))
60 192
61(yoke consult "https://github.com/minad/consult" 193(yoke consult "https://github.com/minad/consult"
62 (require 'consult) 194 (require 'consult)
63 (setq register-preview-delay 0 195 (setf register-preview-delay 0
64 register-preview-function #'consult-register-format 196 register-preview-function #'consult-register-format
65 xref-show-xrefs-function #'consult-xref 197 xref-show-xrefs-function #'consult-xref
66 tab-always-indent 'complete 198 tab-always-indent 'complete
@@ -68,7 +200,7 @@
68 consult-narrow-key "<" 200 consult-narrow-key "<"
69 consult--regexp-compiler #'consult--default-regexp-compiler) 201 consult--regexp-compiler #'consult--default-regexp-compiler)
70 (advice-add #'register-preview :override #'consult-register-window) 202 (advice-add #'register-preview :override #'consult-register-window)
71 (define-keys (current-global-map) 203 (define-key* (current-global-map)
72 ;; C-c bindings (mode-specific-map) 204 ;; C-c bindings (mode-specific-map)
73 "C-c h" #'consult-history 205 "C-c h" #'consult-history
74 "C-c m" #'consult-mode-command 206 "C-c m" #'consult-mode-command
@@ -111,89 +243,123 @@
111 ;; Isearch integration 243 ;; Isearch integration
112 "M-s e" #'consult-isearch-history) 244 "M-s e" #'consult-isearch-history)
113 (eval-after isearch-mode 245 (eval-after isearch-mode
114 (define-keys isearch-mode-map 246 (define-key* isearch-mode-map
115 "M-e" #'consult-isearch-history 247 "M-e" #'consult-isearch-history
116 "M-s e" #'consult-isearch-history 248 "M-s e" #'consult-isearch-history
117 "M-s l" #'consult-line 249 "M-s l" #'consult-line
118 "M-s L" #'consult-line-multi)) 250 "M-s L" #'consult-line-multi))
119 (eval-after org 251 (eval-after org
120 (define-key org-mode-map (kbd "M-g o") #'consult-org-heading))) 252 (define-key org-mode-map (kbd "M-g o") #'consult-org-heading))
253 (setf (alist-get ?y (plist-get (alist-get 'emacs-lisp-mode
254 consult-imenu-config)
255 :types))
256 '("Yoke")))
121 257
122(yoke orderless "https://github.com/oantolin/orderless" 258(yoke orderless "https://github.com/oantolin/orderless"
123 (require 'orderless) 259 (require 'orderless)
124 (setq completion-styles '(substring orderless basic) 260 (setf completion-styles '(substring orderless basic)
125 completion-category-defaults nil 261 completion-category-defaults nil
126 completion-category-overrides '((file (styles basic partial-completion))) 262 completion-category-overrides
263 '((file (styles basic partial-completion)))
127 orderless-component-separator #'orderless-escapable-split-on-space)) 264 orderless-component-separator #'orderless-escapable-split-on-space))
128 265
129(yoke vertico "https://github.com/minad/vertico" 266(yoke vertico "https://github.com/minad/vertico"
130 (require 'vertico) 267 (require 'vertico)
131 (setq resize-mini-windows 'grow-only 268 (setf resize-mini-windows 'grow-only
132 vertico-count-format nil 269 vertico-count-format nil
133 vertico-cycle t) 270 vertico-cycle t)
134 (vertico-mode)) 271 (vertico-mode))
135 272
273(yoke embark "https://github.com/oantolin/embark"
274 (require 'embark)
275 (setf prefix-help-command #'embark-prefix-help-command
276 embar-keymap-prompter-key ";")
277 (define-key* (list (current-global-map)
278 'minibuffer-local-map)
279 "C-." #'embark-act
280 "M-." #'embark-dwim
281 "<f1> B" #'embark-bindings)
282 (define-key* embark-file-map
283 "l" #'vlf)
284 (eval-after (embark consult)
285 (require 'embark-consult)
286 (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)))
287
136(yoke marginalia "https://github.com/minad/marginalia/" 288(yoke marginalia "https://github.com/minad/marginalia/"
137 (marginalia-mode)) 289 (marginalia-mode))
138 290
291(yoke wgrep "https://github.com/mhayashi1120/Emacs-wgrep"
292 (require 'wgrep))
293
139(yoke slime "https://github.com/slime/slime" 294(yoke slime "https://github.com/slime/slime"
140 ;; r7rs-swank 295 ;; r7rs-swank
141 (let ((r7rsloc (yoke-git "https://github.com/ecraven/r7rs-swank"))) 296 (let ((r7rsloc (yoke-git "https://github.com/ecraven/r7rs-swank")))
142 (cond 297 (cond
143 ((executable-find "chibi-scheme") 298 ((executable-find "chibi-scheme")
144 (defun chibi-scheme-start-swank (file encoding) 299 (defun chibi-scheme-start-swank (file encoding)
145 (format "%S\n\n" `(start-swank ,file))) 300 (format "%S\n\n" `(start-swank ,file)))
146 (setq slime-lisp-implementations 301 (setq slime-lisp-implementations
147 (cons `(chibi-scheme 302 (cons `(chibi-scheme
148 ("chibi-scheme" ,(format "-A%s" r7rsloc) 303 ("chibi-scheme" ,(format "-A%s" r7rsloc)
149 "-m" "(chibi-swank)") 304 "-m" "(chibi-swank)")
150 :init chibi-scheme-start-swank) 305 :init chibi-scheme-start-swank)
151 (bound-and-true-p slime-lisp-implementations))))))) 306 (bound-and-true-p slime-lisp-implementations)))))))
152 307
153(yoke puni "https://github.com/amaikinono/puni" 308(yoke puni "https://github.com/amaikinono/puni"
154 (puni-global-mode) 309 (define-key* puni-mode-map
155 (electric-pair-mode)
156 (define-keys puni-mode-map
157 "C-)" #'puni-slurp-forward 310 "C-)" #'puni-slurp-forward
158 "C-(" #'puni-slurp-backward 311 "C-(" #'puni-slurp-backward
159 "C-}" #'puni-barf-forward 312 "C-}" #'puni-barf-forward
160 "C-{" #'puni-barf-backward)) 313 "C-{" #'puni-barf-backward
314 "M-(" (defun +puni-open-then-slurp-forward (&optional n)
315 (interactive "p")
316 (insert "()")
317 (backward-char)
318 (puni-slurp-forward n)))
319 (electric-pair-mode)
320 (add-hook* '(prog-mode-hook
321 ielm-mode-hook)
322 #'puni-mode))
161 323
162(yoke hungry-delete "https://github.com/nflath/hungry-delete" 324(yoke hungry-delete "https://github.com/nflath/hungry-delete"
163 (setq hungry-delete-chars-to-skip " \t" 325 (setq hungry-delete-chars-to-skip " \t"
164 hungry-delete-join-reluctantly nil) 326 hungry-delete-join-reluctantly nil)
165 (eval-after hungry-delete 327 (eval-after hungry-delete
166 (add-to-list* 'hungry-delete-except-modes 328 (add-to-list* 'hungry-delete-except-modes
167 'eshell-mode 329 #'eshell-mode
168 'nim-mode 330 #'nim-mode
169 'python-mode)) 331 #'python-mode))
170 (defun +hungry-delete-or (hd-fn fn arg) 332 (defun +hungry-delete-or (hd-fn fn arg)
171 (funcall (if (looking-back (format "[%s]" hungry-delete-chars-to-skip) arg) 333 (funcall (if (looking-back (format "[%s]" hungry-delete-chars-to-skip) arg)
172 hd-fn 334 hd-fn
173 fn) 335 fn)
174 arg)) 336 arg))
175 (define-keys puni-mode-map 337 (define-key* puni-mode-map
176 [remap puni-backward-delete-char] 338 [remap puni-backward-delete-char]
177 (defun puni@hungry-delete-backward (arg) 339 (defun puni@hungry-delete-backward (arg)
178 (interactive "p") 340 (interactive "p")
179 (+hungry-delete-or #'hungry-delete-backward 341 (+hungry-delete-or #'hungry-delete-backward
180 #'puni-backward-delete-char 342 #'puni-backward-delete-char
181 arg)) 343 arg))
182 [remap puni-forward-delete-char] 344 [remap puni-forward-delete-char]
183 (defun puni@hungry-delete-forward (arg) 345 (defun puni@hungry-delete-forward (arg)
184 (interactive "p") 346 (interactive "p")
185 (+hungry-delete-or #'hungry-delete-forward 347 (+hungry-delete-or #'hungry-delete-forward
186 #'puni-forward-delete-char 348 #'puni-forward-delete-char
187 arg))) 349 arg)))
188 (global-hungry-delete-mode)) 350 (global-hungry-delete-mode))
189 351
190(yoke cape "https://github.com/minad/cape" 352(yoke cape "https://github.com/minad/cape"
191 (defun cape-insinuate () 353 ;; Insinuate in a lot of modes
192 (add-to-list* 'completion-at-point-functions 354 (defvar +capes '(cape-file cape-dabbrev))
193 #'cape-dabbrev 355 (defun +cape-insinuate (hook capf &optional capes)
194 #'cape-file)) 356 "Insinuate CAPES into a HOOK along with CAPF function.
195 (add-hook* '(text-mode-hook prog-mode-hook) 357CAPES defaults to `+capes'. CAPF will be made un-exclusive."
196 #'cape-insinuate)) 358 (setq-local-hook hook
359 completion-at-point-functions
360 (apply #'list (cape-capf-properties capf :exclusive 'no)
361 (or capes +capes))))
362 (+cape-insinuate 'emacs-lisp-mode-hook #'elisp-completion-at-point))
197 363
198(yoke minions "https://github.com/tarsius/minions" 364(yoke minions "https://github.com/tarsius/minions"
199 (minions-mode)) 365 (minions-mode))
@@ -204,10 +370,13 @@
204 (locate-user-emacs-file "yoke/transient/lisp")) 370 (locate-user-emacs-file "yoke/transient/lisp"))
205 (dash "https://github.com/magnars/dash.el") 371 (dash "https://github.com/magnars/dash.el")
206 (with-editor "https://github.com/magit/with-editor" 372 (with-editor "https://github.com/magit/with-editor"
207 (locate-user-emacs-file "yoke/with-editor/lisp"))) 373 (locate-user-emacs-file "yoke/with-editor/lisp")))
208 (autoload #'transient--with-suspended-override "transient") 374 (autoload #'transient--with-suspended-override "transient")
209 (autoload #'magit "magit" nil :interactive)) 375 (autoload #'magit "magit" nil :interactive))
210 376
377(yoke git-modes "https://github.com/magit/git-modes"
378 (require 'git-modes))
379
211(yoke visual-fill-column "https://codeberg.org/joostkremers/visual-fill-column" 380(yoke visual-fill-column "https://codeberg.org/joostkremers/visual-fill-column"
212 (setq visual-fill-column-center-text t) 381 (setq visual-fill-column-center-text t)
213 (add-hook* 'visual-fill-column-mode-hook #'visual-line-mode) 382 (add-hook* 'visual-fill-column-mode-hook #'visual-line-mode)
@@ -219,7 +388,8 @@
219 (locate-user-emacs-file "yoke/org-contrib/lisp"))) 388 (locate-user-emacs-file "yoke/org-contrib/lisp")))
220 ;; DON'T load system org 389 ;; DON'T load system org
221 (setq load-path 390 (setq load-path
222 (cl-remove-if (lambda (path) (string-match-p "lisp/org\\'" path)) load-path)) 391 (cl-remove-if (lambda (path) (string-match-p "lisp/org\\'" path))
392 load-path))
223 (setq org-adapt-indentation nil 393 (setq org-adapt-indentation nil
224 org-auto-align-tags t 394 org-auto-align-tags t
225 org-archive-mark-done t 395 org-archive-mark-done t
@@ -279,29 +449,24 @@
279 ("=" org-verbatim) 449 ("=" org-verbatim)
280 ("~" org-code) 450 ("~" org-code)
281 ("+" org-strikethrough))) 451 ("+" org-strikethrough)))
282 ;; (setq org-todo-keywords
283 ;; '((sequence
284 ;; "TODO(t)"
285 ;; "NEXT(n!)" ; next action
286 ;; "DONE(d)" ; done)
287 ;; (sequence
288 ;; "WAIT(w@)" ; waiting to be actionable again
289 ;; "HOLD(h@/!)" ; actinable, but will do later
290 ;; "IDEA(i)" ; maybe someday
291 ;; "KILL(k@/!)" ; cancelled, aborted or is no longer applicable
292 ;; ))))))
293 (add-hook* 'org-mode-hook 452 (add-hook* 'org-mode-hook
294 #'variable-pitch-mode 453 #'variable-pitch-mode
295 #'visual-fill-column-mode 454 #'visual-fill-column-mode
296 #'turn-off-auto-fill 455 #'turn-off-auto-fill
297 #'org-indent-mode 456 #'org-indent-mode
298 #'prettify-symbols-mode 457 #'prettify-symbols-mode
299 #'abbrev-mode) 458 #'abbrev-mode)
459 (define-local-before-save-hook org-mode
460 (org-hide-drawer-all)
461 (org-align-tags 'all))
300 (eval-after org 462 (eval-after org
301 (require '+org) 463 (require '+org)
302 (define-keys org-mode-map 464 (define-key* org-mode-map
303 "C-M-k" #'kill-paragraph 465 "C-M-k" #'kill-paragraph
304 "C-M-t" #'transpose-paragraphs) 466 "C-M-t" #'transpose-paragraphs
467 "RET" #'+org-return-dwim
468 "S-<return>" #'+org-table-copy-down|+org-return
469 "C-c C-o" #'+org-open-at-point-dwim)
305 (org-clock-persistence-insinuate))) 470 (org-clock-persistence-insinuate)))
306 471
307(yoke org-agenda nil 472(yoke org-agenda nil
@@ -323,14 +488,23 @@
323 org-agenda-show-future-repeats 'next 488 org-agenda-show-future-repeats 'next
324 org-agenda-window-setup 'current-window) 489 org-agenda-window-setup 'current-window)
325 (setq-local-hook org-agenda-mode-hook 490 (setq-local-hook org-agenda-mode-hook
326 truncate-lines t) 491 truncate-lines t
327 (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree)) 492 electric-pair-pairs (append electric-pair-pairs
493 (mapcar (lambda (e)
494 (let ((ch (string-to-char (car e))))
495 (cons ch ch)))
496 org-emphasis-alist)))
497 (add-hook* 'org-agenda-mode-hook
498 #'hl-line-mode)
499 (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree)
500 (define-key* (current-global-map)
501 "C-c c" #'org-capture
502 "C-c a" #'org-agenda))
328 503
329(yoke ox nil ; org-export 504(yoke ox nil ; org-export
330 (eval-after org (require 'ox)) 505 (eval-after org (require 'ox))
331 (eval-after ox 506 (eval-after ox
332 (require '+ox) 507 (require* '+ox '(ox-md nil t))
333 (require 'ox-md nil :noerror)
334 (+org-export-pre-hooks-insinuate)) 508 (+org-export-pre-hooks-insinuate))
335 (setq org-export-coding-system 'utf-8-unix 509 (setq org-export-coding-system 'utf-8-unix
336 org-export-headline-levels 8 510 org-export-headline-levels 8
@@ -340,6 +514,11 @@
340 org-export-with-sub-superscripts t 514 org-export-with-sub-superscripts t
341 org-export-with-toc nil)) 515 org-export-with-toc nil))
342 516
517(yoke electric-cursor "https://codeberg.org/acdw/electric-cursor.el"
518 (setq electric-cursor-alist '((overwrite-mode . hbar)
519 (t . bar)))
520 (electric-cursor-mode))
521
343(yoke _work (sync/ "emacs/private") 522(yoke _work (sync/ "emacs/private")
344 :depends ((+org-capture (locate-user-emacs-file "lisp")) 523 :depends ((+org-capture (locate-user-emacs-file "lisp"))
345 (private (locate-user-emacs-file "lisp")) 524 (private (locate-user-emacs-file "lisp"))
@@ -347,27 +526,167 @@
347 (locate-user-emacs-file "yoke/bbdb/lisp")) 526 (locate-user-emacs-file "yoke/bbdb/lisp"))
348 (bbdb-vcard "https://github.com/tohojo/bbdb-vcard/")) 527 (bbdb-vcard "https://github.com/tohojo/bbdb-vcard/"))
349 (require 'bbdb) 528 (require 'bbdb)
350 (require 'private) 529 (require* 'private 'work)
351 (require '_work)
352 (bbdb-initialize 'gnus 'message) 530 (bbdb-initialize 'gnus 'message)
353 (setq bbdb-complete-mail-allow-cycling t)) 531 (setq bbdb-complete-mail-allow-cycling t))
354 532
355(yoke org-taskwise "https://codeberg.org/acdw/org-taskwise.el") 533(yoke org-taskwise "https://codeberg.org/acdw/org-taskwise.el")
356 534
357(yoke titlecase "https://codeberg.org/acdw/titlecase.el" 535(yoke titlecase "https://codeberg.org/acdw/titlecase.el"
358 (eval-after org (require 'titlecase)) 536 (eval-after org (require* 'titlecase '+titlecase))
359 (eval-after titlecase 537 (eval-after titlecase
360 (require '+titlecase)
361 (add-to-list* 'titlecase-skip-words-regexps (rx word-boundary 538 (add-to-list* 'titlecase-skip-words-regexps (rx word-boundary
362 (+ (any upper digit)) 539 (+ (any upper digit))
363 word-boundary)))) 540 word-boundary))))
364 541
365(yoke flyspell-correct "https://github.com/duckwork/flyspell-correct" 542(yoke flyspell-correct "https://github.com/duckwork/flyspell-correct"
366 (eval-after flyspell 543 (eval-after flyspell
367 (require 'flyspell-correct) 544 (require* 'flyspell-correct
368 (require '+flyspell-correct) 545 `(+flyspell-correct ,(locate-user-emacs-file "lisp/+flyspell-correct")))
369 (define-keys flyspell-mode-map 546 (define-key* flyspell-mode-map
370 "C-;" #'flyspell-correct-wrapper 547 "C-;" #'flyspell-correct-wrapper
371 "<f7>" #'+flyspell-correct-buffer)) 548 "<f7>" #'+flyspell-correct-buffer))
372 (add-hook 'org-mode-hook #'flyspell-mode) 549 (add-hook 'org-mode-hook #'flyspell-mode)
373 (setq flyspell-correct--cr-key ";")) 550 (setq flyspell-correct--cr-key ";"))
551
552(yoke helpful "https://github.com/Wilfred/helpful"
553 :depends ((dash "https://github.com/magnars/dash.el")
554 (f "https://github.com/rejeep/f.el")
555 (s "https://github.com/magnars/s.el")
556 (elisp-refs "https://github.com/Wilfred/elisp-refs"))
557 (define-key* (current-global-map)
558 "<f1> f" #'helpful-callable
559 "<f1> v" #'helpful-variable
560 "<f1> k" #'helpful-key
561 "<f1> ." #'helpful-at-point
562 "<f1> o" #'helpful-symbol)
563 (unless (featurep 'info-look)
564 (run-with-idle-timer 1 nil (lambda ()
565 (require 'info-look)
566 (let ((inhibit-message t))
567 (info-lookup-setup-mode 'symbol
568 'emacs-lisp-mode)))))
569 (setf (alist-get "\\*helpful" display-buffer-alist nil nil #'string=)
570 '((display-buffer-in-side-window)
571 (side . bottom)
572 (window-height . 20))))
573
574(yoke hippie-completing-read
575 "https://codeberg.org/acdw/hippie-completing-read.el"
576 (define-key* (current-global-map)
577 "M-/" #'hippie-completing-read))
578
579(yoke dictionary nil ; Comes with Emacs 29!
580 (setq dictionary-server "localhost") ; Needs local dictd
581 (setf (alist-get "^\\*Dictionary\\*" display-buffer-alist nil nil #'string=)
582 '((display-buffer-in-side-window)
583 (side . bottom)
584 (window-height . 20))))
585
586(yoke anzu "https://github.com/emacsorphanage/anzu"
587 (global-anzu-mode)
588 (define-key* (current-global-map)
589 [remap query-replace] #'anzu-query-replace-regexp
590 [remap query-replace-regexp] #'anzu-query-replace)
591 (define-key* isearch-mode-map
592 [remap isearch-query-replace] #'anzu-isearch-query-replace-regexp
593 [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace)
594 (defun anzu-qr@window (fn &rest r)
595 "ADVICE to query-replace from the beginning of the window."
596 (let ((scroll-margin 0))
597 (save-excursion
598 (goto-char (window-start))
599 (apply fn r))))
600 (advice-add 'anzu-query-replace-regexp :around #'anzu-qr@window)
601 (advice-add 'anzu-query-replace :around #'anzu-qr@window))
602
603(yoke tempo nil
604 (require '+tempo))
605
606;; (yoke tempel "https://github.com/minad/tempel"
607;; ;; I would use `tempo' but it's clunkier .. :(
608;; (define-key* (current-global-map)
609;; "M-+" #'tempel-complete
610;; "M-_" #'tempel-insert)
611;; (defun tempel-capf-insinuate ()
612;; (setq-local completion-at-point-functions
613;; (cons #'tempel-expand
614;; completion-at-point-functions)))
615;; (add-hook* '(prog-mode-hook
616;; text-mode-hook)
617;; #'tempel-capf-insinuate))
618
619(yoke scule (locate-user-emacs-file "lisp")
620 (defvar scule-map (let ((map (make-sparse-keymap)))
621 (define-key map (kbd "M-u") #'scule-upcase)
622 (define-key map (kbd "M-l") #'scule-downcase)
623 (define-key map (kbd "M-c") #'scule-capitalize)
624 map)
625 "Keymap for scule twiddling.")
626 (define-key* (current-global-map)
627 "M-c" scule-map
628 "M-u" #'universal-argument)
629 (define-key universal-argument-map (kbd "M-u") #'universal-argument-more))
630
631(yoke 0x0 "https://gitlab.com/willvaughn/emacs-0x0"
632 (setf 0x0-default-server 'ttm)
633 (eval-after embark
634 (define-key* embark-region-map
635 "U" #'0x0-dwim)))
636
637(yoke filldent "https://codeberg.org/acdw/filldent.el"
638 (define-key* (current-global-map)
639 "M-q" #'filldent-unfill-toggle))
640
641(yoke avy "https://github.com/abo-abo/avy"
642 (require 'avy)
643 (setf avy-background t
644 (alist-get ?. avy-dispatch-alist)
645 (defun avy-action-embark (pt)
646 (unwind-protect
647 (save-excursion
648 (goto-char pt)
649 (embark-act))
650 (select-window
651 (cdr (ring-ref avy-ring 0))))
652 t))
653 (define-key* (current-global-map)
654 "M-j" #'avy-goto-char-timer)
655 (define-key* isearch-mode-map
656 "M-j" #'avy-isearch))
657
658(yoke frowny "https://codeberg.org/acdw/frowny.el"
659 (setf frowny-eyes (rx (any ":=") (opt "'") (? "-")))
660 (global-frowny-mode))
661
662(yoke isearch-mb "https://github.com/astoff/isearch-mb"
663 (eval-after (consult anzu)
664 (require 'isearch-mb)
665 (dolist (spec '((isearch-mb--with-buffer
666 ("M-e" . consult-isearch)
667 ("C-o" . loccur-isearch))
668 (isearch-mb--after-exit
669 ("M-%" . anzu-isearch-query-replace)
670 ("M-s l" . consult-line))))
671 (let ((isearch-mb-list (car spec))
672 (isearch-mb-binds (cdr spec)))
673 (dolist (cell isearch-mb-binds)
674 (let ((key (car cell))
675 (command (cdr cell)))
676 (when (fboundp command)
677 (add-to-list isearch-mb-list command)
678 (define-key isearch-mb-minibuffer-map (kbd key) command)))))))
679 (isearch-mb-mode))
680
681(yoke keepassxc-shim "https://codeberg.org/acdw/keepassxc-shim.el"
682 (keepassxc-shim-activate))
683
684(yoke keychain-environment "https://github.com/tarsius/keychain-environment"
685 :when (executable-find "keychain")
686 (keychain-refresh-environment))
687
688(yoke macrostep "https://github.com/joddie/macrostep"
689 (eval-after elisp-mode (require 'macrostep))
690 (define-key* '(emacs-lisp-mode-map
691 lisp-interaction-mode-map)
692 "C-c e" #'macrostep-expand))