Commit | Line | Data |
---|---|---|
dca50cf5 | 1 | ;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*- |
41d290a2 | 2 | |
4ed3a945 | 3 | ;; Copyright (C) 2018-2019 Amin Bandali <bandali@gnu.org> |
41d290a2 AB |
4 | |
5 | ;; This program is free software: you can redistribute it and/or modify | |
6 | ;; it under the terms of the GNU General Public License as published by | |
7 | ;; the Free Software Foundation, either version 3 of the License, or | |
8 | ;; (at your option) any later version. | |
9 | ||
10 | ;; This program is distributed in the hope that it will be useful, | |
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | ;; GNU General Public License for more details. | |
14 | ||
15 | ;; You should have received a copy of the GNU General Public License | |
16 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | |
17 | ||
18 | ;;; Commentary: | |
19 | ||
20 | ;; Emacs configuration of Amin Bandali, computer scientist, functional | |
dca50cf5 AB |
21 | ;; programmer, and free software activist. Used to use straight.el |
22 | ;; for purely functional and fully reproducible package management. | |
23 | ;; Now I just use Guix. | |
b57457b2 AB |
24 | |
25 | ;; Over the years, I've taken inspiration from configurations of many | |
26 | ;; great people. Some that I can remember off the top of my head are: | |
27 | ;; | |
28 | ;; - https://github.com/dieggsy/dotfiles | |
29 | ;; - https://github.com/dakra/dmacs | |
30 | ;; - http://pages.sachachua.com/.emacs.d/Sacha.html | |
31 | ;; - https://github.com/dakrone/eos | |
32 | ;; - http://doc.rix.si/cce/cce.html | |
33 | ;; - https://github.com/jwiegley/dot-emacs | |
34 | ;; - https://github.com/wasamasa/dotemacs | |
35 | ;; - https://github.com/hlissner/doom-emacs | |
41d290a2 | 36 | |
49e9503b AB |
37 | ;;; Code: |
38 | ||
b57457b2 AB |
39 | ;;; Emacs initialization |
40 | ||
dca50cf5 | 41 | (defvar b/before-user-init-time (current-time) |
41d290a2 AB |
42 | "Value of `current-time' when Emacs begins loading `user-init-file'.") |
43 | (message "Loading Emacs...done (%.3fs)" | |
dca50cf5 | 44 | (float-time (time-subtract b/before-user-init-time |
41d290a2 AB |
45 | before-init-time))) |
46 | ||
b57457b2 AB |
47 | ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' |
48 | ;; during startup to reduce garbage collection frequency. clearing | |
49 | ;; `file-name-handler-alist' seems to help reduce startup time too. | |
dca50cf5 AB |
50 | (defvar b/gc-cons-threshold gc-cons-threshold) |
51 | (defvar b/gc-cons-percentage gc-cons-percentage) | |
52 | (defvar b/file-name-handler-alist file-name-handler-alist) | |
41d290a2 AB |
53 | (setq gc-cons-threshold (* 400 1024 1024) ; 400 MiB |
54 | gc-cons-percentage 0.6 | |
55 | file-name-handler-alist nil | |
56 | ;; sidesteps a bug when profiling with esup | |
57 | esup-child-profile-require-level 0) | |
58 | ||
b57457b2 | 59 | ;; set them back to their defaults once we're done initializing |
dca50cf5 AB |
60 | (defun b/post-init () |
61 | (setq gc-cons-threshold b/gc-cons-threshold | |
62 | gc-cons-percentage b/gc-cons-percentage | |
63 | file-name-handler-alist b/file-name-handler-alist)) | |
64 | (add-hook 'after-init-hook #'b/post-init) | |
41d290a2 | 65 | |
b57457b2 | 66 | ;; increase number of lines kept in *Messages* log |
41d290a2 AB |
67 | (setq message-log-max 20000) |
68 | ||
b57457b2 AB |
69 | ;; optionally, uncomment to supress some byte-compiler warnings |
70 | ;; (see C-h v byte-compile-warnings RET for more info) | |
41d290a2 AB |
71 | ;; (setq byte-compile-warnings |
72 | ;; '(not free-vars unresolved noruntime lexical make-local)) | |
73 | ||
b57457b2 AB |
74 | \f |
75 | ;;; whoami | |
76 | ||
41d290a2 | 77 | (setq user-full-name "Amin Bandali" |
dca50cf5 | 78 | user-mail-address "bandali@gnu.org") |
41d290a2 | 79 | |
b57457b2 AB |
80 | \f |
81 | ;;; comment macro | |
82 | ||
83 | ;; useful for commenting out multiple sexps at a time | |
84 | (defmacro comment (&rest _) | |
85 | "Comment out one or more s-expressions." | |
86 | (declare (indent defun)) | |
87 | nil) | |
88 | ||
89 | \f | |
dca50cf5 | 90 | ;;; use-package |
41d290a2 AB |
91 | (if nil ; set to t when need to debug init |
92 | (progn | |
93 | (setq use-package-verbose t | |
94 | use-package-expand-minimally nil | |
95 | use-package-compute-statistics t | |
96 | debug-on-error t) | |
97 | (require 'use-package)) | |
98 | (setq use-package-verbose nil | |
99 | use-package-expand-minimally t)) | |
100 | ||
101 | (setq use-package-always-defer t) | |
102 | (require 'bind-key) | |
103 | ||
54209e74 AB |
104 | (use-package delight) |
105 | ||
b57457b2 AB |
106 | \f |
107 | ;;; Initial setup | |
108 | ||
109 | ;; keep ~/.emacs.d clean | |
dca50cf5 AB |
110 | (defvar b/etc-dir |
111 | (expand-file-name | |
112 | (convert-standard-filename "etc/") user-emacs-directory) | |
113 | "The directory where packages place their configuration files.") | |
114 | ||
115 | (defvar b/var-dir | |
116 | (expand-file-name | |
117 | (convert-standard-filename "var/") user-emacs-directory) | |
118 | "The directory where packages place their persistent data files.") | |
119 | ||
120 | (defun b/etc (file) | |
121 | "Expand filename FILE relative to `b/etc-dir'." | |
122 | (expand-file-name (convert-standard-filename file) b/etc-dir)) | |
123 | ||
124 | (defun b/var (file) | |
125 | "Expand filename FILE relative to `b/var-dir'." | |
126 | (expand-file-name (convert-standard-filename file) b/var-dir)) | |
127 | ||
128 | (setq auto-save-list-file-prefix (b/var "auto-save/sessions/")) | |
41d290a2 | 129 | |
b57457b2 | 130 | ;; separate custom file (don't want it mixing with init.el) |
dca50cf5 | 131 | (use-package custom |
41d290a2 AB |
132 | :no-require t |
133 | :config | |
dca50cf5 | 134 | (setq custom-file (b/etc "custom.el")) |
41d290a2 AB |
135 | (when (file-exists-p custom-file) |
136 | (load custom-file)) | |
b57457b2 | 137 | ;; while at it, treat themes as safe |
41d290a2 AB |
138 | (setf custom-safe-themes t)) |
139 | ||
b57457b2 | 140 | ;; load the secrets file if it exists, otherwise show a warning |
dca50cf5 AB |
141 | (comment |
142 | (with-demoted-errors | |
143 | (load (b/etc "secrets")))) | |
41d290a2 | 144 | |
b57457b2 | 145 | ;; better $PATH (and other environment variable) handling |
41d290a2 AB |
146 | (use-package exec-path-from-shell |
147 | :defer 0.4 | |
148 | :init | |
149 | (setq exec-path-from-shell-arguments nil | |
150 | exec-path-from-shell-check-startup-files nil) | |
151 | :config | |
152 | (exec-path-from-shell-initialize) | |
153 | ;; while we're at it, let's fix access to our running ssh-agent | |
154 | (exec-path-from-shell-copy-env "SSH_AGENT_PID") | |
155 | (exec-path-from-shell-copy-env "SSH_AUTH_SOCK")) | |
156 | ||
b57457b2 AB |
157 | ;; only one custom theme at a time |
158 | (comment | |
159 | (defadvice load-theme (before clear-previous-themes activate) | |
160 | "Clear existing theme settings instead of layering them" | |
161 | (mapc #'disable-theme custom-enabled-themes))) | |
162 | ||
163 | ;; start up emacs server. see | |
164 | ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server | |
dca50cf5 | 165 | (use-package server |
41d290a2 AB |
166 | :defer 0.4 |
167 | :config (or (server-running-p) (server-mode))) | |
168 | ||
b57457b2 AB |
169 | ;; unicode support |
170 | (comment | |
171 | (dolist (ft (fontset-list)) | |
172 | (set-fontset-font | |
173 | ft | |
174 | 'unicode | |
175 | (font-spec :name "Source Code Pro" :size 14)) | |
176 | (set-fontset-font | |
177 | ft | |
178 | 'unicode | |
179 | (font-spec :name "DejaVu Sans Mono") | |
180 | nil | |
181 | 'append) | |
182 | ;; (set-fontset-font | |
183 | ;; ft | |
184 | ;; 'unicode | |
185 | ;; (font-spec | |
186 | ;; :name "Symbola monospacified for DejaVu Sans Mono") | |
187 | ;; nil | |
188 | ;; 'append) | |
189 | ;; (set-fontset-font | |
190 | ;; ft | |
191 | ;; #x2115 ; ℕ | |
192 | ;; (font-spec :name "DejaVu Sans Mono") | |
193 | ;; nil | |
194 | ;; 'append) | |
195 | (set-fontset-font | |
196 | ft | |
197 | (cons ?Α ?ω) | |
198 | (font-spec :name "DejaVu Sans Mono" :size 14) | |
199 | nil | |
200 | 'prepend))) | |
201 | ||
202 | ;; gentler font resizing | |
41d290a2 AB |
203 | (setq text-scale-mode-step 1.05) |
204 | ||
b57457b2 | 205 | ;; focus follows mouse |
41d290a2 AB |
206 | (setq mouse-autoselect-window t) |
207 | ||
dca50cf5 | 208 | (defun b/no-mouse-autoselect-window () |
b57457b2 AB |
209 | "Conveniently disable `focus-follows-mouse'. |
210 | For disabling the behaviour for certain buffers and/or modes." | |
41d290a2 AB |
211 | (make-local-variable 'mouse-autoselect-window) |
212 | (setq mouse-autoselect-window nil)) | |
213 | ||
b57457b2 | 214 | ;; better scrolling |
41d290a2 AB |
215 | (setq ;; scroll-margin 1 |
216 | ;; scroll-conservatively 10000 | |
217 | scroll-step 1 | |
218 | scroll-conservatively 10 | |
219 | scroll-preserve-screen-position 1) | |
220 | ||
dca50cf5 | 221 | (use-package mwheel |
41d290a2 AB |
222 | :defer 0.4 |
223 | :config | |
224 | (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)) ; one line at a time | |
225 | mouse-wheel-progressive-speed nil ; don't accelerate scrolling | |
226 | mouse-wheel-follow-mouse t)) ; scroll window under mouse | |
227 | ||
dca50cf5 | 228 | (use-package pixel-scroll |
41d290a2 AB |
229 | :defer 0.4 |
230 | :config (pixel-scroll-mode 1)) | |
231 | ||
b57457b2 | 232 | ;; ask for GPG passphrase in minibuffer |
dca50cf5 AB |
233 | (use-package epa |
234 | :custom | |
235 | ; this will fail if gpg>=2.1 is not available | |
236 | (epa-pinentry-mode 'loopback)) | |
237 | ||
238 | (use-package epg-config | |
9fc30d4c AB |
239 | :defer 0.4 |
240 | :custom | |
241 | ((epg-gpg-program (executable-find "gpg")) | |
242 | (epg-pinentry-mode 'loopback))) | |
dca50cf5 AB |
243 | |
244 | (use-package epg | |
9fc30d4c | 245 | :after epg-config) |
dca50cf5 | 246 | |
9fc30d4c AB |
247 | (use-package pinentry |
248 | :demand | |
dca50cf5 | 249 | :after (epa epg server) |
9fc30d4c AB |
250 | :config |
251 | (setq pinentry--socket-dir server-socket-dir) | |
252 | (pinentry-start)) | |
41d290a2 | 253 | |
b57457b2 | 254 | ;; useful libraries |
41d290a2 AB |
255 | (require 'cl-lib) |
256 | (require 'subr-x) | |
257 | ||
b57457b2 AB |
258 | \f |
259 | ;;; Useful utilities | |
260 | ||
dca50cf5 | 261 | (defmacro b/setq-every (value &rest vars) |
41d290a2 AB |
262 | "Set all the variables from VARS to value VALUE." |
263 | (declare (indent defun) (debug t)) | |
264 | `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))) | |
265 | ||
dca50cf5 | 266 | (defun b/start-process (program &rest args) |
41d290a2 AB |
267 | "Same as `start-process', but doesn't bother about name and buffer." |
268 | (let ((process-name (concat program "_process")) | |
269 | (buffer-name (generate-new-buffer-name | |
270 | (concat program "_output")))) | |
271 | (apply #'start-process | |
272 | process-name buffer-name program args))) | |
273 | ||
dca50cf5 | 274 | (defun b/dired-start-process (program &optional args) |
41d290a2 AB |
275 | "Open current file with a PROGRAM." |
276 | ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can | |
277 | ;; be nil, so remove it). | |
dca50cf5 | 278 | (apply #'b/start-process |
41d290a2 AB |
279 | program |
280 | (remove nil (list args (dired-get-file-for-visit))))) | |
281 | ||
dca50cf5 | 282 | (defun b/add-elisp-section () |
b57457b2 AB |
283 | (interactive) |
284 | (insert "\n") | |
285 | (previous-line) | |
286 | (insert "\n\f\n;;; ")) | |
287 | ||
288 | \f | |
289 | ;;; Defaults | |
290 | ||
291 | ;; time and battery in mode-line | |
292 | (comment | |
293 | (use-package time | |
294 | :init | |
295 | (setq display-time-default-load-average nil) | |
296 | :config | |
297 | (display-time-mode)) | |
298 | ||
299 | (use-package battery | |
300 | :config | |
301 | (display-battery-mode))) | |
302 | ||
303 | ;; smaller fringe | |
41d290a2 AB |
304 | ;; (fringe-mode '(3 . 1)) |
305 | (fringe-mode nil) | |
306 | ||
b57457b2 | 307 | ;; disable disabled commands |
41d290a2 AB |
308 | (setq disabled-command-function nil) |
309 | ||
b57457b2 AB |
310 | ;; Save what I copy into clipboard from other applications into Emacs' |
311 | ;; kill-ring, which would allow me to still be able to easily access | |
312 | ;; it in case I kill (cut or copy) something else inside Emacs before | |
313 | ;; yanking (pasting) what I'd originally intended to. | |
41d290a2 AB |
314 | (setq save-interprogram-paste-before-kill t) |
315 | ||
b57457b2 | 316 | ;; minibuffer |
41d290a2 AB |
317 | (setq enable-recursive-minibuffers t |
318 | resize-mini-windows t) | |
319 | ||
b57457b2 | 320 | ;; lazy-person-friendly yes/no prompts |
41d290a2 AB |
321 | (defalias 'yes-or-no-p #'y-or-n-p) |
322 | ||
b57457b2 | 323 | ;; i want *scratch* as my startup buffer |
41d290a2 AB |
324 | (setq initial-buffer-choice t) |
325 | ||
b57457b2 | 326 | ;; i don't need the default hint |
41d290a2 AB |
327 | (setq initial-scratch-message nil) |
328 | ||
b57457b2 | 329 | ;; use customizable text-mode as major mode for *scratch* |
41d290a2 AB |
330 | (setq initial-major-mode 'text-mode) |
331 | ||
b57457b2 | 332 | ;; inhibit buffer list when more than 2 files are loaded |
41d290a2 AB |
333 | (setq inhibit-startup-buffer-menu t) |
334 | ||
b57457b2 | 335 | ;; don't need to see the startup screen or the echo area message |
41d290a2 AB |
336 | (advice-add #'display-startup-echo-area-message :override #'ignore) |
337 | (setq inhibit-startup-screen t | |
338 | inhibit-startup-echo-area-message user-login-name) | |
339 | ||
b57457b2 | 340 | ;; more useful frame titles |
41d290a2 AB |
341 | (setq frame-title-format |
342 | '("" invocation-name " - " | |
343 | (:eval (if (buffer-file-name) | |
344 | (abbreviate-file-name (buffer-file-name)) | |
345 | "%b")))) | |
346 | ||
b57457b2 | 347 | ;; backups (C-h v make-backup-files RET) |
41d290a2 | 348 | (setq backup-by-copying t |
dca50cf5 | 349 | backup-directory-alist (list (cons "." (b/var "backup/"))) |
41d290a2 AB |
350 | version-control t |
351 | delete-old-versions t) | |
352 | ||
b57457b2 | 353 | ;; enable automatic reloading of changed buffers and files |
41d290a2 AB |
354 | (global-auto-revert-mode 1) |
355 | (setq auto-revert-verbose nil | |
356 | global-auto-revert-non-file-buffers nil) | |
357 | ||
b57457b2 | 358 | ;; always use space for indentation |
41d290a2 AB |
359 | (setq-default |
360 | indent-tabs-mode nil | |
361 | require-final-newline t | |
362 | tab-width 4) | |
363 | ||
b57457b2 | 364 | ;; enable winner-mode (C-h f winner-mode RET) |
41d290a2 AB |
365 | (winner-mode 1) |
366 | ||
b57457b2 AB |
367 | ;; don't display *compilation* buffer on success. based on |
368 | ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf' | |
369 | ;; instead of the now obsolete `flet'. | |
41d290a2 | 370 | (with-eval-after-load 'compile |
dca50cf5 | 371 | (defun b/compilation-finish-function (buffer outstr) |
41d290a2 AB |
372 | (unless (string-match "finished" outstr) |
373 | (switch-to-buffer-other-window buffer)) | |
374 | t) | |
375 | ||
dca50cf5 | 376 | (setq compilation-finish-functions #'b/compilation-finish-function) |
41d290a2 AB |
377 | |
378 | (require 'cl-macs) | |
379 | ||
380 | (defadvice compilation-start | |
381 | (around inhibit-display | |
382 | (command &optional mode name-function highlight-regexp)) | |
383 | (if (not (string-match "^\\(find\\|grep\\)" command)) | |
384 | (cl-letf (((symbol-function 'display-buffer) #'ignore)) | |
385 | (save-window-excursion ad-do-it)) | |
386 | ad-do-it)) | |
387 | (ad-activate 'compilation-start)) | |
388 | ||
b57457b2 AB |
389 | ;; search for non-ASCII characters: i’d like non-ASCII characters such |
390 | ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII | |
391 | ;; counterpart. shoutout to | |
392 | ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html | |
41d290a2 | 393 | (setq search-default-mode #'char-fold-to-regexp) |
41d290a2 AB |
394 | ;; uncomment to extend this behaviour to query-replace |
395 | ;; (setq replace-char-fold t) | |
396 | ||
b57457b2 | 397 | ;; cursor shape |
41d290a2 AB |
398 | (setq-default cursor-type 'bar) |
399 | ||
b57457b2 | 400 | ;; allow scrolling in Isearch |
41d290a2 AB |
401 | (setq isearch-allow-scroll t) |
402 | ||
b9901074 AB |
403 | ;; open read-only file buffers in view-mode |
404 | ;; (enables niceties like `q' for quit) | |
405 | (setq view-read-only t) | |
406 | ||
dca50cf5 | 407 | (use-package vc |
b1a5d811 AB |
408 | :bind ("C-x v C-=" . vc-ediff)) |
409 | ||
dca50cf5 | 410 | (use-package ediff |
b1a5d811 AB |
411 | :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) |
412 | :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) | |
413 | (ediff-split-window-function 'split-window-horizontally))) | |
414 | ||
b57457b2 AB |
415 | \f |
416 | ;;; General bindings | |
417 | ||
41d290a2 AB |
418 | (bind-keys |
419 | ("C-c a i" . ielm) | |
420 | ||
421 | ("C-c e b" . eval-buffer) | |
422 | ("C-c e r" . eval-region) | |
423 | ||
424 | ("C-c e i" . emacs-init-time) | |
425 | ("C-c e u" . emacs-uptime) | |
dca50cf5 | 426 | ("C-c e v" . emacs-version) |
41d290a2 AB |
427 | |
428 | ("C-c F m" . make-frame-command) | |
429 | ("C-c F d" . delete-frame) | |
435306f6 | 430 | ("C-c F D" . server-edit) |
41d290a2 | 431 | |
41d290a2 AB |
432 | ("C-S-h C" . describe-char) |
433 | ("C-S-h F" . describe-face) | |
434 | ||
435 | ("C-x k" . kill-this-buffer) | |
436 | ("C-x K" . kill-buffer) | |
437 | ||
438 | ("s-p" . beginning-of-buffer) | |
b57457b2 AB |
439 | ("s-n" . end-of-buffer) |
440 | ||
526dc1d9 AB |
441 | ("M-O" . facemenu-keymap) |
442 | ||
b57457b2 | 443 | :map emacs-lisp-mode-map |
dca50cf5 | 444 | ("<C-return>" . b/add-elisp-section)) |
41d290a2 AB |
445 | |
446 | (when (display-graphic-p) | |
447 | (unbind-key "C-z" global-map)) | |
448 | ||
500004f4 AB |
449 | (bind-keys |
450 | ;; for back and forward mouse keys | |
451 | ("<mouse-8>" . previous-buffer) | |
452 | ("<drag-mouse-8>" . previous-buffer) | |
453 | ("<mouse-9>" . next-buffer) | |
454 | ("<drag-mouse-9>" . next-buffer) | |
455 | ("<drag-mouse-2>" . kill-this-buffer) | |
456 | ("<drag-mouse-3>" . ivy-switch-buffer)) | |
457 | ||
b57457b2 AB |
458 | \f |
459 | ;;; Essential packages | |
460 | ||
dca50cf5 | 461 | (use-package org |
41d290a2 AB |
462 | :defer 0.5 |
463 | :config | |
464 | (setq org-src-tab-acts-natively t | |
465 | org-src-preserve-indentation nil | |
466 | org-edit-src-content-indentation 0 | |
467 | org-link-email-description-format "Email %c: %s" ; %.30s | |
468 | org-highlight-latex-and-related '(entities) | |
469 | org-use-speed-commands t | |
470 | org-startup-folded 'content | |
471 | org-catch-invisible-edits 'show-and-error | |
472 | org-log-done 'time) | |
473 | (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) | |
506ba717 | 474 | (add-to-list 'org-modules 'org-habit) |
41d290a2 AB |
475 | :bind |
476 | (("C-c a o a" . org-agenda) | |
477 | :map org-mode-map | |
478 | ("M-L" . org-insert-last-stored-link) | |
34c6cf4c | 479 | ("M-O" . org-toggle-link-display) |
41d290a2 AB |
480 | ("s-T" . org-todo)) |
481 | :hook ((org-mode . org-indent-mode) | |
482 | (org-mode . auto-fill-mode) | |
483 | (org-mode . flyspell-mode)) | |
484 | :custom | |
485 | (org-agenda-files '("~/usr/org/todos/personal.org" | |
506ba717 | 486 | "~/usr/org/todos/habits.org" |
41d290a2 AB |
487 | "~/usr/org/todos/masters.org")) |
488 | (org-agenda-start-on-weekday 0) | |
506ba717 AB |
489 | (org-agenda-time-leading-zero t) |
490 | (org-habit-graph-column 44) | |
41d290a2 AB |
491 | (org-latex-packages-alist '(("" "listings") ("" "color"))) |
492 | :custom-face | |
493 | '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21")))) | |
494 | '(org-block ((t (:background "#1d1f21")))) | |
495 | '(org-latex-and-related ((t (:foreground "#b294bb"))))) | |
496 | ||
dca50cf5 | 497 | (use-package ox-latex |
41d290a2 AB |
498 | :after ox |
499 | :config | |
500 | (setq org-latex-listings 'listings | |
501 | ;; org-latex-prefer-user-labels t | |
502 | ) | |
503 | (add-to-list 'org-latex-classes | |
504 | '("IEEEtran" "\\documentclass[11pt]{IEEEtran}" | |
505 | ("\\section{%s}" . "\\section*{%s}") | |
506 | ("\\subsection{%s}" . "\\subsection*{%s}") | |
507 | ("\\subsubsection{%s}" . "\\subsubsection*{%s}") | |
508 | ("\\paragraph{%s}" . "\\paragraph*{%s}") | |
509 | ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) | |
510 | t) | |
511 | (require 'ox-beamer)) | |
512 | ||
dca50cf5 | 513 | (use-package ox-extra |
41d290a2 AB |
514 | :config |
515 | (ox-extras-activate '(latex-header-blocks ignore-headlines))) | |
516 | ||
b57457b2 AB |
517 | ;; asynchronous tangle, using emacs-async to asynchronously tangle an |
518 | ;; org file. closely inspired by | |
519 | ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles | |
41d290a2 | 520 | (with-eval-after-load 'org |
dca50cf5 | 521 | (defvar b/show-async-tangle-results nil |
41d290a2 AB |
522 | "Keep *emacs* async buffers around for later inspection.") |
523 | ||
dca50cf5 | 524 | (defvar b/show-async-tangle-time nil |
41d290a2 AB |
525 | "Show the time spent tangling the file.") |
526 | ||
dca50cf5 | 527 | (defun b/async-babel-tangle () |
41d290a2 AB |
528 | "Tangle org file asynchronously." |
529 | (interactive) | |
530 | (let* ((file-tangle-start-time (current-time)) | |
531 | (file (buffer-file-name)) | |
532 | (file-nodir (file-name-nondirectory file)) | |
533 | ;; (async-quiet-switch "-q") | |
534 | (file-noext (file-name-sans-extension file))) | |
535 | (async-start | |
536 | `(lambda () | |
537 | (require 'org) | |
538 | (org-babel-tangle-file ,file)) | |
dca50cf5 | 539 | (unless b/show-async-tangle-results |
41d290a2 AB |
540 | `(lambda (result) |
541 | (if result | |
29ea9439 AB |
542 | (message "Tangled %s%s" |
543 | ,file-nodir | |
dca50cf5 | 544 | (if b/show-async-tangle-time |
29ea9439 AB |
545 | (format " (%.3fs)" |
546 | (float-time (time-subtract (current-time) | |
547 | ',file-tangle-start-time))) | |
548 | "")) | |
41d290a2 AB |
549 | (message "Tangling %s failed" ,file-nodir)))))))) |
550 | ||
551 | (add-to-list | |
552 | 'safe-local-variable-values | |
dca50cf5 | 553 | '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local)) |
41d290a2 | 554 | |
b57457b2 | 555 | ;; *the* right way to do git |
41d290a2 AB |
556 | (use-package magit |
557 | :defer 0.5 | |
558 | :bind (("C-x g" . magit-status) | |
559 | ("s-g s" . magit-status) | |
560 | ("s-g l" . magit-log-buffer-file)) | |
561 | :config | |
562 | (magit-add-section-hook 'magit-status-sections-hook | |
563 | 'magit-insert-modules | |
564 | 'magit-insert-stashes | |
565 | 'append) | |
566 | (setq magit-repository-directories '(("~/" . 0) | |
567 | ("~/src/git/" . 1))) | |
568 | (nconc magit-section-initial-visibility-alist | |
569 | '(([unpulled status] . show) | |
570 | ([unpushed status] . show))) | |
afbbf23a | 571 | :custom (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) |
41d290a2 AB |
572 | :custom-face (magit-diff-file-heading ((t (:weight normal))))) |
573 | ||
b57457b2 | 574 | ;; recently opened files |
dca50cf5 | 575 | (use-package recentf |
41d290a2 | 576 | :defer 0.2 |
dca50cf5 | 577 | ;; :config |
9424b3d6 | 578 | ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") |
dca50cf5 AB |
579 | :custom |
580 | (recentf-max-saved-items 2000) | |
581 | (recentf-save-file (b/var "recentf-save.el"))) | |
41d290a2 | 582 | |
b57457b2 | 583 | ;; smart M-x enhancement (needed by counsel for history) |
41d290a2 AB |
584 | (use-package smex) |
585 | ||
586 | (use-package ivy | |
587 | :defer 0.3 | |
54209e74 | 588 | :delight ;; " 🙒" |
41d290a2 AB |
589 | :bind |
590 | (:map ivy-minibuffer-map | |
591 | ([escape] . keyboard-escape-quit) | |
592 | ([S-up] . ivy-previous-history-element) | |
593 | ([S-down] . ivy-next-history-element) | |
594 | ("DEL" . ivy-backward-delete-char)) | |
595 | :config | |
596 | (setq ivy-wrap t | |
597 | ivy-height 14 | |
598 | ivy-use-virtual-buffers t | |
599 | ivy-virtual-abbreviate 'abbreviate | |
600 | ivy-count-format "%d/%d ") | |
601 | (ivy-mode 1) | |
602 | ;; :custom-face | |
603 | ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold)))) | |
604 | ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold)))) | |
605 | ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold)))) | |
606 | ) | |
607 | ||
608 | (use-package swiper | |
609 | :after ivy | |
610 | :bind (("C-s" . swiper-isearch) | |
611 | ("C-r" . swiper) | |
612 | ("C-S-s" . isearch-forward))) | |
613 | ||
614 | (use-package counsel | |
615 | :after ivy | |
54209e74 | 616 | :delight |
41d290a2 AB |
617 | :bind (([remap execute-extended-command] . counsel-M-x) |
618 | ([remap find-file] . counsel-find-file) | |
619 | ("C-c x" . counsel-M-x) | |
620 | ("C-c f ." . counsel-find-file) | |
621 | ("C-c f l" . counsel-find-library) | |
2b53c994 AB |
622 | ("C-c f r" . counsel-recentf) |
623 | ("s-." . counsel-find-file) | |
624 | ("s-r" . ivy-switch-buffer) | |
41d290a2 AB |
625 | :map minibuffer-local-map |
626 | ("C-r" . counsel-minibuffer-history)) | |
627 | :config | |
628 | (counsel-mode 1) | |
629 | (defalias 'locate #'counsel-locate)) | |
630 | ||
b57457b2 AB |
631 | (comment |
632 | (use-package helm | |
633 | :commands (helm-M-x helm-mini helm-resume) | |
634 | :bind (("M-x" . helm-M-x) | |
635 | ("M-y" . helm-show-kill-ring) | |
636 | ("C-x b" . helm-mini) | |
637 | ("C-x C-b" . helm-buffers-list) | |
638 | ("C-x C-f" . helm-find-files) | |
639 | ("C-h r" . helm-info-emacs) | |
640 | ("s-r" . helm-recentf) | |
641 | ("C-s-r" . helm-resume) | |
642 | :map helm-map | |
643 | ("<tab>" . helm-execute-persistent-action) | |
644 | ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals | |
645 | ("C-z" . helm-select-action)) ; List actions | |
646 | :config (helm-mode 1))) | |
647 | ||
dca50cf5 | 648 | (use-package eshell |
41d290a2 AB |
649 | :defer 0.5 |
650 | :commands eshell | |
651 | :bind ("C-c a s e" . eshell) | |
652 | :config | |
653 | (eval-when-compile (defvar eshell-prompt-regexp)) | |
dca50cf5 | 654 | (defun b/eshell-quit-or-delete-char (arg) |
41d290a2 AB |
655 | (interactive "p") |
656 | (if (and (eolp) (looking-back eshell-prompt-regexp nil)) | |
657 | (eshell-life-is-too-much) | |
658 | (delete-char arg))) | |
659 | ||
dca50cf5 | 660 | (defun b/eshell-clear () |
41d290a2 AB |
661 | (interactive) |
662 | (let ((inhibit-read-only t)) | |
663 | (erase-buffer)) | |
664 | (eshell-send-input)) | |
665 | ||
dca50cf5 | 666 | (defun b/eshell-setup () |
41d290a2 AB |
667 | (make-local-variable 'company-idle-delay) |
668 | (defvar company-idle-delay) | |
669 | (setq company-idle-delay nil) | |
670 | (bind-keys :map eshell-mode-map | |
dca50cf5 AB |
671 | ("C-d" . b/eshell-quit-or-delete-char) |
672 | ("C-S-l" . b/eshell-clear) | |
41d290a2 AB |
673 | ("M-r" . counsel-esh-history) |
674 | ([tab] . company-complete))) | |
675 | ||
dca50cf5 | 676 | :hook (eshell-mode . b/eshell-setup) |
41d290a2 | 677 | :custom |
dca50cf5 | 678 | (eshell-directory-name (b/var "eshell/")) |
41d290a2 AB |
679 | (eshell-hist-ignoredups t) |
680 | (eshell-input-filter 'eshell-input-filter-initial-space)) | |
681 | ||
dca50cf5 | 682 | (use-package ibuffer |
41d290a2 AB |
683 | :bind |
684 | (("C-x C-b" . ibuffer-other-window) | |
685 | :map ibuffer-mode-map | |
686 | ("P" . ibuffer-backward-filter-group) | |
687 | ("N" . ibuffer-forward-filter-group) | |
688 | ("M-p" . ibuffer-do-print) | |
689 | ("M-n" . ibuffer-do-shell-command-pipe-replace)) | |
690 | :config | |
691 | ;; Use human readable Size column instead of original one | |
692 | (define-ibuffer-column size-h | |
693 | (:name "Size" :inline t) | |
694 | (cond | |
695 | ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) | |
696 | ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0))) | |
697 | ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) | |
698 | (t (format "%8d" (buffer-size))))) | |
699 | :custom | |
700 | (ibuffer-saved-filter-groups | |
701 | '(("default" | |
702 | ("dired" (mode . dired-mode)) | |
703 | ("org" (mode . org-mode)) | |
704 | ("gnus" | |
705 | (or | |
706 | (mode . gnus-group-mode) | |
707 | (mode . gnus-summary-mode) | |
708 | (mode . gnus-article-mode) | |
709 | ;; not really, but... | |
710 | (mode . message-mode))) | |
711 | ("web" | |
712 | (or | |
713 | (mode . web-mode) | |
714 | (mode . css-mode) | |
715 | (mode . scss-mode) | |
716 | (mode . js2-mode))) | |
717 | ("shell" | |
718 | (or | |
719 | (mode . eshell-mode) | |
720 | (mode . shell-mode) | |
721 | (mode . term-mode))) | |
722 | ("programming" | |
723 | (or | |
724 | (mode . python-mode) | |
725 | (mode . c-mode) | |
726 | (mode . c++-mode) | |
727 | (mode . java-mode) | |
728 | (mode . emacs-lisp-mode) | |
729 | (mode . scheme-mode) | |
730 | (mode . haskell-mode) | |
731 | (mode . lean-mode) | |
99473567 | 732 | (mode . go-mode) |
41d290a2 AB |
733 | (mode . alloy-mode))) |
734 | ("tex" | |
735 | (or | |
736 | (mode . bibtex-mode) | |
737 | (mode . latex-mode))) | |
738 | ("emacs" | |
739 | (or | |
740 | (name . "^\\*scratch\\*$") | |
741 | (name . "^\\*Messages\\*$"))) | |
742 | ("erc" (mode . erc-mode))))) | |
743 | (ibuffer-formats | |
744 | '((mark modified read-only locked " " | |
745 | (name 18 18 :left :elide) | |
746 | " " | |
747 | (size-h 9 -1 :right) | |
748 | " " | |
749 | (mode 16 16 :left :elide) | |
750 | " " filename-and-process) | |
751 | (mark " " | |
752 | (name 16 -1) | |
753 | " " filename))) | |
754 | :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default")))) | |
755 | ||
dca50cf5 | 756 | (use-package outline |
41d290a2 | 757 | :hook (prog-mode . outline-minor-mode) |
54209e74 | 758 | :delight (outline-minor-mode " outl") |
41d290a2 AB |
759 | :bind |
760 | (:map | |
761 | outline-minor-mode-map | |
762 | ("<s-tab>" . outline-toggle-children) | |
763 | ("M-p" . outline-previous-visible-heading) | |
764 | ("M-n" . outline-next-visible-heading) | |
dca50cf5 | 765 | :prefix-map b/outline-prefix-map |
ed8c4fa9 | 766 | :prefix "s-O" |
41d290a2 AB |
767 | ("TAB" . outline-toggle-children) |
768 | ("a" . outline-hide-body) | |
769 | ("H" . outline-hide-body) | |
770 | ("S" . outline-show-all) | |
771 | ("h" . outline-hide-subtree) | |
772 | ("s" . outline-show-subtree))) | |
773 | ||
dca50cf5 | 774 | (use-package ls-lisp |
41d290a2 AB |
775 | :custom (ls-lisp-dirs-first t)) |
776 | ||
dca50cf5 | 777 | (use-package dired |
41d290a2 AB |
778 | :config |
779 | (setq dired-listing-switches "-alh" | |
780 | ls-lisp-use-insert-directory-program nil) | |
781 | ||
782 | ;; easily diff 2 marked files | |
783 | ;; https://oremacs.com/2017/03/18/dired-ediff/ | |
784 | (defun dired-ediff-files () | |
785 | (interactive) | |
786 | (require 'dired-aux) | |
787 | (defvar ediff-after-quit-hook-internal) | |
788 | (let ((files (dired-get-marked-files)) | |
789 | (wnd (current-window-configuration))) | |
790 | (if (<= (length files) 2) | |
791 | (let ((file1 (car files)) | |
792 | (file2 (if (cdr files) | |
793 | (cadr files) | |
794 | (read-file-name | |
795 | "file: " | |
796 | (dired-dwim-target-directory))))) | |
797 | (if (file-newer-than-file-p file1 file2) | |
798 | (ediff-files file2 file1) | |
799 | (ediff-files file1 file2)) | |
800 | (add-hook 'ediff-after-quit-hook-internal | |
801 | (lambda () | |
802 | (setq ediff-after-quit-hook-internal nil) | |
803 | (set-window-configuration wnd)))) | |
804 | (error "no more than 2 files should be marked")))) | |
06ee5a00 AB |
805 | |
806 | (require 'dired-x) | |
807 | (setq dired-guess-shell-alist-user | |
808 | '(("\\.pdf\\'" "evince" "zathura" "okular") | |
809 | ("\\.doc\\'" "libreoffice") | |
810 | ("\\.docx\\'" "libreoffice") | |
811 | ("\\.ppt\\'" "libreoffice") | |
812 | ("\\.pptx\\'" "libreoffice") | |
813 | ("\\.xls\\'" "libreoffice") | |
814 | ("\\.xlsx\\'" "libreoffice") | |
815 | ("\\.flac\\'" "mpv"))) | |
41d290a2 AB |
816 | :bind (:map dired-mode-map |
817 | ("b" . dired-up-directory) | |
818 | ("e" . dired-ediff-files) | |
819 | ("E" . dired-toggle-read-only) | |
820 | ("\\" . dired-hide-details-mode) | |
821 | ("z" . (lambda () | |
822 | (interactive) | |
dca50cf5 | 823 | (b/dired-start-process "zathura")))) |
41d290a2 AB |
824 | :hook (dired-mode . dired-hide-details-mode)) |
825 | ||
dca50cf5 | 826 | (use-package help |
41d290a2 AB |
827 | :config |
828 | (temp-buffer-resize-mode) | |
829 | (setq help-window-select t)) | |
830 | ||
dca50cf5 | 831 | (use-package tramp |
41d290a2 AB |
832 | :config |
833 | (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) | |
834 | (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) | |
835 | (add-to-list 'tramp-default-proxies-alist | |
836 | (list (regexp-quote (system-name)) nil nil))) | |
837 | ||
838 | (use-package dash | |
839 | :config (dash-enable-font-lock)) | |
840 | ||
841 | (use-package doc-view | |
842 | :bind (:map doc-view-mode-map | |
843 | ("M-RET" . image-previous-line))) | |
844 | ||
b57457b2 AB |
845 | \f |
846 | ;;; Editing | |
847 | ||
848 | ;; highlight uncommitted changes in the left fringe | |
41d290a2 | 849 | (use-package diff-hl |
df1c9bc8 | 850 | :defer 0.6 |
41d290a2 AB |
851 | :config |
852 | (setq diff-hl-draw-borders nil) | |
853 | (global-diff-hl-mode) | |
854 | :hook (magit-post-refresh . diff-hl-magit-post-refresh)) | |
855 | ||
b57457b2 | 856 | ;; display Lisp objects at point in the echo area |
dca50cf5 | 857 | (use-package eldoc |
41d290a2 | 858 | :when (version< "25" emacs-version) |
54209e74 | 859 | :delight " eldoc" |
41d290a2 AB |
860 | :config (global-eldoc-mode)) |
861 | ||
b57457b2 | 862 | ;; highlight matching parens |
dca50cf5 | 863 | (use-package paren |
41d290a2 AB |
864 | :demand |
865 | :config (show-paren-mode)) | |
866 | ||
dca50cf5 | 867 | (use-package elec-pair |
40eddfea AB |
868 | :demand |
869 | :config (electric-pair-mode)) | |
870 | ||
dca50cf5 | 871 | (use-package simple |
54209e74 | 872 | :delight (auto-fill-function " fill") |
41d290a2 AB |
873 | :config (column-number-mode)) |
874 | ||
b57457b2 | 875 | ;; save minibuffer history |
dca50cf5 AB |
876 | (use-package savehist |
877 | :config | |
878 | (savehist-mode) | |
879 | :custom | |
880 | (savehist-file (b/var "savehist.el"))) | |
41d290a2 | 881 | |
b57457b2 | 882 | ;; automatically save place in files |
dca50cf5 | 883 | (use-package saveplace |
41d290a2 | 884 | :when (version< "25" emacs-version) |
dca50cf5 AB |
885 | :config (save-place-mode) |
886 | :custom | |
887 | (save-place-file (b/var "save-place.el"))) | |
41d290a2 | 888 | |
dca50cf5 | 889 | (use-package prog-mode |
41d290a2 AB |
890 | :config (global-prettify-symbols-mode) |
891 | (defun indicate-buffer-boundaries-left () | |
892 | (setq indicate-buffer-boundaries 'left)) | |
893 | (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left)) | |
894 | ||
dca50cf5 | 895 | (use-package text-mode |
54209e74 | 896 | :hook (text-mode . indicate-buffer-boundaries-left)) |
41d290a2 | 897 | |
dca50cf5 | 898 | (use-package conf-mode |
300b7363 AB |
899 | :mode "\\.*rc$") |
900 | ||
dca50cf5 | 901 | (use-package sh-mode |
300b7363 AB |
902 | :mode "\\.bashrc$") |
903 | ||
41d290a2 AB |
904 | (use-package company |
905 | :defer 0.6 | |
0c53f5ae | 906 | :delight " comp" |
41d290a2 AB |
907 | :bind |
908 | (:map company-active-map | |
909 | ([tab] . company-complete-common-or-cycle) | |
910 | ([escape] . company-abort)) | |
911 | :custom | |
912 | (company-minimum-prefix-length 1) | |
913 | (company-selection-wrap-around t) | |
914 | (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]") | |
915 | (company-dabbrev-downcase nil) | |
916 | (company-dabbrev-ignore-case nil) | |
917 | :config | |
918 | (global-company-mode t)) | |
919 | ||
920 | (use-package flycheck | |
921 | :defer 0.6 | |
922 | :hook (prog-mode . flycheck-mode) | |
923 | :bind | |
924 | (:map flycheck-mode-map | |
925 | ("M-P" . flycheck-previous-error) | |
926 | ("M-N" . flycheck-next-error)) | |
927 | :config | |
928 | ;; Use the load-path from running Emacs when checking elisp files | |
929 | (setq flycheck-emacs-lisp-load-path 'inherit) | |
930 | ||
931 | ;; Only flycheck when I actually save the buffer | |
54209e74 AB |
932 | (setq flycheck-check-syntax-automatically '(mode-enabled save)) |
933 | :custom (flycheck-mode-line-prefix "flyc")) | |
934 | ||
dca50cf5 | 935 | (use-package flyspell |
54209e74 | 936 | :delight " flysp") |
41d290a2 AB |
937 | |
938 | ;; http://endlessparentheses.com/ispell-and-apostrophes.html | |
939 | (use-package ispell | |
940 | :defer 0.6 | |
941 | :config | |
942 | ;; ’ can be part of a word | |
943 | (setq ispell-local-dictionary-alist | |
944 | `((nil "[[:alpha:]]" "[^[:alpha:]]" | |
b1ed9ee8 AB |
945 | "['\x2019]" nil ("-B") nil utf-8)) |
946 | ispell-program-name (executable-find "hunspell")) | |
41d290a2 AB |
947 | ;; don't send ’ to the subprocess |
948 | (defun endless/replace-apostrophe (args) | |
949 | (cons (replace-regexp-in-string | |
950 | "’" "'" (car args)) | |
951 | (cdr args))) | |
952 | (advice-add #'ispell-send-string :filter-args | |
953 | #'endless/replace-apostrophe) | |
954 | ||
955 | ;; convert ' back to ’ from the subprocess | |
956 | (defun endless/replace-quote (args) | |
957 | (if (not (derived-mode-p 'org-mode)) | |
958 | args | |
959 | (cons (replace-regexp-in-string | |
960 | "'" "’" (car args)) | |
961 | (cdr args)))) | |
962 | (advice-add #'ispell-parse-output :filter-args | |
963 | #'endless/replace-quote)) | |
964 | ||
dca50cf5 | 965 | (use-package abbrev |
54209e74 | 966 | :delight " abbr" |
dca50cf5 AB |
967 | :hook (text-mode . abbrev-mode) |
968 | :custom | |
969 | (abbrev-file-name (b/var "abbrev.el"))) | |
54209e74 | 970 | |
b57457b2 AB |
971 | \f |
972 | ;;; Programming modes | |
973 | ||
dca50cf5 | 974 | (use-package lisp-mode |
41d290a2 | 975 | :config |
41d290a2 AB |
976 | (defun indent-spaces-mode () |
977 | (setq indent-tabs-mode nil)) | |
978 | (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) | |
979 | ||
dca50cf5 | 980 | (use-package reveal |
54209e74 AB |
981 | :delight (reveal-mode " reveal") |
982 | :hook (emacs-lisp-mode . reveal-mode)) | |
983 | ||
dca50cf5 | 984 | (use-package elisp-mode |
54209e74 AB |
985 | :delight (emacs-lisp-mode "Elisp" :major)) |
986 | ||
dca50cf5 AB |
987 | (comment |
988 | ;; TODO | |
989 | (use-package alloy-mode | |
990 | :straight (:host github :repo "dwwmmn/alloy-mode") | |
991 | :mode "\\.als\\'" | |
992 | :config (setq alloy-basic-offset 2)) | |
993 | ||
994 | (use-package proof-site ; for Coq | |
995 | :straight proof-general) | |
996 | ||
997 | (eval-when-compile (defvar lean-mode-map)) | |
998 | (use-package lean-mode | |
999 | :defer 0.4 | |
1000 | :bind (:map lean-mode-map | |
1001 | ("S-SPC" . company-complete)) | |
1002 | :config | |
1003 | (require 'lean-input) | |
1004 | (setq default-input-method "Lean" | |
1005 | lean-input-tweak-all '(lean-input-compose | |
1006 | (lean-input-prepend "/") | |
1007 | (lean-input-nonempty)) | |
1008 | lean-input-user-translations '(("/" "/"))) | |
1009 | (lean-input-setup)) | |
1010 | ||
1011 | (use-package haskell-mode | |
1012 | :config | |
1013 | (setq haskell-indentation-layout-offset 4 | |
1014 | haskell-indentation-left-offset 4 | |
1015 | flycheck-checker 'haskell-hlint | |
1016 | flycheck-disabled-checkers '(haskell-stack-ghc haskell-ghc))) | |
1017 | ||
1018 | (use-package dante | |
1019 | :after haskell-mode | |
1020 | :commands dante-mode | |
1021 | :hook (haskell-mode . dante-mode)) | |
1022 | ||
1023 | (use-package hlint-refactor | |
1024 | :after haskell-mode | |
1025 | :bind (:map hlint-refactor-mode-map | |
1026 | ("C-c l b" . hlint-refactor-refactor-buffer) | |
1027 | ("C-c l r" . hlint-refactor-refactor-at-point)) | |
1028 | :hook (haskell-mode . hlint-refactor-mode)) | |
1029 | ||
1030 | (use-package flycheck-haskell | |
1031 | :after haskell-mode) | |
1032 | ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el | |
1033 | ) | |
41d290a2 AB |
1034 | |
1035 | (use-package sgml-mode | |
1036 | :config | |
1037 | (setq sgml-basic-offset 2)) | |
1038 | ||
1039 | (use-package css-mode | |
1040 | :config | |
1041 | (setq css-indent-offset 2)) | |
1042 | ||
1043 | (use-package web-mode | |
1044 | :mode "\\.html\\'" | |
1045 | :config | |
dca50cf5 | 1046 | (b/setq-every 2 |
41d290a2 AB |
1047 | web-mode-code-indent-offset |
1048 | web-mode-css-indent-offset | |
1049 | web-mode-markup-indent-offset)) | |
1050 | ||
1051 | (use-package emmet-mode | |
1052 | :after (:any web-mode css-mode sgml-mode) | |
1053 | :bind* (("C-)" . emmet-next-edit-point) | |
1054 | ("C-(" . emmet-prev-edit-point)) | |
1055 | :config | |
1056 | (unbind-key "C-j" emmet-mode-keymap) | |
1057 | (setq emmet-move-cursor-between-quotes t) | |
1058 | :hook (web-mode css-mode html-mode sgml-mode)) | |
1059 | ||
b57457b2 AB |
1060 | (comment |
1061 | (use-package meghanada | |
1062 | :bind | |
1063 | (:map meghanada-mode-map | |
1064 | (("C-M-o" . meghanada-optimize-import) | |
1065 | ("C-M-t" . meghanada-import-all))) | |
1066 | :hook (java-mode . meghanada-mode))) | |
1067 | ||
1068 | (comment | |
1069 | (use-package treemacs | |
1070 | :config (setq treemacs-never-persist t)) | |
1071 | ||
1072 | (use-package yasnippet | |
1073 | :config | |
1074 | ;; (yas-global-mode) | |
1075 | ) | |
1076 | ||
1077 | (use-package lsp-mode | |
1078 | :init (setq lsp-eldoc-render-all nil | |
1079 | lsp-highlight-symbol-at-point nil) | |
1080 | ) | |
1081 | ||
1082 | (use-package hydra) | |
1083 | ||
1084 | (use-package company-lsp | |
1085 | :after company | |
1086 | :config | |
1087 | (setq company-lsp-cache-candidates t | |
1088 | company-lsp-async t)) | |
1089 | ||
1090 | (use-package lsp-ui | |
1091 | :config | |
1092 | (setq lsp-ui-sideline-update-mode 'point)) | |
1093 | ||
1094 | (use-package lsp-java | |
1095 | :config | |
1096 | (add-hook 'java-mode-hook | |
1097 | (lambda () | |
1098 | (setq-local company-backends (list 'company-lsp)))) | |
1099 | ||
1100 | (add-hook 'java-mode-hook 'lsp-java-enable) | |
1101 | (add-hook 'java-mode-hook 'flycheck-mode) | |
1102 | (add-hook 'java-mode-hook 'company-mode) | |
1103 | (add-hook 'java-mode-hook 'lsp-ui-mode)) | |
1104 | ||
1105 | (use-package dap-mode | |
1106 | :after lsp-mode | |
1107 | :config | |
1108 | (dap-mode t) | |
1109 | (dap-ui-mode t)) | |
1110 | ||
1111 | (use-package dap-java | |
1112 | :after (lsp-java)) | |
1113 | ||
1114 | (use-package lsp-java-treemacs | |
1115 | :after (treemacs))) | |
1116 | ||
1117 | (comment | |
1118 | (use-package eclim | |
1119 | :bind (:map eclim-mode-map ("S-SPC" . company-complete)) | |
1120 | :hook ((java-mode . eclim-mode) | |
1121 | (eclim-mode . (lambda () | |
1122 | (make-local-variable 'company-idle-delay) | |
1123 | (defvar company-idle-delay) | |
1124 | ;; (setq company-idle-delay 0.7) | |
1125 | (setq company-idle-delay nil)))) | |
1126 | :custom | |
1127 | (eclim-auto-save nil) | |
1128 | ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp") | |
1129 | (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim") | |
1130 | (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse")))) | |
1131 | ||
41d290a2 AB |
1132 | (use-package geiser) |
1133 | ||
dca50cf5 | 1134 | (use-package geiser-guile |
41d290a2 AB |
1135 | :config |
1136 | (setq geiser-guile-load-path "~/src/git/guix")) | |
1137 | ||
1138 | (use-package guix) | |
1139 | ||
b57457b2 AB |
1140 | (comment |
1141 | (use-package auctex | |
1142 | :custom | |
1143 | (font-latex-fontify-sectioning 'color))) | |
1144 | ||
99473567 AB |
1145 | (use-package go-mode) |
1146 | ||
f704f564 AB |
1147 | (use-package po-mode |
1148 | :hook | |
1149 | (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit)))) | |
1150 | ||
b57457b2 AB |
1151 | \f |
1152 | ;;; Theme | |
1153 | ||
dca50cf5 AB |
1154 | (add-to-list 'custom-theme-load-path |
1155 | (expand-file-name | |
1156 | (convert-standard-filename "lisp") user-emacs-directory)) | |
b57457b2 AB |
1157 | (load-theme 'tangomod t) |
1158 | ||
1159 | (use-package smart-mode-line | |
1160 | :commands (sml/apply-theme) | |
1161 | :demand | |
1162 | :config | |
26906e22 AB |
1163 | (sml/setup) |
1164 | (smart-mode-line-enable)) | |
b57457b2 | 1165 | |
dca50cf5 AB |
1166 | (comment |
1167 | ;; TODO | |
1168 | (use-package doom-themes)) | |
b57457b2 | 1169 | |
dca50cf5 | 1170 | (defvar b/org-mode-font-lock-keywords |
b57457b2 AB |
1171 | '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)" |
1172 | (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive | |
1173 | (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind | |
1174 | (4 '(:foreground "#c5c8c6") t)))) ; title | |
1175 | ||
dca50cf5 | 1176 | (defun b/lights-on () |
b57457b2 AB |
1177 | "Enable my favourite light theme." |
1178 | (interactive) | |
1179 | (mapc #'disable-theme custom-enabled-themes) | |
1180 | (load-theme 'tangomod t) | |
1181 | (sml/apply-theme 'automatic) | |
1182 | (font-lock-remove-keywords | |
dca50cf5 | 1183 | 'org-mode b/org-mode-font-lock-keywords)) |
b57457b2 | 1184 | |
dca50cf5 | 1185 | (defun b/lights-off () |
b57457b2 AB |
1186 | "Go dark." |
1187 | (interactive) | |
1188 | (mapc #'disable-theme custom-enabled-themes) | |
dca50cf5 | 1189 | ;; (load-theme 'doom-tomorrow-night t) |
b57457b2 AB |
1190 | (sml/apply-theme 'automatic) |
1191 | (font-lock-add-keywords | |
dca50cf5 | 1192 | 'org-mode b/org-mode-font-lock-keywords t)) |
b57457b2 AB |
1193 | |
1194 | (bind-keys | |
dca50cf5 AB |
1195 | ("s-t d" . b/lights-off) |
1196 | ("s-t l" . b/lights-on)) | |
b57457b2 AB |
1197 | |
1198 | \f | |
1199 | ;;; Emacs enhancements & auxiliary packages | |
1200 | ||
dca50cf5 | 1201 | (use-package man |
41d290a2 AB |
1202 | :config (setq Man-width 80)) |
1203 | ||
1204 | (use-package which-key | |
1205 | :defer 0.4 | |
54209e74 | 1206 | :delight |
41d290a2 AB |
1207 | :config |
1208 | (which-key-add-key-based-replacements | |
1209 | ;; prefixes for global prefixes and minor modes | |
1210 | "C-c @" "outline" | |
1211 | "C-c !" "flycheck" | |
1212 | "C-c 8" "typo" | |
1213 | "C-c 8 -" "typo/dashes" | |
1214 | "C-c 8 <" "typo/left-brackets" | |
1215 | "C-c 8 >" "typo/right-brackets" | |
1216 | "C-x 8" "unicode" | |
1217 | "C-x a" "abbrev/expand" | |
1218 | "C-x r" "rectangle/register/bookmark" | |
1219 | "C-x v" "version control" | |
1220 | ;; prefixes for my personal bindings | |
1221 | "C-c a" "applications" | |
1222 | "C-c a e" "erc" | |
1223 | "C-c a o" "org" | |
1224 | "C-c a s" "shells" | |
1225 | "C-c p" "package-management" | |
1226 | ;; "C-c p e" "package-management/epkg" | |
1227 | "C-c p s" "straight.el" | |
1228 | "C-c psa" "all" | |
1229 | "C-c psp" "package" | |
1230 | "C-c c" "compile-and-comments" | |
1231 | "C-c e" "eval" | |
1232 | "C-c f" "files" | |
1233 | "C-c F" "frames" | |
1234 | "C-S-h" "help(ful)" | |
1235 | "C-c m" "multiple-cursors" | |
1236 | "C-c P" "projectile" | |
1237 | "C-c P s" "projectile/search" | |
1238 | "C-c P x" "projectile/execute" | |
1239 | "C-c P 4" "projectile/other-window" | |
1240 | "C-c q" "boxquote" | |
1241 | "s-g" "magit" | |
ed8c4fa9 | 1242 | "s-O" "outline" |
41d290a2 AB |
1243 | "s-t" "themes") |
1244 | ||
1245 | ;; prefixes for major modes | |
1246 | (which-key-add-major-mode-key-based-replacements 'message-mode | |
1247 | "C-c f" "footnote") | |
1248 | (which-key-add-major-mode-key-based-replacements 'org-mode | |
1249 | "C-c C-v" "org-babel") | |
1250 | (which-key-add-major-mode-key-based-replacements 'web-mode | |
1251 | "C-c C-a" "web/attributes" | |
1252 | "C-c C-b" "web/blocks" | |
1253 | "C-c C-d" "web/dom" | |
1254 | "C-c C-e" "web/element" | |
1255 | "C-c C-t" "web/tags") | |
1256 | ||
1257 | (which-key-mode) | |
1258 | :custom | |
1259 | (which-key-add-column-padding 5) | |
1260 | (which-key-max-description-length 32)) | |
1261 | ||
b57457b2 | 1262 | (use-package crux ; results in Waiting for git... [2 times] |
41d290a2 AB |
1263 | :defer 0.4 |
1264 | :bind (("C-c b k" . crux-kill-other-buffers) | |
1265 | ("C-c d" . crux-duplicate-current-line-or-region) | |
1266 | ("C-c D" . crux-duplicate-and-comment-current-line-or-region) | |
1267 | ("C-c f c" . crux-copy-file-preserve-attributes) | |
1268 | ("C-c f d" . crux-delete-file-and-buffer) | |
1269 | ("C-c f r" . crux-rename-file-and-buffer) | |
1270 | ("C-c j" . crux-top-join-line) | |
1271 | ("C-S-j" . crux-top-join-line))) | |
1272 | ||
dca50cf5 AB |
1273 | (comment |
1274 | ;; TODO | |
1275 | (use-package mwim | |
1276 | :bind (("C-a" . mwim-beginning-of-code-or-line) | |
1277 | ("C-e" . mwim-end-of-code-or-line) | |
1278 | ("<home>" . mwim-beginning-of-line-or-code) | |
1279 | ("<end>" . mwim-end-of-line-or-code)))) | |
41d290a2 AB |
1280 | |
1281 | (use-package projectile | |
26906e22 | 1282 | :defer 0.5 |
41d290a2 AB |
1283 | :bind-keymap ("C-c P" . projectile-command-map) |
1284 | :config | |
1285 | (projectile-mode) | |
1286 | ||
dca50cf5 | 1287 | (defun b/projectile-mode-line-fun () |
26906e22 AB |
1288 | "Report project name and type in the modeline." |
1289 | (let ((project-name (projectile-project-name)) | |
1290 | (project-type (projectile-project-type))) | |
1291 | (format "%s%s" | |
1292 | projectile-mode-line-prefix | |
1293 | (if project-type | |
1294 | (format ":%s" project-type) | |
1295 | "")))) | |
dca50cf5 | 1296 | (setq projectile-mode-line-function 'b/projectile-mode-line-fun) |
26906e22 | 1297 | |
41d290a2 AB |
1298 | (defun my-projectile-invalidate-cache (&rest _args) |
1299 | ;; ignore the args to `magit-checkout' | |
1300 | (projectile-invalidate-cache nil)) | |
1301 | ||
1302 | (eval-after-load 'magit-branch | |
1303 | '(progn | |
1304 | (advice-add 'magit-checkout | |
1305 | :after #'my-projectile-invalidate-cache) | |
1306 | (advice-add 'magit-branch-and-checkout | |
1307 | :after #'my-projectile-invalidate-cache))) | |
54209e74 AB |
1308 | :custom |
1309 | (projectile-completion-system 'ivy) | |
1310 | (projectile-mode-line-prefix " proj")) | |
41d290a2 AB |
1311 | |
1312 | (use-package helpful | |
1313 | :defer 0.6 | |
1314 | :bind | |
1315 | (("C-S-h c" . helpful-command) | |
1316 | ("C-S-h f" . helpful-callable) ; helpful-function | |
1317 | ("C-S-h v" . helpful-variable) | |
1318 | ("C-S-h k" . helpful-key) | |
1319 | ("C-S-h p" . helpful-at-point))) | |
1320 | ||
dca50cf5 AB |
1321 | (comment |
1322 | ;; TODO | |
1323 | (use-package unkillable-scratch | |
1324 | :defer 0.6 | |
1325 | :config | |
1326 | (unkillable-scratch 1) | |
1327 | :custom | |
1328 | (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))) | |
41d290a2 | 1329 | |
dca50cf5 AB |
1330 | (comment |
1331 | ;; TODO | |
1332 | ;; ,---- | |
1333 | ;; | make pretty boxed quotes like this | |
1334 | ;; `---- | |
1335 | (use-package boxquote | |
1336 | :defer 0.6 | |
1337 | :bind | |
1338 | (:prefix-map b/boxquote-prefix-map | |
1339 | :prefix "C-c q" | |
1340 | ("b" . boxquote-buffer) | |
1341 | ("B" . boxquote-insert-buffer) | |
1342 | ("d" . boxquote-defun) | |
1343 | ("F" . boxquote-insert-file) | |
1344 | ("hf" . boxquote-describe-function) | |
1345 | ("hk" . boxquote-describe-key) | |
1346 | ("hv" . boxquote-describe-variable) | |
1347 | ("hw" . boxquote-where-is) | |
1348 | ("k" . boxquote-kill) | |
1349 | ("p" . boxquote-paragraph) | |
1350 | ("q" . boxquote-boxquote) | |
1351 | ("r" . boxquote-region) | |
1352 | ("s" . boxquote-shell-command) | |
1353 | ("t" . boxquote-text) | |
1354 | ("T" . boxquote-title) | |
1355 | ("u" . boxquote-unbox) | |
1356 | ("U" . boxquote-unbox-region) | |
1357 | ("y" . boxquote-yank) | |
1358 | ("M-q" . boxquote-fill-paragraph) | |
1359 | ("M-w" . boxquote-kill-ring-save)))) | |
41d290a2 AB |
1360 | |
1361 | (use-package orgalist | |
b57457b2 | 1362 | ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html |
41d290a2 AB |
1363 | :disabled t |
1364 | :after message | |
1365 | :hook (message-mode . orgalist-mode)) | |
1366 | ||
b57457b2 | 1367 | ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹› |
41d290a2 AB |
1368 | (use-package typo |
1369 | :defer 0.5 | |
54209e74 | 1370 | :delight " typo" |
41d290a2 AB |
1371 | :config |
1372 | (typo-global-mode 1) | |
54209e74 | 1373 | :hook ((text-mode erc-mode) . typo-mode)) |
41d290a2 | 1374 | |
b57457b2 | 1375 | ;; highlight TODOs in buffers |
41d290a2 AB |
1376 | (use-package hl-todo |
1377 | :defer 0.5 | |
1378 | :config | |
1379 | (global-hl-todo-mode)) | |
1380 | ||
dca50cf5 AB |
1381 | (comment |
1382 | ;; TODO | |
1383 | (use-package shrink-path | |
1384 | :defer 0.5 | |
1385 | :after eshell | |
1386 | :config | |
1387 | (defvar user-@-host (concat (user-login-name) "@" (system-name) " ")) | |
1388 | (defun +eshell/prompt () | |
1389 | (let ((base/dir (shrink-path-prompt default-directory))) | |
1390 | (concat (propertize user-@-host 'face 'default) | |
1391 | (propertize (car base/dir) | |
1392 | 'face 'font-lock-comment-face) | |
1393 | (propertize (cdr base/dir) | |
1394 | 'face 'font-lock-constant-face) | |
1395 | (propertize "> " 'face 'default)))) | |
1396 | (setq eshell-prompt-regexp (concat user-@-host ".*> ") | |
1397 | eshell-prompt-function #'+eshell/prompt))) | |
41d290a2 AB |
1398 | |
1399 | (use-package eshell-up | |
1400 | :after eshell | |
1401 | :commands eshell-up) | |
1402 | ||
1403 | (use-package multi-term | |
1404 | :defer 0.6 | |
fb078e63 AB |
1405 | :bind (("C-c a s m m" . multi-term) |
1406 | ("C-c a s m d" . multi-term-dedicated-toggle) | |
1407 | ("C-c a s m p" . multi-term-prev) | |
1408 | ("C-c a s m n" . multi-term-next) | |
41d290a2 | 1409 | :map term-mode-map |
0af1e91a | 1410 | ("C-c C-j" . term-char-mode)) |
41d290a2 | 1411 | :config |
96c704d7 AB |
1412 | (setq multi-term-program "screen" |
1413 | multi-term-program-switches (concat "-c" | |
1414 | (getenv "XDG_CONFIG_HOME") | |
1415 | "/screen/screenrc") | |
41d290a2 AB |
1416 | ;; TODO: add separate bindings for connecting to existing |
1417 | ;; session vs. always creating a new one | |
1418 | multi-term-dedicated-select-after-open-p t | |
1419 | multi-term-dedicated-window-height 20 | |
1420 | multi-term-dedicated-max-window-height 30 | |
1421 | term-bind-key-alist | |
1422 | '(("C-c C-c" . term-interrupt-subjob) | |
1423 | ("C-c C-e" . term-send-esc) | |
0af1e91a | 1424 | ("C-c C-j" . term-line-mode) |
41d290a2 | 1425 | ("C-k" . kill-line) |
fb078e63 AB |
1426 | ;; ("C-y" . term-paste) |
1427 | ("C-y" . term-send-raw) | |
41d290a2 AB |
1428 | ("M-f" . term-send-forward-word) |
1429 | ("M-b" . term-send-backward-word) | |
1430 | ("M-p" . term-send-up) | |
1431 | ("M-n" . term-send-down) | |
fb078e63 AB |
1432 | ("M-j" . term-send-raw-meta) |
1433 | ("M-y" . term-send-raw-meta) | |
1434 | ("M-/" . term-send-raw-meta) | |
1435 | ("M-0" . term-send-raw-meta) | |
1436 | ("M-1" . term-send-raw-meta) | |
1437 | ("M-2" . term-send-raw-meta) | |
1438 | ("M-3" . term-send-raw-meta) | |
1439 | ("M-4" . term-send-raw-meta) | |
1440 | ("M-5" . term-send-raw-meta) | |
1441 | ("M-6" . term-send-raw-meta) | |
1442 | ("M-7" . term-send-raw-meta) | |
1443 | ("M-8" . term-send-raw-meta) | |
1444 | ("M-9" . term-send-raw-meta) | |
41d290a2 AB |
1445 | ("<C-backspace>" . term-send-backward-kill-word) |
1446 | ("<M-DEL>" . term-send-backward-kill-word) | |
1447 | ("M-d" . term-send-delete-word) | |
1448 | ("M-," . term-send-raw) | |
1449 | ("M-." . comint-dynamic-complete)) | |
1450 | term-unbind-key-alist | |
fb078e63 AB |
1451 | '("C-z" "C-x" "C-c" "C-h" |
1452 | ;; "C-y" | |
1453 | "<ESC>"))) | |
41d290a2 AB |
1454 | |
1455 | (use-package page-break-lines | |
b57457b2 | 1456 | :defer 0.5 |
54209e74 | 1457 | :delight " pgln" |
2f5d8190 AB |
1458 | :custom |
1459 | (page-break-lines-max-width fill-column) | |
41d290a2 AB |
1460 | :config |
1461 | (global-page-break-lines-mode)) | |
1462 | ||
1463 | (use-package expand-region | |
1464 | :bind ("C-=" . er/expand-region)) | |
1465 | ||
1466 | (use-package multiple-cursors | |
1467 | :bind | |
1468 | (("C-S-<mouse-1>" . mc/add-cursor-on-click) | |
dca50cf5 | 1469 | (:prefix-map b/mc-prefix-map |
41d290a2 AB |
1470 | :prefix "C-c m" |
1471 | ("c" . mc/edit-lines) | |
1472 | ("n" . mc/mark-next-like-this) | |
1473 | ("p" . mc/mark-previous-like-this) | |
1474 | ("a" . mc/mark-all-like-this)))) | |
1475 | ||
dca50cf5 AB |
1476 | (comment |
1477 | ;; TODO | |
1478 | (use-package forge | |
1479 | :after magit | |
1480 | :demand)) | |
41d290a2 AB |
1481 | |
1482 | (use-package yasnippet | |
1483 | :defer 0.6 | |
1484 | :config | |
1485 | (defconst yas-verbosity-cur yas-verbosity) | |
1486 | (setq yas-verbosity 2) | |
476f6228 | 1487 | (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t) |
41d290a2 AB |
1488 | (yas-reload-all) |
1489 | (setq yas-verbosity yas-verbosity-cur) | |
476f6228 | 1490 | (yas-global-mode)) |
41d290a2 | 1491 | |
dca50cf5 | 1492 | (use-package debbugs) |
41d290a2 AB |
1493 | |
1494 | (use-package org-ref | |
1495 | :init | |
dca50cf5 | 1496 | (b/setq-every '("~/usr/org/references.bib") |
41d290a2 AB |
1497 | reftex-default-bibliography |
1498 | org-ref-default-bibliography) | |
1499 | (setq | |
1500 | org-ref-bibliography-notes "~/usr/org/notes.org" | |
1501 | org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")) | |
1502 | ||
41d290a2 AB |
1503 | (use-package alert |
1504 | :commands (alert) | |
83a17ce5 | 1505 | :init (setq alert-default-style 'notifications)) |
41d290a2 | 1506 | |
2f5d8190 AB |
1507 | ;; (use-package fill-column-indicator) |
1508 | ||
b46ed2ba AB |
1509 | (use-package emojify |
1510 | :hook (erc-mode . emojify-mode)) | |
1511 | ||
dca50cf5 | 1512 | (use-package window |
ed8c4fa9 AB |
1513 | :bind |
1514 | (("s-o" . other-window) | |
1515 | ("M-o" . other-window) | |
1516 | ("s-/ ." . split-window-right) | |
1517 | ("s-/ ," . split-window-below) | |
1518 | ("s-/ 0" . delete-window) | |
1519 | ("s-q" . delete-window))) | |
1520 | ||
dca50cf5 | 1521 | (use-package windmove |
ed8c4fa9 AB |
1522 | :defer 0.6 |
1523 | :bind | |
1524 | (("s-h" . windmove-left) | |
1525 | ("s-j" . windmove-down) | |
1526 | ("s-k" . windmove-up) | |
1527 | ("s-l" . windmove-right) | |
1528 | ("s-H" . windmove-swap-states-left) | |
1529 | ("s-J" . windmove-swap-states-down) | |
1530 | ("s-K" . windmove-swap-states-up) | |
1531 | ("s-L" . windmove-swap-states-right))) | |
1532 | ||
05068e71 AB |
1533 | (use-package pass |
1534 | :commands pass | |
1535 | :bind ("C-c a p" . pass) | |
1536 | :hook (pass-mode . View-exit)) | |
1537 | ||
b57457b2 AB |
1538 | \f |
1539 | ;;; Email (with Gnus) | |
1540 | ||
dca50cf5 | 1541 | (defvar b/maildir (expand-file-name "~/mail/")) |
41d290a2 | 1542 | (with-eval-after-load 'recentf |
dca50cf5 | 1543 | (add-to-list 'recentf-exclude b/maildir)) |
41d290a2 AB |
1544 | |
1545 | (setq | |
dca50cf5 | 1546 | b/gnus-init-file (b/etc "gnus") |
41d290a2 AB |
1547 | mail-user-agent 'gnus-user-agent |
1548 | read-mail-command 'gnus) | |
1549 | ||
dca50cf5 | 1550 | (use-package gnus |
41d290a2 AB |
1551 | :bind (("s-m" . gnus) |
1552 | ("s-M" . gnus-unplugged)) | |
1553 | :init | |
1554 | (setq | |
1555 | gnus-select-method '(nnnil "") | |
1556 | gnus-secondary-select-methods | |
d4cc5497 | 1557 | '((nnimap "shemshak" |
41d290a2 AB |
1558 | (nnimap-stream plain) |
1559 | (nnimap-address "127.0.0.1") | |
1560 | (nnimap-server-port 143) | |
1561 | (nnimap-authenticator plain) | |
4ed3a945 | 1562 | (nnimap-user "amin@shemshak.local")) |
2e9074a4 AB |
1563 | (nnimap "gnu" |
1564 | (nnimap-stream plain) | |
1565 | (nnimap-address "127.0.0.1") | |
1566 | (nnimap-server-port 143) | |
1567 | (nnimap-authenticator plain) | |
7f88c321 AB |
1568 | (nnimap-user "bandali@gnu.local") |
1569 | (nnimap-inbox "INBOX") | |
1570 | (nnimap-split-methods 'nnimap-split-fancy) | |
1571 | (nnimap-split-fancy (| | |
29e42dc1 | 1572 | ;; (: gnus-registry-split-fancy-with-parent) |
7f88c321 AB |
1573 | ;; (: gnus-group-split-fancy "INBOX" t "INBOX") |
1574 | ;; gnu | |
1575 | (list ".*emacs-devel.gnu.org" "l.gnu.emacs.devel") | |
1576 | (list ".*help-gnu-emacs.gnu.org" "l.gnu.emacs.help") | |
1577 | (list ".*info-gnu-emacs.gnu.org" "l.gnu.emacs.info") | |
1578 | (list ".*emacs-orgmode.gnu.org" "l.gnu.emacs.orgmode") | |
40b9eac1 | 1579 | (list ".*emacs-tangents.gnu.org" "l.gnu.emacs.tangents") |
7f88c321 | 1580 | (list ".*emacsconf-discuss.gnu.org" "l.gnu.emacsconf.discuss") |
690a977d AB |
1581 | (list ".*emacsconf-register.gnu.org" "l.gnu.emacsconf.register") |
1582 | (list ".*emacsconf-submit.gnu.org" "l.gnu.emacsconf.submit") | |
7f88c321 AB |
1583 | (list ".*fencepost-users.gnu.org" "l.gnu.fencepost.users") |
1584 | (list ".*gnunet-developers.gnu.org" "l.gnu.gnunet.developers") | |
1585 | (list ".*help-gnunet.gnu.org" "l.gnu.gnunet.help") | |
1586 | (list ".*bug-gnuzilla.gnu.org" "l.gnu.gnuzilla.bug") | |
1587 | (list ".*gnuzilla-dev.gnu.org" "l.gnu.gnuzilla.dev") | |
1588 | (list ".*guile-devel.gnu.org" "l.gnu.guile.devel") | |
29e42dc1 | 1589 | (list ".*guile-user.gnu.org" "l.gnu.guile.user") |
7f88c321 | 1590 | (list ".*guix-devel.gnu.org" "l.gnu.guix.devel") |
837a23a5 | 1591 | (list ".*help-guix.gnu.org" "l.gnu.guix.help") |
7f88c321 | 1592 | (list ".*info-guix.gnu.org" "l.gnu.guix.info") |
6f25cef1 AB |
1593 | (list ".*savannah-hackers-public.gnu.org" "l.gnu.savannah.hackers.public") |
1594 | (list ".*savannah-users.gnu.org" "l.gnu.savannah.users") | |
7f88c321 AB |
1595 | (list ".*www-commits.gnu.org" "l.gnu.www.commits") |
1596 | (list ".*www-discuss.gnu.org" "l.gnu.www.discuss") | |
9747f63f AB |
1597 | ;; webmasters |
1598 | (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters") | |
7f88c321 AB |
1599 | ;; haskell |
1600 | (list ".*haskell-art.we.lurk.org" "l.haskell.art") | |
1601 | (list ".*haskell-cafe.haskell.org" "l.haskell.cafe") | |
1602 | ;; other | |
859ba2a0 | 1603 | (list ".*atreus.freelists.org" "l.atreus") |
7f88c321 AB |
1604 | (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec") |
1605 | (list ".*notmuch.notmuchmail.org" "l.notmuch") | |
1606 | (list ".*dev.lists.parabola.nu" "l.parabola.dev") | |
1607 | ;; *@lists.sr.ht | |
1608 | (list ".*~bandali/public-inbox@lists.sr.ht" "l.~bandali.public-inbox") | |
7c281dfc | 1609 | (list ".*~sircmpwn/free-writers-club@lists.sr.ht" "l.~sircmpwn.free-writers-club") |
7f88c321 AB |
1610 | (list ".*~sircmpwn/sr.ht-admins@lists.sr.ht" "l.~sircmpwn.srht.admins") |
1611 | (list ".*~sircmpwn/sr.ht-announce@lists.sr.ht" "l.~sircmpwn.srht.announce") | |
1612 | (list ".*~sircmpwn/sr.ht-dev@lists.sr.ht" "l.~sircmpwn.srht.dev") | |
1613 | (list ".*~sircmpwn/sr.ht-discuss@lists.sr.ht" "l.~sircmpwn.srht.discuss") | |
1614 | "INBOX"))) | |
727d14d3 | 1615 | (nnimap "uw" |
41d290a2 AB |
1616 | (nnimap-stream plain) |
1617 | (nnimap-address "127.0.0.1") | |
1618 | (nnimap-server-port 143) | |
1619 | (nnimap-authenticator plain) | |
f0d99991 AB |
1620 | (nnimap-user "abandali@uw.local") |
1621 | (nnimap-inbox "INBOX") | |
1622 | (nnimap-split-methods 'nnimap-split-fancy) | |
1623 | (nnimap-split-fancy (| | |
29e42dc1 | 1624 | ;; (: gnus-registry-split-fancy-with-parent) |
f0d99991 | 1625 | ;; se463-s19 |
cec07e02 AB |
1626 | ("subject" "\\(SE\\s-?463\\|Deliverable\\)" "course.se463-s19") |
1627 | (from "\\(SE\\s-?463\\|Gema\\|Hemant\\|Davood\\|Camilo\\|Reza\\|Michael\\|Sandy\\)" "course.se463-s19") | |
f0d99991 AB |
1628 | ;; catch-all |
1629 | "INBOX"))) | |
727d14d3 | 1630 | (nnimap "csc" |
41d290a2 AB |
1631 | (nnimap-stream plain) |
1632 | (nnimap-address "127.0.0.1") | |
1633 | (nnimap-server-port 143) | |
1634 | (nnimap-authenticator plain) | |
727d14d3 | 1635 | (nnimap-user "abandali@csc.uw.local"))) |
d4cc5497 | 1636 | gnus-message-archive-group "nnimap+shemshak:Sent" |
41d290a2 | 1637 | gnus-parameters |
859ba2a0 AB |
1638 | '(("l\\.atreus" |
1639 | (to-address . "atreus@freelists.org") | |
1640 | (to-list . "atreus@freelists.org")) | |
1641 | ("l\\.deepspec" | |
41d290a2 | 1642 | (to-address . "deepspec@lists.cs.princeton.edu") |
778202b8 AB |
1643 | (to-list . "deepspec@lists.cs.princeton.edu") |
1644 | (list-identifier . "\\[deepspec\\]")) | |
74fd778e AB |
1645 | ("l\\.gnu\\.emacs\\.devel" |
1646 | (to-address . "emacs-devel@gnu.org") | |
1647 | (to-list . "emacs-devel@gnu.org")) | |
1648 | ("l\\.gnu\\.emacs\\.help" | |
1649 | (to-address . "help-gnu-emacs@gnu.org") | |
1650 | (to-list . "help-gnu-emacs@gnu.org")) | |
1651 | ("l\\.gnu\\.emacs\\.info" | |
1652 | (to-address . "info-gnu-emacs@gnu.org") | |
1653 | (to-list . "info-gnu-emacs@gnu.org")) | |
1654 | ("l\\.gnu\\.emacs\\.orgmode" | |
41d290a2 | 1655 | (to-address . "emacs-orgmode@gnu.org") |
778202b8 AB |
1656 | (to-list . "emacs-orgmode@gnu.org") |
1657 | (list-identifier . "\\[O\\]")) | |
40b9eac1 AB |
1658 | ("l\\.gnu\\.emacs\\.tangents" |
1659 | (to-address . "emacs-tangents@gnu.org") | |
1660 | (to-list . "emacs-tangents@gnu.org")) | |
74fd778e | 1661 | ("l\\.gnu\\.emacsconf\\.discuss" |
41d290a2 AB |
1662 | (to-address . "emacsconf-discuss@gnu.org") |
1663 | (to-list . "emacsconf-discuss@gnu.org")) | |
690a977d AB |
1664 | ("l\\.gnu\\.emacsconf\\.register" |
1665 | (to-address . "emacsconf-register@gnu.org") | |
1666 | (to-list . "emacsconf-register@gnu.org")) | |
1667 | ("l\\.gnu\\.emacsconf\\.submit" | |
1668 | (to-address . "emacsconf-submit@gnu.org") | |
1669 | (to-list . "emacsconf-submit@gnu.org")) | |
74fd778e | 1670 | ("l\\.gnu\\.fencepost\\.users" |
41d290a2 | 1671 | (to-address . "fencepost-users@gnu.org") |
778202b8 AB |
1672 | (to-list . "fencepost-users@gnu.org") |
1673 | (list-identifier . "\\[Fencepost-users\\]")) | |
74fd778e | 1674 | ("l\\.gnu\\.gnunet\\.developers" |
41d290a2 | 1675 | (to-address . "gnunet-developers@gnu.org") |
778202b8 AB |
1676 | (to-list . "gnunet-developers@gnu.org") |
1677 | (list-identifier . "\\[GNUnet-developers\\]")) | |
74fd778e AB |
1678 | ("l\\.gnu\\.gnunet\\.help" |
1679 | (to-address . "help-gnunet@gnu.org") | |
1680 | (to-list . "help-gnunet@gnu.org") | |
1681 | (list-identifier . "\\[Help-gnunet\\]")) | |
1682 | ("l\\.gnu\\.gnuzilla\\.bug" | |
1683 | (to-address . "bug-gnuzilla@gnu.org") | |
1684 | (to-list . "bug-gnuzilla@gnu.org") | |
1685 | (list-identifier . "\\[Bug-gnuzilla\\]")) | |
1686 | ("l\\.gnu\\.gnuzilla\\.dev" | |
1687 | (to-address . "gnuzilla-dev@gnu.org") | |
1688 | (to-list . "gnuzilla-dev@gnu.org") | |
1689 | (list-identifier . "\\[Gnuzilla-dev\\]")) | |
1690 | ("l\\.gnu\\.guile\\.devel" | |
41d290a2 AB |
1691 | (to-address . "guile-devel@gnu.org") |
1692 | (to-list . "guile-devel@gnu.org")) | |
29e42dc1 AB |
1693 | ("l\\.gnu\\.guile\\.user" |
1694 | (to-address . "guile-user@gnu.org") | |
1695 | (to-list . "guile-user@gnu.org")) | |
74fd778e | 1696 | ("l\\.gnu\\.guix\\.devel" |
41d290a2 AB |
1697 | (to-address . "guix-devel@gnu.org") |
1698 | (to-list . "guix-devel@gnu.org")) | |
837a23a5 AB |
1699 | ("l\\.gnu\\.guix\\.help" |
1700 | (to-address . "help-guix@gnu.org") | |
1701 | (to-list . "help-guix@gnu.org")) | |
74fd778e AB |
1702 | ("l\\.gnu\\.guix\\.info" |
1703 | (to-address . "info-guix@gnu.org") | |
1704 | (to-list . "info-guix@gnu.org")) | |
6f25cef1 AB |
1705 | ("l\\.gnu\\.savannah\\.hackers\\.public" |
1706 | (to-address . "savannah-hackers-public@gnu.org") | |
1707 | (to-list . "savannah-hackers-public@gnu.org")) | |
1708 | ("l\\.gnu\\.savannah\\.users" | |
1709 | (to-address . "savannah-users@gnu.org") | |
1710 | (to-list . "savannah-users@gnu.org")) | |
74fd778e AB |
1711 | ("l\\.gnu\\.www\\.commits" |
1712 | (to-address . "www-commits@gnu.org") | |
1713 | (to-list . "www-commits@gnu.org")) | |
1714 | ("l\\.gnu\\.www\\.discuss" | |
1715 | (to-address . "www-discuss@gnu.org") | |
1716 | (to-list . "www-discuss@gnu.org")) | |
1717 | ("l\\.haskell\\.art" | |
41d290a2 | 1718 | (to-address . "haskell-art@we.lurk.org") |
778202b8 AB |
1719 | (to-list . "haskell-art@we.lurk.org") |
1720 | (list-identifier . "\\[haskell-art\\]")) | |
74fd778e | 1721 | ("l\\.haskell\\.cafe" |
41d290a2 | 1722 | (to-address . "haskell-cafe@haskell.org") |
778202b8 AB |
1723 | (to-list . "haskell-cafe@haskell.org") |
1724 | (list-identifier . "\\[Haskell-cafe\\]")) | |
74fd778e | 1725 | ("l\\.notmuch" |
41d290a2 AB |
1726 | (to-address . "notmuch@notmuchmail.org") |
1727 | (to-list . "notmuch@notmuchmail.org")) | |
74fd778e | 1728 | ("l\\.parabola\\.dev" |
41d290a2 | 1729 | (to-address . "dev@lists.parabola.nu") |
778202b8 AB |
1730 | (to-list . "dev@lists.parabola.nu") |
1731 | (list-identifier . "\\[Dev\\]")) | |
74fd778e | 1732 | ("l\\.~bandali\\.public-inbox" |
41d290a2 AB |
1733 | (to-address . "~bandali/public-inbox@lists.sr.ht") |
1734 | (to-list . "~bandali/public-inbox@lists.sr.ht")) | |
7c281dfc AB |
1735 | ("l\\.~sircmpwn\\.free-writers-club" |
1736 | (to-address . "~sircmpwn/free-writers-club@lists.sr.ht") | |
1737 | (to-list . "~sircmpwn/free-writers-club@lists.sr.ht")) | |
74fd778e | 1738 | ("l\\.~sircmpwn\\.srht\\.admins" |
41d290a2 AB |
1739 | (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") |
1740 | (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) | |
74fd778e | 1741 | ("l\\.~sircmpwn\\.srht\\.announce" |
41d290a2 AB |
1742 | (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") |
1743 | (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) | |
74fd778e | 1744 | ("l\\.~sircmpwn\\.srht\\.dev" |
41d290a2 AB |
1745 | (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") |
1746 | (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) | |
74fd778e | 1747 | ("l\\.~sircmpwn\\.srht\\.discuss" |
41d290a2 AB |
1748 | (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") |
1749 | (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) | |
74fd778e AB |
1750 | ("webmasters" |
1751 | (to-address . "webmasters@gnu.org") | |
1752 | (to-list . "webmasters@gnu.org")) | |
41d290a2 AB |
1753 | ("gnu.*" |
1754 | (gcc-self . t)) | |
1755 | ("gnu\\." | |
262483ba AB |
1756 | (subscribed . t)) |
1757 | ("nnimap\\+uw:.*" | |
1758 | (gcc-self . t))) | |
41d290a2 | 1759 | gnus-large-newsgroup 50 |
dca50cf5 | 1760 | gnus-home-directory (b/var "gnus/") |
41d290a2 AB |
1761 | gnus-directory (concat gnus-home-directory "news/") |
1762 | message-directory (concat gnus-home-directory "mail/") | |
1763 | nndraft-directory (concat gnus-home-directory "drafts/") | |
1764 | gnus-save-newsrc-file nil | |
1765 | gnus-read-newsrc-file nil | |
1766 | gnus-interactive-exit nil | |
1767 | gnus-gcc-mark-as-read t) | |
1768 | :config | |
dca50cf5 AB |
1769 | (comment |
1770 | ;; TODO | |
1771 | (require 'ebdb) | |
1772 | (require 'ebdb-mua) | |
1773 | (require 'ebdb-gnus)) | |
41d290a2 | 1774 | |
29e42dc1 | 1775 | ;; (gnus-registry-initialize) |
7f88c321 | 1776 | |
41d290a2 AB |
1777 | (with-eval-after-load 'recentf |
1778 | (add-to-list 'recentf-exclude gnus-home-directory))) | |
1779 | ||
dca50cf5 | 1780 | (use-package gnus-art |
41d290a2 AB |
1781 | :config |
1782 | (setq | |
7e1cad06 | 1783 | gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)") |
41d290a2 AB |
1784 | gnus-visible-headers |
1785 | (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:") | |
1786 | gnus-sorted-header-list | |
1787 | '("^From:" "^Subject:" "^Summary:" "^Keywords:" | |
1788 | "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator" | |
1789 | "^Newsgroups:" "List-Id:" "^Organization:" | |
1790 | "^User-Agent:" "^Date:") | |
1791 | ;; local-lapsed article dates | |
1792 | ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11 | |
1793 | gnus-article-date-headers '(user-defined) | |
1794 | gnus-article-time-format | |
1795 | (lambda (time) | |
1796 | (let* ((date (format-time-string "%a, %d %b %Y %T %z" time)) | |
1797 | (local (article-make-date-line date 'local)) | |
1798 | (combined-lapsed (article-make-date-line date | |
1799 | 'combined-lapsed)) | |
1800 | (lapsed (progn | |
1801 | (string-match " (.+" combined-lapsed) | |
1802 | (match-string 0 combined-lapsed)))) | |
1803 | (concat local lapsed)))) | |
1804 | (bind-keys | |
1805 | :map gnus-article-mode-map | |
1806 | ("M-L" . org-store-link))) | |
1807 | ||
dca50cf5 | 1808 | (use-package gnus-sum |
41d290a2 | 1809 | :bind (:map gnus-summary-mode-map |
dca50cf5 | 1810 | :prefix-map b/gnus-summary-prefix-map |
41d290a2 AB |
1811 | :prefix "v" |
1812 | ("r" . gnus-summary-reply) | |
1813 | ("w" . gnus-summary-wide-reply) | |
1814 | ("v" . gnus-summary-show-raw-article)) | |
1815 | :config | |
1816 | (bind-keys | |
1817 | :map gnus-summary-mode-map | |
1818 | ("M-L" . org-store-link)) | |
dca50cf5 | 1819 | :hook (gnus-summary-mode . b/no-mouse-autoselect-window)) |
41d290a2 | 1820 | |
dca50cf5 | 1821 | (use-package gnus-msg |
41d290a2 | 1822 | :config |
dca50cf5 | 1823 | (defvar b/signature "Amin Bandali |
ce72f966 AB |
1824 | Free Software Activist | GNU Webmaster & Volunteer |
1825 | GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103 | |
4ed3a945 | 1826 | https://shemshak.org/~amin") |
dca50cf5 | 1827 | (defvar b/gnu-signature "Amin Bandali |
515674c5 AB |
1828 | Free Software Activist | GNU Webmaster & Volunteer |
1829 | GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103 | |
1830 | https://bandalis.org") | |
dca50cf5 | 1831 | (defvar b/uw-signature "Amin Bandali, MMath Student |
4d19e255 | 1832 | Cheriton School of Computer Science |
e0e5275d | 1833 | University of Waterloo |
515674c5 | 1834 | https://bandalis.org") |
dca50cf5 | 1835 | (defvar b/csc-signature "Amin Bandali |
e0e5275d AB |
1836 | Termcom, Computer Science Club |
1837 | University of Waterloo | |
515674c5 | 1838 | https://bandalis.org") |
41d290a2 AB |
1839 | (setq gnus-posting-styles |
1840 | '((".*" | |
4ed3a945 | 1841 | (address "amin@shemshak.org") |
41d290a2 | 1842 | (body "\nBest,\n") |
dca50cf5 AB |
1843 | (signature b/signature) |
1844 | (eval (setq b/message-cite-say-hi t))) | |
7f88c321 | 1845 | ("nnimap\\+gnu:.*" |
4ed3a945 | 1846 | (address "bandali@gnu.org") |
dca50cf5 | 1847 | (signature b/gnu-signature) |
41d290a2 AB |
1848 | (eval (set (make-local-variable 'message-user-fqdn) "fencepost.gnu.org"))) |
1849 | ((header "subject" "ThankCRM") | |
1850 | (to "webmasters-comment@gnu.org") | |
55495e2f | 1851 | (body "") |
dca50cf5 | 1852 | (eval (setq b/message-cite-say-hi nil))) |
63c1969d | 1853 | ("nnimap\\+uw:.*" |
4d19e255 | 1854 | (address "abandali@uwaterloo.ca") |
dca50cf5 | 1855 | (signature b/uw-signature)) |
262483ba | 1856 | ("nnimap\\+uw:INBOX" |
63c1969d AB |
1857 | (gcc "\"nnimap+uw:Sent Items\"")) |
1858 | ("nnimap\\+csc:.*" | |
41d290a2 | 1859 | (address "abandali@csclub.uwaterloo.ca") |
dca50cf5 | 1860 | (signature b/csc-signature) |
63c1969d | 1861 | (gcc "nnimap+csc:Sent"))))) |
41d290a2 | 1862 | |
dca50cf5 | 1863 | (use-package gnus-topic |
41d290a2 AB |
1864 | :hook (gnus-group-mode . gnus-topic-mode) |
1865 | :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) | |
1866 | ||
dca50cf5 | 1867 | (use-package gnus-agent |
41d290a2 AB |
1868 | :config |
1869 | (setq gnus-agent-synchronize-flags 'ask) | |
1870 | :hook (gnus-group-mode . gnus-agent-mode)) | |
1871 | ||
dca50cf5 | 1872 | (use-package gnus-group |
41d290a2 AB |
1873 | :config |
1874 | (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) | |
1875 | ||
082360a8 AB |
1876 | (comment |
1877 | ;; problematic with ebdb's popup, *EBDB-Gnus* | |
dca50cf5 | 1878 | (use-package gnus-win |
082360a8 AB |
1879 | :config |
1880 | (setq gnus-use-full-window nil))) | |
f485f78e | 1881 | |
dca50cf5 | 1882 | (use-package gnus-dired |
348511ef AB |
1883 | :commands gnus-dired-mode |
1884 | :init | |
1885 | (add-hook 'dired-mode-hook 'gnus-dired-mode)) | |
1886 | ||
dca50cf5 | 1887 | (use-package mm-decode |
41d290a2 | 1888 | :config |
7e1cad06 AB |
1889 | (setq mm-discouraged-alternatives '("text/html" "text/richtext") |
1890 | mm-decrypt-option 'known | |
1891 | mm-verify-option 'known)) | |
41d290a2 | 1892 | |
dca50cf5 | 1893 | (use-package sendmail |
41d290a2 | 1894 | :config |
8f8d4c32 | 1895 | (setq sendmail-program (executable-find "msmtp") |
41d290a2 AB |
1896 | ;; message-sendmail-extra-arguments '("-v" "-d") |
1897 | mail-specify-envelope-from t | |
1898 | mail-envelope-from 'header)) | |
1899 | ||
dca50cf5 | 1900 | (use-package message |
41d290a2 AB |
1901 | :config |
1902 | ;; redefine for a simplified In-Reply-To header | |
1903 | ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67) | |
1904 | (defun message-make-in-reply-to () | |
1905 | "Return the In-Reply-To header for this message." | |
1906 | (when message-reply-headers | |
1907 | (let ((from (mail-header-from message-reply-headers)) | |
1908 | (msg-id (mail-header-id message-reply-headers))) | |
1909 | (when from | |
1910 | msg-id)))) | |
1911 | ||
dca50cf5 | 1912 | (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:") |
41d290a2 AB |
1913 | (defconst message-cite-style-bandali |
1914 | '((message-cite-function 'message-cite-original) | |
1915 | (message-citation-line-function 'message-insert-formatted-citation-line) | |
1916 | (message-cite-reply-position 'traditional) | |
1917 | (message-yank-prefix "> ") | |
1918 | (message-yank-cited-prefix ">") | |
1919 | (message-yank-empty-prefix ">") | |
1920 | (message-citation-line-format | |
dca50cf5 AB |
1921 | (if b/message-cite-say-hi |
1922 | (concat "Hi %F,\n\n" b/message-cite-style-format) | |
1923 | b/message-cite-style-format))) | |
41d290a2 AB |
1924 | "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.") |
1925 | (setq ;; message-cite-style 'message-cite-style-bandali | |
1926 | message-kill-buffer-on-exit t | |
1927 | message-send-mail-function 'message-send-mail-with-sendmail | |
1928 | message-sendmail-envelope-from 'header | |
1929 | message-subscribed-address-functions | |
1930 | '(gnus-find-subscribed-addresses) | |
1931 | message-dont-reply-to-names | |
4ed3a945 | 1932 | "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(amin@bndl\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)") |
dca50cf5 AB |
1933 | (comment |
1934 | ;; TODO | |
1935 | (require 'company-ebdb)) | |
41d290a2 AB |
1936 | :hook (;; (message-setup . mml-secure-message-sign-pgpmime) |
1937 | (message-mode . flyspell-mode) | |
1938 | (message-mode . (lambda () | |
1939 | ;; (setq fill-column 65 | |
1940 | ;; message-fill-column 65) | |
1941 | (make-local-variable 'company-idle-delay) | |
1942 | (setq company-idle-delay 0.2)))) | |
1943 | ;; :custom-face | |
1944 | ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold)))) | |
1945 | ;; (message-header-to ((t (:foreground "#111" :weight normal)))) | |
1946 | ;; (message-header-cc ((t (:foreground "#333" :weight normal)))) | |
1947 | ) | |
1948 | ||
dca50cf5 | 1949 | (use-package mml |
54209e74 AB |
1950 | :delight " mml") |
1951 | ||
dca50cf5 | 1952 | (use-package mml-sec |
54209e74 AB |
1953 | :custom |
1954 | (mml-secure-openpgp-encrypt-to-self t) | |
1955 | (mml-secure-openpgp-sign-with-sender t)) | |
41d290a2 | 1956 | |
dca50cf5 | 1957 | (use-package footnote |
41d290a2 AB |
1958 | :after message |
1959 | ;; :config | |
1960 | ;; (setq footnote-start-tag "" | |
1961 | ;; footnote-end-tag "" | |
1962 | ;; footnote-style 'unicode) | |
1963 | :bind | |
1964 | (:map message-mode-map | |
dca50cf5 | 1965 | :prefix-map b/footnote-prefix-map |
41d290a2 AB |
1966 | :prefix "C-c f" |
1967 | ("a" . footnote-add-footnote) | |
1968 | ("b" . footnote-back-to-message) | |
1969 | ("c" . footnote-cycle-style) | |
1970 | ("d" . footnote-delete-footnote) | |
1971 | ("g" . footnote-goto-footnote) | |
1972 | ("r" . footnote-renumber-footnotes) | |
1973 | ("s" . footnote-set-style))) | |
1974 | ||
dca50cf5 AB |
1975 | (comment |
1976 | ;; TODO | |
1977 | (use-package ebdb | |
1978 | :straight (:host github :repo "girzel/ebdb") | |
1979 | :after gnus | |
1980 | :bind (:map gnus-group-mode-map ("e" . ebdb)) | |
1981 | :config | |
1982 | (setq ebdb-sources (b/var "ebdb")) | |
1983 | (with-eval-after-load 'swiper | |
1984 | (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) | |
41d290a2 | 1985 | |
dca50cf5 AB |
1986 | (use-package ebdb-com |
1987 | :after ebdb) | |
41d290a2 | 1988 | |
dca50cf5 AB |
1989 | ;; (use-package ebdb-complete |
1990 | ;; :after ebdb | |
1991 | ;; :config | |
1992 | ;; (ebdb-complete-enable)) | |
41d290a2 | 1993 | |
dca50cf5 AB |
1994 | (use-package company-ebdb |
1995 | :config | |
1996 | (defun company-ebdb--post-complete (_) nil)) | |
41d290a2 | 1997 | |
dca50cf5 AB |
1998 | (use-package ebdb-gnus |
1999 | :after ebdb | |
2000 | :custom | |
2001 | (ebdb-gnus-window-configuration | |
2002 | '(article | |
2003 | (vertical 1.0 | |
2004 | (summary 0.25 point) | |
2005 | (horizontal 1.0 | |
2006 | (article 1.0) | |
2007 | (ebdb-gnus 0.3)))))) | |
2008 | ||
2009 | (use-package ebdb-mua | |
2010 | :after ebdb | |
2011 | ;; :custom (ebdb-mua-pop-up nil) | |
2012 | ) | |
41d290a2 | 2013 | |
dca50cf5 AB |
2014 | ;; (use-package ebdb-message |
2015 | ;; :after ebdb) | |
41d290a2 AB |
2016 | |
2017 | ||
dca50cf5 AB |
2018 | ;; (use-package ebdb-vcard |
2019 | ;; :after ebdb) | |
2020 | ) | |
41d290a2 | 2021 | |
dca50cf5 AB |
2022 | (comment |
2023 | ;; TODO | |
2024 | (use-package message-x)) | |
41d290a2 | 2025 | |
b57457b2 AB |
2026 | (comment |
2027 | (use-package message-x | |
2028 | :custom | |
2029 | (message-x-completion-alist | |
2030 | (quote | |
2031 | (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address) | |
2032 | ((if | |
2033 | (boundp | |
2034 | (quote message-newgroups-header-regexp)) | |
2035 | message-newgroups-header-regexp message-newsgroups-header-regexp) | |
2036 | . message-expand-group)))))) | |
2037 | ||
2038 | (comment | |
2039 | (use-package gnus-harvest | |
2040 | :commands gnus-harvest-install | |
2041 | :demand t | |
2042 | :config | |
2043 | (if (featurep 'message-x) | |
2044 | (gnus-harvest-install 'message-x) | |
2045 | (gnus-harvest-install)))) | |
2046 | ||
2047 | \f | |
e3e5e846 | 2048 | ;;; IRC (with ERC and ZNC) |
b57457b2 | 2049 | |
dca50cf5 | 2050 | (use-package erc |
96840c88 AB |
2051 | :bind (("C-c a e b" . erc-switch-to-buffer) |
2052 | :map erc-mode-map | |
2053 | ("M-a" . erc-track-switch-buffer)) | |
2054 | :custom | |
96840c88 AB |
2055 | (erc-join-buffer 'bury) |
2056 | (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) | |
2057 | (erc-nick "bandali") | |
4d5a11b3 | 2058 | (erc-prompt "erc>") |
96840c88 AB |
2059 | (erc-rename-buffers t) |
2060 | (erc-server-reconnect-attempts 5) | |
2061 | (erc-server-reconnect-timeout 3) | |
96840c88 AB |
2062 | :config |
2063 | (with-eval-after-load 'ivy | |
2064 | ;; ignore channel buffer names | |
2065 | (add-to-list 'ivy-ignore-buffers "^#")) | |
2066 | (defun erc-cmd-OPME () | |
2067 | "Request chanserv to op me." | |
2068 | (erc-message "PRIVMSG" | |
2069 | (format "chanserv op %s %s" | |
2070 | (erc-default-target) | |
2071 | (erc-current-nick)) nil)) | |
2072 | (defun erc-cmd-DEOPME () | |
2073 | "Deop myself from current channel." | |
2074 | (erc-cmd-DEOP (format "%s" (erc-current-nick)))) | |
2075 | (add-to-list 'erc-modules 'keep-place) | |
2076 | (add-to-list 'erc-modules 'notifications) | |
2077 | (add-to-list 'erc-modules 'spelling) | |
dca50cf5 AB |
2078 | (comment |
2079 | ;; TODO | |
2080 | (add-to-list 'erc-modules 'scrolltoplace)) | |
96840c88 AB |
2081 | (erc-update-modules)) |
2082 | ||
dca50cf5 | 2083 | (use-package erc-fill |
e3e5e846 AB |
2084 | :after erc |
2085 | :custom | |
2086 | (erc-fill-function 'erc-fill-static) | |
2087 | (erc-fill-static-center 18)) | |
2088 | ||
dca50cf5 | 2089 | (use-package erc-pcomplete |
e3e5e846 AB |
2090 | :after erc |
2091 | :custom | |
2092 | (erc-pcomplete-nick-postfix ",")) | |
2093 | ||
dca50cf5 | 2094 | (use-package erc-track |
e3e5e846 AB |
2095 | :after erc |
2096 | :custom | |
2384d161 | 2097 | (erc-track-enable-keybindings nil) |
e3e5e846 AB |
2098 | (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" |
2099 | "324" "329" "332" "333" "353" "477")) | |
2100 | (erc-track-priority-faces-only 'all) | |
2101 | (erc-track-shorten-function nil)) | |
2102 | ||
96840c88 AB |
2103 | (use-package erc-hl-nicks |
2104 | :after erc) | |
2105 | ||
dca50cf5 AB |
2106 | (comment |
2107 | ;; TODO | |
2108 | (use-package erc-scrolltoplace | |
2109 | :after erc)) | |
96840c88 | 2110 | |
41d290a2 | 2111 | (use-package znc |
dca50cf5 | 2112 | :load-path "lisp/znc.el/" |
41d290a2 AB |
2113 | :bind (("C-c a e e" . znc-erc) |
2114 | ("C-c a e a" . znc-all)) | |
2115 | :config | |
2116 | (let ((pwd (let ((auth (auth-source-search :host "znca"))) | |
2117 | (cond | |
2118 | ((null auth) (error "Couldn't find znca's authinfo")) | |
2119 | (t (funcall (plist-get (car auth) :secret))))))) | |
2120 | (setq znc-servers | |
cad07800 | 2121 | `(("znc.shemshak.org" 1337 t |
4ed3a945 | 2122 | ((freenode "amin/freenode" ,pwd))) |
cad07800 | 2123 | ("znc.shemshak.org" 1337 t |
4ed3a945 | 2124 | ((moznet "amin/moznet" ,pwd))) |
cad07800 | 2125 | ("znc.shemshak.org" 1337 t |
4ed3a945 | 2126 | ((oftc "amin/oftc" ,pwd))))))) |
41d290a2 | 2127 | |
b57457b2 AB |
2128 | \f |
2129 | ;;; Post initialization | |
2130 | ||
41d290a2 AB |
2131 | (message "Loading %s...done (%.3fs)" user-init-file |
2132 | (float-time (time-subtract (current-time) | |
dca50cf5 | 2133 | b/before-user-init-time))) |
41d290a2 AB |
2134 | |
2135 | ;;; init.el ends here |