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