ec5c9abc219685d93db308c9c37f744d1e638c8f
[~bandali/configs] / init.el
1 ;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*-
2
3 ;; Copyright (C) 2018-2019 Amin Bandali <bandali@gnu.org>
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 ;; GNU Emacs configuration of Amin Bandali, computer scientist,
21 ;; Free Software activist, and GNU maintainer & webmaster. Packages
22 ;; are installed through GNU Guix for a fully reproducible setup.
23 ;; Before switching to Guix, I used straight.el, and before that Borg.
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
36
37 ;;; Code:
38
39 ;;; Emacs initialization
40
41 (defvar b/before-user-init-time (current-time)
42 "Value of `current-time' when Emacs begins loading `user-init-file'.")
43 (defvar b/emacs-initialized nil
44 "Whether Emacs has been initialized.")
45
46 (when (not (bound-and-true-p b/emacs-initialized))
47 (message "Loading Emacs...done (%.3fs)"
48 (float-time (time-subtract b/before-user-init-time
49 before-init-time))))
50
51 ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage'
52 ;; during startup to reduce garbage collection frequency. clearing
53 ;; `file-name-handler-alist' seems to help reduce startup time too.
54 (defvar b/gc-cons-threshold gc-cons-threshold)
55 (defvar b/gc-cons-percentage gc-cons-percentage)
56 (defvar b/file-name-handler-alist file-name-handler-alist)
57 (setq gc-cons-threshold (* 30 1024 1024) ; 30 MiB
58 gc-cons-percentage 0.6
59 file-name-handler-alist nil
60 ;; sidesteps a bug when profiling with esup
61 esup-child-profile-require-level 0)
62
63 ;; set them back to their defaults once we're done initializing
64 (defun b/post-init ()
65 "My post-initialize function, run after loading `user-init-file'."
66 (setq b/emacs-initialized t
67 gc-cons-threshold b/gc-cons-threshold
68 gc-cons-percentage b/gc-cons-percentage
69 file-name-handler-alist b/file-name-handler-alist)
70 (with-eval-after-load 'exwm-workspace
71 (setq-default
72 mode-line-format
73 (append
74 mode-line-format
75 '((:eval
76 (format
77 "[%s]" (number-to-string
78 exwm-workspace-current-index))))))))
79 (add-hook 'after-init-hook #'b/post-init)
80
81 ;; increase number of lines kept in *Messages* log
82 (setq message-log-max 20000)
83
84 ;; optionally, uncomment to supress some byte-compiler warnings
85 ;; (see C-h v byte-compile-warnings RET for more info)
86 ;; (setq byte-compile-warnings
87 ;; '(not free-vars unresolved noruntime lexical make-local))
88
89 \f
90 ;;; whoami
91
92 (setq user-full-name "Amin Bandali"
93 user-mail-address "bandali@gnu.org")
94
95 \f
96 ;;; comment macro
97
98 ;; useful for commenting out multiple sexps at a time
99 (defmacro comment (&rest _)
100 "Comment out one or more s-expressions."
101 (declare (indent defun))
102 nil)
103
104 \f
105 ;;; Package management
106
107 ;; No package.el (for emacs 26 and before)
108 (when (version< emacs-version "27")
109 (setq package-enable-at-startup nil)
110 ;; (package-initialize)
111 )
112 ;; for emacs 27 and later, we use early-init.el. see
113 ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b
114
115
116 ;; use-package
117 (if nil ; set to t when need to debug init
118 (progn
119 (setq use-package-verbose t
120 use-package-expand-minimally nil
121 use-package-compute-statistics t
122 debug-on-error t)
123 (require 'use-package))
124 (setq use-package-verbose nil
125 use-package-expand-minimally t))
126
127 (setq use-package-always-defer t)
128 (require 'bind-key)
129
130 \f
131 ;;; Initial setup
132
133 (defvar b/exwm-p (string= (system-name) "chaman")
134 "Whether or not we will be using `exwm'.")
135
136 ;; keep ~/.emacs.d clean
137 (use-package no-littering
138 :demand
139 :config
140 (defalias 'b/etc 'no-littering-expand-etc-file-name)
141 (defalias 'b/var 'no-littering-expand-var-file-name))
142
143 ;; separate custom file (don't want it mixing with init.el)
144 (use-package custom
145 :no-require
146 :config
147 (setq custom-file (b/etc "custom.el"))
148 (when (file-exists-p custom-file)
149 (load custom-file))
150 ;; while at it, treat themes as safe
151 (setf custom-safe-themes t)
152 ;; only one custom theme at a time
153 (comment
154 (defadvice load-theme (before clear-previous-themes activate)
155 "Clear existing theme settings instead of layering them"
156 (mapc #'disable-theme custom-enabled-themes))))
157
158 ;; load the secrets file if it exists, otherwise show a warning
159 (comment
160 (with-demoted-errors
161 (load (b/etc "secrets"))))
162
163 ;; start up emacs server. see
164 ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server
165 (use-package server
166 :defer 0.4
167 :config (or (server-running-p) (server-mode)))
168
169 \f
170 ;;; Useful utilities
171
172 ;; useful libraries
173 (require 'cl-lib)
174 (require 'subr-x)
175
176 (defmacro b/setq-every (value &rest vars)
177 "Set all the variables from VARS to value VALUE."
178 (declare (indent defun) (debug t))
179 `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars)))
180
181 (defun b/start-process (program &rest args)
182 "Same as `start-process', but doesn't bother about name and buffer."
183 (let ((process-name (concat program "_process"))
184 (buffer-name (generate-new-buffer-name
185 (concat program "_output"))))
186 (apply #'start-process
187 process-name buffer-name program args)))
188
189 (defun b/dired-start-process (program &optional args)
190 "Open current file with a PROGRAM."
191 ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can
192 ;; be nil, so remove it).
193 (apply #'b/start-process
194 program
195 (remove nil (list args (dired-get-file-for-visit)))))
196
197 (defun b/add-elisp-section ()
198 (interactive)
199 (insert "\n")
200 (previous-line)
201 (insert "\n\f\n;;; "))
202
203 ;; (defvar b/fill-column 47
204 ;; "My custom `fill-column'.")
205
206 (defconst b/asterism "* * *")
207
208 (defun b/insert-asterism ()
209 "Insert a centred asterism."
210 (interactive)
211 (insert
212 (concat
213 "\n\n"
214 (make-string (floor (/ (- fill-column (length b/asterism)) 2))
215 ?\s)
216 b/asterism
217 "\n\n")))
218
219 (defun b/no-mouse-autoselect-window ()
220 "Conveniently disable `focus-follows-mouse'.
221 For disabling the behaviour for certain buffers and/or modes."
222 (make-local-variable 'mouse-autoselect-window)
223 (setq mouse-autoselect-window nil))
224
225 (defun b/kill-current-buffer ()
226 "Kill the current buffer."
227 ;; also see https://redd.it/64xb3q
228 (interactive)
229 (kill-buffer (current-buffer)))
230
231 \f
232 ;;; Defaults
233
234 ;;;; C-level customizations
235
236 (setq
237 ;; minibuffer
238 enable-recursive-minibuffers t
239 resize-mini-windows t
240 ;; more useful frame titles
241 frame-title-format '("" invocation-name " - "
242 (:eval
243 (if (buffer-file-name)
244 (abbreviate-file-name (buffer-file-name))
245 "%b")))
246 ;; i don't feel like jumping out of my chair every now and again; so
247 ;; don't BEEP! at me, emacs
248 ring-bell-function 'ignore
249 ;; better scrolling
250 ;; scroll-margin 1
251 ;; scroll-conservatively 10000
252 scroll-step 1
253 scroll-conservatively 10
254 scroll-preserve-screen-position 1
255 ;; focus follows mouse
256 mouse-autoselect-window t)
257
258 (setq-default
259 ;; always use space for indentation
260 indent-tabs-mode nil
261 tab-width 4
262 ;; cursor shape
263 cursor-type 'bar)
264
265 ;; unicode support
266 (comment
267 (dolist (ft (fontset-list))
268 (set-fontset-font
269 ft
270 'unicode
271 (font-spec :name "Source Code Pro" :size 14))
272 (set-fontset-font
273 ft
274 'unicode
275 (font-spec :name "DejaVu Sans Mono")
276 nil
277 'append)
278 ;; (set-fontset-font
279 ;; ft
280 ;; 'unicode
281 ;; (font-spec
282 ;; :name "Symbola monospacified for DejaVu Sans Mono")
283 ;; nil
284 ;; 'append)
285 ;; (set-fontset-font
286 ;; ft
287 ;; #x2115 ; ℕ
288 ;; (font-spec :name "DejaVu Sans Mono")
289 ;; nil
290 ;; 'append)
291 (set-fontset-font
292 ft
293 (cons ?Α ?ω)
294 (font-spec :name "DejaVu Sans Mono" :size 14)
295 nil
296 'prepend)))
297
298 ;;;; Elisp-level customizations
299
300 (use-package startup
301 :no-require
302 :demand
303 :config
304 ;; don't need to see the startup echo area message
305 (advice-add #'display-startup-echo-area-message :override #'ignore)
306 :custom
307 ;; i want *scratch* as my startup buffer
308 (initial-buffer-choice t)
309 ;; i don't need the default hint
310 (initial-scratch-message nil)
311 ;; use customizable text-mode as major mode for *scratch*
312 ;; (initial-major-mode 'text-mode)
313 ;; inhibit buffer list when more than 2 files are loaded
314 (inhibit-startup-buffer-menu t)
315 ;; don't need to see the startup screen or echo area message
316 (inhibit-startup-screen t)
317 (inhibit-startup-echo-area-message user-login-name))
318
319 (use-package files
320 :no-require
321 :demand
322 :custom
323 ;; backups (C-h v make-backup-files RET)
324 (backup-by-copying t)
325 (version-control t)
326 (delete-old-versions t)
327
328 ;; auto-save
329 (auto-save-file-name-transforms
330 `((".*" ,(b/var "auto-save/") t)))
331
332 ;; insert newline at the end of files
333 (require-final-newline t)
334
335 ;; open read-only file buffers in view-mode
336 ;; (enables niceties like `q' for quit)
337 (view-read-only t))
338
339 ;; disable disabled commands
340 (setq disabled-command-function nil)
341
342 ;; lazy-person-friendly yes/no prompts
343 (defalias 'yes-or-no-p #'y-or-n-p)
344
345 ;; enable automatic reloading of changed buffers and files
346 (use-package autorevert
347 :demand
348 :config
349 (global-auto-revert-mode 1)
350 :custom
351 (auto-revert-verbose nil)
352 (global-auto-revert-non-file-buffers nil))
353
354 ;; time and battery in mode-line
355 (use-package time
356 :demand
357 :config
358 (display-time-mode)
359 :custom
360 (display-time-default-load-average nil)
361 (display-time-format "%a %b %-e %-l:%M%P")
362 (display-time-mail-icon '(image :type xpm :file "gnus/gnus-pointer.xpm" :ascent center))
363 (display-time-use-mail-icon t))
364
365 (use-package battery
366 :demand
367 :config
368 (display-battery-mode)
369 :custom
370 (battery-mode-line-format " %p%% %t"))
371
372 (use-package fringe
373 :demand
374 :config
375 ;; smaller fringe
376 ;; (fringe-mode '(3 . 1))
377 (fringe-mode nil))
378
379 (use-package winner
380 :demand
381 :config
382 ;; enable winner-mode (C-h f winner-mode RET)
383 (winner-mode 1))
384
385 (use-package compile
386 :config
387 ;; don't display *compilation* buffer on success. based on
388 ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
389 ;; instead of the now obsolete `flet'.
390 (defun b/compilation-finish-function (buffer outstr)
391 (unless (string-match "finished" outstr)
392 (switch-to-buffer-other-window buffer))
393 t)
394
395 (setq compilation-finish-functions #'b/compilation-finish-function)
396
397 (require 'cl-macs)
398
399 (defadvice compilation-start
400 (around inhibit-display
401 (command &optional mode name-function highlight-regexp))
402 (if (not (string-match "^\\(find\\|grep\\)" command))
403 (cl-letf (((symbol-function 'display-buffer) #'ignore))
404 (save-window-excursion ad-do-it))
405 ad-do-it))
406 (ad-activate 'compilation-start))
407
408 (use-package isearch
409 :custom
410 ;; allow scrolling in Isearch
411 (isearch-allow-scroll t)
412 ;; search for non-ASCII characters: i’d like non-ASCII characters such
413 ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII
414 ;; counterpart. shoutout to
415 ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html
416 (search-default-mode #'char-fold-to-regexp))
417
418 ;; uncomment to extend the above behaviour to query-replace
419 (comment
420 (use-package replace
421 :custom
422 (replace-char-fold t)))
423
424 (use-package vc
425 :bind ("C-x v C-=" . vc-ediff))
426
427 (use-package vc-git
428 :after vc
429 :custom
430 (vc-git-print-log-follow t))
431
432 (use-package ediff
433 :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo)
434 :custom ((ediff-window-setup-function 'ediff-setup-windows-plain)
435 (ediff-split-window-function 'split-window-horizontally)))
436
437 (use-package face-remap
438 :custom
439 ;; gentler font resizing
440 (text-scale-mode-step 1.05))
441
442 (use-package mwheel
443 :defer 0.4
444 :config
445 (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)) ; one line at a time
446 mouse-wheel-progressive-speed nil ; don't accelerate scrolling
447 mouse-wheel-follow-mouse t)) ; scroll window under mouse
448
449 (use-package pixel-scroll
450 :defer 0.4
451 :config (pixel-scroll-mode 1))
452
453 (use-package epg-config
454 :config
455 ;; ask for GPG passphrase in minibuffer
456 ;; this will fail if gpg>=2.1 is not available
457 (if (version< "27" emacs-version)
458 (setq epg-pinentry-mode 'loopback)
459 (setq epa-pinentry-mode 'loopback))
460 :custom
461 (epg-gpg-program (executable-find "gpg")))
462
463 (use-package epg
464 :after epg-config)
465
466 (use-package pinentry
467 :demand
468 :after (epa epg server)
469 :config
470 ;; workaround for systemd-based distros:
471 ;; (setq pinentry--socket-dir server-socket-dir)
472 (pinentry-start))
473
474 (use-package auth-source
475 :custom
476 (auth-sources '("~/.authinfo.gpg"))
477 (authinfo-hidden (regexp-opt '("password" "client-secret" "token"))))
478
479 \f
480 ;;; General bindings
481
482 (bind-keys
483 ("C-c a i" . ielm)
484
485 ("C-c e b" . eval-buffer)
486 ("C-c e e" . eval-last-sexp)
487 ("C-c e r" . eval-region)
488
489 ("C-c e i" . emacs-init-time)
490 ("C-c e u" . emacs-uptime)
491 ("C-c e v" . emacs-version)
492
493 ("C-c F m" . make-frame-command)
494 ("C-c F d" . delete-frame)
495 ("C-c F D" . server-edit)
496
497 ("C-S-h C" . describe-char)
498 ("C-S-h F" . describe-face)
499
500 ("C-x k" . b/kill-current-buffer)
501 ("C-x K" . kill-buffer)
502 ("C-x s" . save-buffer)
503 ("C-x S" . save-some-buffers)
504
505 :map emacs-lisp-mode-map
506 ("<C-return>" . b/add-elisp-section))
507
508 (when (display-graphic-p)
509 (unbind-key "C-z" global-map))
510
511 (bind-keys
512 ;; for back and forward mouse keys
513 ("<XF86Back>" . previous-buffer)
514 ("<mouse-8>" . previous-buffer)
515 ;; ("<drag-mouse-8>" . previous-buffer)
516 ("<XF86Forward>" . next-buffer)
517 ("<mouse-9>" . next-buffer)
518 ;; ("<drag-mouse-9>" . next-buffer)
519 ;; ("<drag-mouse-2>" . kill-this-buffer)
520 ;; ("<drag-mouse-3>" . switch-to-buffer)
521 )
522
523 \f
524 ;;; Essential packages
525
526 (use-package exwm
527 :if b/exwm-p
528 :demand
529 :config
530 ;; make class name the buffer name, truncating beyond 60 characters
531 (defun b/exwm-rename-buffer ()
532 (interactive)
533 (exwm-workspace-rename-buffer
534 (concat exwm-class-name ":"
535 (if (<= (length exwm-title) 60) exwm-title
536 (concat (substring exwm-title 0 59) "...")))))
537 ;; Enable EXWM
538 (exwm-enable)
539 :hook ((exwm-update-class . b/exwm-rename-buffer)
540 (exwm-update-title . b/exwm-rename-buffer)))
541
542 (use-package exwm-config
543 :demand
544 :after exwm
545 :hook (exwm-init . exwm-config--fix/ido-buffer-window-other-frame))
546
547 (use-package exwm-input
548 :demand
549 :after exwm
550 :config
551 (defun b/exwm-ws-prev-index ()
552 "Return the index for the previous EXWM workspace, wrapping
553 around if needed."
554 (if (= exwm-workspace-current-index 0)
555 (1- exwm-workspace-number)
556 (1- exwm-workspace-current-index)))
557
558 (defun b/exwm-ws-next-index ()
559 "Return the index for the next EXWM workspace, wrapping
560 around if needed."
561 (if (= exwm-workspace-current-index
562 (1- exwm-workspace-number))
563 0
564 (1+ exwm-workspace-current-index)))
565
566 ;; shorten 'C-c C-q' to 'C-q'
567 (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
568
569 (setq exwm-workspace-number 4
570 exwm-input-global-keys
571 `(([?\s-R] . exwm-reset)
572 ([?\s-\\] . exwm-workspace-switch)
573 ([?\s-\s] . dmenu)
574 ([?\S-\s-\s] . (lambda (command)
575 (interactive
576 (list (read-shell-command "➜ ")))
577 (start-process-shell-command
578 command nil command)))
579 ([s-return] . (lambda ()
580 (interactive)
581 (start-process "" nil "urxvt")))
582 ([?\C-\s-\s] . counsel-linux-app)
583 ([?\M-\s-\s] . (lambda ()
584 (interactive)
585 (start-process-shell-command
586 "rofi-pass" nil "rofi-pass")))
587 ([?\s-h] . windmove-left)
588 ([?\s-j] . windmove-down)
589 ([?\s-k] . windmove-up)
590 ([?\s-l] . windmove-right)
591 ([?\s-H] . windmove-swap-states-left)
592 ([?\s-J] . windmove-swap-states-down)
593 ([?\s-K] . windmove-swap-states-up)
594 ([?\s-L] . windmove-swap-states-right)
595 ([?\M-\s-h] . shrink-window-horizontally)
596 ([?\M-\s-l] . enlarge-window-horizontally)
597 ([?\M-\s-k] . shrink-window)
598 ([?\M-\s-j] . enlarge-window)
599 ([?\s-\[] . (lambda ()
600 (interactive)
601 (exwm-workspace-switch-create
602 (b/exwm-ws-prev-index))))
603 ([?\s-\]] . (lambda ()
604 (interactive)
605 (exwm-workspace-switch-create
606 (b/exwm-ws-next-index))))
607 ([?\s-{] . (lambda ()
608 (interactive)
609 (exwm-workspace-move-window
610 (b/exwm-ws-prev-index))))
611 ([?\s-}] . (lambda ()
612 (interactive)
613 (exwm-workspace-move-window
614 (b/exwm-ws-next-index))))
615 ,@(mapcar (lambda (i)
616 `(,(kbd (format "s-%d" i)) .
617 (lambda ()
618 (interactive)
619 (exwm-workspace-switch-create ,i))))
620 (number-sequence 0 (1- exwm-workspace-number)))
621 ([?\s-t] . exwm-floating-toggle-floating)
622 ([?\s-f] . exwm-layout-toggle-fullscreen)
623 ([?\s-W] . (lambda ()
624 (interactive)
625 (kill-buffer (current-buffer))))
626 ([?\s-Q] . (lambda ()
627 (interactive)
628 (exwm-manage--kill-client)))
629 ([?\s-\'] . (lambda ()
630 (interactive)
631 (start-process-shell-command
632 "rofi-light" nil "rofi-light")))
633 ([XF86AudioMute] .
634 (lambda ()
635 (interactive)
636 (start-process "" nil "amixer" "set" "'Master',0" "toggle")))
637 ([XF86AudioLowerVolume] .
638 (lambda ()
639 (interactive)
640 (start-process
641 "" nil "amixer" "set" "'Master',0" "5%-")))
642 ([XF86AudioRaiseVolume] .
643 (lambda ()
644 (interactive)
645 (start-process
646 "" nil "amixer" "set" "'Master',0" "5%+")))
647 ([XF86AudioPlay] .
648 (lambda ()
649 (interactive)
650 (start-process "" nil "mpc" "toggle")))
651 ([XF86AudioPrev] .
652 (lambda ()
653 (interactive)
654 (start-process "" nil "mpc" "prev")))
655 ([XF86AudioNext] .
656 (lambda ()
657 (interactive)
658 (start-process "" nil "mpc" "next")))
659 ([XF86ScreenSaver] .
660 (lambda ()
661 (interactive)
662 (start-process "" nil "dm-tool" "lock")))
663 ([\s-XF86Back] . previous-buffer)
664 ([\s-XF86Forward] . next-buffer)))
665
666 ;; Line-editing shortcuts
667 (setq exwm-input-simulation-keys
668 '(;; movement
669 ([?\C-b] . [left])
670 ([?\M-b] . [C-left])
671 ([?\C-f] . [right])
672 ([?\M-f] . [C-right])
673 ([?\C-p] . [up])
674 ([?\C-n] . [down])
675 ([?\C-a] . [home])
676 ([?\C-e] . [end])
677 ([?\M-v] . [prior])
678 ([?\C-v] . [next])
679 ([?\C-d] . [delete])
680 ([?\C-k] . [S-end ?\C-x])
681 ([?\M-<] . C-home)
682 ([?\M->] . C-end)
683 ;; cut/copy/paste
684 ([?\C-w] . [?\C-x])
685 ([?\M-w] . [?\C-c])
686 ([?\C-y] . [?\C-v])
687 ([?\M-d] . [C-S-right ?\C-x])
688 ([?\M-\d] . [C-S-left ?\C-x])
689 ;; window
690 ([?\s-w] . [?\C-w])
691 ([?\s-q] . [?\C-q])
692 ;; misc
693 ([?\C-s] . [?\C-f])
694 ([?\s-s] . [?\C-s])
695 ([?\C-g] . [escape]))))
696
697 (use-package exwm-manage
698 :demand
699 :after exwm
700 :hook
701 (exwm-manage-finish . (lambda ()
702 (when exwm-class-name
703 (cond
704 ((string= exwm-class-name "IceCat")
705 (exwm-input-set-local-simulation-keys
706 `(,@exwm-input-simulation-keys
707 ([?\C-\S-d] . [?\C-d]))))
708 ((string= exwm-class-name "URxvt")
709 (exwm-input-set-local-simulation-keys
710 '(([?\C-c ?\C-c] . [?\C-c])
711 ([?\C-c ?\C-u] . [?\C-u]))))
712 ((string= exwm-class-name "Zathura")
713 (exwm-input-set-local-simulation-keys
714 '(([?\C-p] . [C-up])
715 ([?\C-n] . [C-down])))))))))
716
717 (use-package exwm-randr
718 :demand
719 :after exwm
720 :config
721 (exwm-randr-enable)
722 :custom
723 (exwm-randr-workspace-monitor-plist '(1 "VGA-1")))
724
725 (use-package exwm-systemtray
726 :demand
727 :after exwm
728 :config
729 (exwm-systemtray-enable))
730
731 (use-package exwm-workspace)
732
733 (use-package exwm-edit
734 :demand
735 :after exwm)
736
737 ;; use the org-plus-contrib package to get the whole deal
738 (use-package org-plus-contrib)
739
740 (use-package org
741 :defer 0.5
742 :config
743 (setq org-src-tab-acts-natively t
744 org-src-preserve-indentation nil
745 org-edit-src-content-indentation 0
746 org-link-email-description-format "Email %c: %s" ; %.30s
747 org-highlight-latex-and-related '(entities)
748 org-use-speed-commands t
749 org-startup-folded 'content
750 org-catch-invisible-edits 'show-and-error
751 org-log-done 'time)
752 (when (version< org-version "9.3")
753 (setq org-email-link-description-format
754 org-link-email-description-format))
755 (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
756 (add-to-list 'org-modules 'org-habit)
757 :bind
758 (("C-c a o a" . org-agenda)
759 :map org-mode-map
760 ("M-L" . org-insert-last-stored-link)
761 ("M-O" . org-toggle-link-display))
762 :hook ((org-mode . org-indent-mode)
763 (org-mode . auto-fill-mode)
764 (org-mode . flyspell-mode))
765 :custom
766 (org-pretty-entities t)
767 (org-agenda-files '("~/usr/org/todos/personal.org"
768 "~/usr/org/todos/habits.org"
769 "~/src/git/masters-thesis/todo.org"))
770 (org-agenda-start-on-weekday 0)
771 (org-agenda-time-leading-zero t)
772 (org-habit-graph-column 44)
773 (org-latex-packages-alist '(("" "listings") ("" "color")))
774 :custom-face
775 '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21"))))
776 '(org-block ((t (:background "#1d1f21"))))
777 '(org-latex-and-related ((t (:foreground "#b294bb")))))
778
779 (use-package ox-latex
780 :after ox
781 :config
782 (setq org-latex-listings 'listings
783 ;; org-latex-prefer-user-labels t
784 )
785 (add-to-list 'org-latex-classes
786 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
787 ("\\section{%s}" . "\\section*{%s}")
788 ("\\subsection{%s}" . "\\subsection*{%s}")
789 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
790 ("\\paragraph{%s}" . "\\paragraph*{%s}")
791 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
792 t)
793 (require 'ox-beamer))
794
795 (use-package ox-extra
796 :config
797 (ox-extras-activate '(latex-header-blocks ignore-headlines)))
798
799 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
800 ;; org file. closely inspired by
801 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
802 (with-eval-after-load 'org
803 (defvar b/show-async-tangle-results nil
804 "Keep *emacs* async buffers around for later inspection.")
805
806 (defvar b/show-async-tangle-time nil
807 "Show the time spent tangling the file.")
808
809 (defun b/async-babel-tangle ()
810 "Tangle org file asynchronously."
811 (interactive)
812 (let* ((file-tangle-start-time (current-time))
813 (file (buffer-file-name))
814 (file-nodir (file-name-nondirectory file))
815 ;; (async-quiet-switch "-q")
816 (file-noext (file-name-sans-extension file)))
817 (async-start
818 `(lambda ()
819 (require 'org)
820 (org-babel-tangle-file ,file))
821 (unless b/show-async-tangle-results
822 `(lambda (result)
823 (if result
824 (message "Tangled %s%s"
825 ,file-nodir
826 (if b/show-async-tangle-time
827 (format " (%.3fs)"
828 (float-time (time-subtract (current-time)
829 ',file-tangle-start-time)))
830 ""))
831 (message "Tangling %s failed" ,file-nodir))))))))
832
833 (add-to-list
834 'safe-local-variable-values
835 '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local))
836
837 ;; *the* right way to do git
838 (use-package magit
839 :defer 0.5
840 :bind (("C-x g" . magit-status)
841 ("C-c g g" . magit-status)
842 ("C-c g b" . magit-blame-addition)
843 ("C-c g l" . magit-log-buffer-file))
844 :config
845 (magit-add-section-hook 'magit-status-sections-hook
846 'magit-insert-modules
847 'magit-insert-stashes
848 'append)
849 ;; (magit-add-section-hook 'magit-status-sections-hook
850 ;; 'magit-insert-ignored-files
851 ;; 'magit-insert-untracked-files
852 ;; 'append)
853 (setq magit-repository-directories '(("~/.emacs.d/" . 0)
854 ("~/src/git/" . 2)))
855 (nconc magit-section-initial-visibility-alist
856 '(([unpulled status] . show)
857 ([unpushed status] . show)))
858 :custom
859 (magit-diff-refine-hunk t)
860 (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
861 ;; (magit-completing-read-function 'magit-ido-completing-read)
862 :custom-face (magit-diff-file-heading ((t (:weight normal)))))
863
864 ;; recently opened files
865 (use-package recentf
866 :defer 0.2
867 ;; :config
868 ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
869 :config
870 (recentf-mode)
871 :custom
872 (recentf-max-saved-items 2000))
873
874 ;; smart M-x enhancement (needed by counsel for history)
875 ;; (use-package smex)
876
877 (bind-keys
878 ("C-c f ." . find-file)
879 ("C-c f d" . find-name-dired)
880 ("C-c f l" . find-library)
881 ;; ("C-c f r" . recentf-open-files)
882 ("C-c x" . execute-extended-command))
883
884 (comment
885 (use-package ido
886 :demand
887 :bind
888 (:map ido-common-completion-map
889 ([escape] . minibuffer-keyboard-quit)
890 ("DEL" . b/ido-backspace))
891 :config
892 (require 'delsel)
893 (defun b/ido-backspace ()
894 "Forward to `backward-delete-char'. On error (read-only), quit."
895 (interactive)
896 (condition-case nil
897 (backward-delete-char 1)
898 (error
899 (minibuffer-keyboard-quit))))
900 (ido-mode 1)
901 (ido-everywhere 1)
902 :custom
903 (ido-enable-flex-matching t)
904 ;; (ido-enable-regexp t)
905 ;; (ido-enable-prefix t)
906 (ido-max-window-height 10)
907 (ido-use-virtual-buffers t))
908
909 (use-package ido-vertical-mode
910 :defer 0.3
911 :config
912 (ido-vertical-mode 1)
913 :custom
914 (ido-vertical-define-keys 'C-n-C-p-up-and-down)
915 (ido-vertical-show-count t))
916
917 (use-package ido-completing-read+
918 :defer 0.3
919 :after ido
920 :config
921 (ido-ubiquitous-mode 1))
922
923 (use-package crm-custom
924 :defer 0.3
925 :config
926 (crm-custom-mode 1))
927
928 (use-package icomplete
929 :defer 0.3
930 :config
931 (icomplete-mode 1)))
932
933 (use-package amx
934 :defer 0.3
935 :config
936 (amx-mode))
937
938 (use-package ivy
939 :defer 0.3
940 :bind
941 (:map ivy-minibuffer-map
942 ([escape] . keyboard-escape-quit)
943 ([S-up] . ivy-previous-history-element)
944 ([S-down] . ivy-next-history-element)
945 ("DEL" . ivy-backward-delete-char))
946 :config
947 (setq ivy-wrap t
948 ;; ivy-height 14
949 ivy-use-virtual-buffers t
950 ivy-virtual-abbreviate 'abbreviate
951 ivy-count-format "%d/%d ")
952
953 (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode))
954 (defun b/ivy-ignore-buffer-p (str)
955 "Return non-nil if str names a buffer with a major mode
956 derived from one of `b/ivy-ignore-buffer-modes'.
957
958 This function is intended for use with `ivy-ignore-buffers'."
959 (let* ((buf (get-buffer str))
960 (mode (and buf (buffer-local-value 'major-mode buf))))
961 (and mode
962 (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes))))
963 (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p)
964
965 (ivy-mode 1)
966 :custom-face
967 (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee"))))
968 (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold))))
969 (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold))))
970 (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold))))
971 (ivy-current-match ((((class color) (background light))
972 :background "#d7d7d7" :foreground "black")
973 (((class color) (background dark))
974 :background "#65a7e2" :foreground "black"))))
975
976 (use-package swiper
977 :demand
978 :after ivy
979 :bind (("C-S-s" . swiper-isearch)))
980
981 (use-package counsel
982 :demand
983 :after ivy
984 :bind (("C-c f r" . counsel-recentf)
985 :map minibuffer-local-map
986 ("C-r" . counsel-minibuffer-history))
987 :config
988 (counsel-mode 1)
989 (defalias 'locate #'counsel-locate))
990
991 (use-package eshell
992 :defer 0.5
993 :commands eshell
994 :bind ("C-c a s e" . eshell)
995 :config
996 (eval-when-compile (defvar eshell-prompt-regexp))
997 (defun b/eshell-quit-or-delete-char (arg)
998 (interactive "p")
999 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
1000 (eshell-life-is-too-much)
1001 (delete-char arg)))
1002
1003 (defun b/eshell-clear ()
1004 (interactive)
1005 (let ((inhibit-read-only t))
1006 (erase-buffer))
1007 (eshell-send-input))
1008
1009 (defun b/eshell-setup ()
1010 (make-local-variable 'company-idle-delay)
1011 (defvar company-idle-delay)
1012 (setq company-idle-delay nil)
1013 (bind-keys :map eshell-mode-map
1014 ("C-d" . b/eshell-quit-or-delete-char)
1015 ("C-S-l" . b/eshell-clear)
1016 ("M-r" . counsel-esh-history)
1017 ;; ([tab] . company-complete)
1018 )
1019 (if (version< "27" emacs-version)
1020 (bind-keys :map eshell-hist-mode-map
1021 ("M-r" . counsel-esh-history))
1022 (bind-keys :map eshell-mode-map
1023 ("M-r" . counsel-esh-history))))
1024
1025 (setq
1026 eshell-prompt-regexp "\\(.*\n\\)*[$#] "
1027 eshell-prompt-function
1028 (lambda ()
1029 (concat
1030 (propertize (format "%s@%s:" (user-login-name) (system-name))
1031 'face 'default)
1032 (propertize (abbreviate-file-name default-directory)
1033 'face 'font-lock-comment-face)
1034 (propertize "\n" 'face 'default)
1035 (if (= (user-uid) 0)
1036 (propertize "#" 'face 'red)
1037 (propertize "$" 'face 'default))
1038 (propertize " " 'face 'default))))
1039
1040 :hook (eshell-mode . b/eshell-setup)
1041 :custom
1042 (eshell-hist-ignoredups t)
1043 (eshell-input-filter 'eshell-input-filter-initial-space))
1044
1045 (use-package ibuffer
1046 :bind
1047 (("C-x C-b" . ibuffer)
1048 :map ibuffer-mode-map
1049 ("P" . ibuffer-backward-filter-group)
1050 ("N" . ibuffer-forward-filter-group)
1051 ("M-p" . ibuffer-do-print)
1052 ("M-n" . ibuffer-do-shell-command-pipe-replace))
1053 :config
1054 ;; Use human readable Size column instead of original one
1055 (define-ibuffer-column size-h
1056 (:name "Size" :inline t)
1057 (cond
1058 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
1059 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
1060 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
1061 (t (format "%8d" (buffer-size)))))
1062 :custom
1063 (ibuffer-saved-filter-groups
1064 '(("default"
1065 ("dired" (mode . dired-mode))
1066 ("org" (mode . org-mode))
1067 ("gnus"
1068 (or
1069 (mode . gnus-group-mode)
1070 (mode . gnus-summary-mode)
1071 (mode . gnus-article-mode)
1072 ;; not really, but...
1073 (mode . message-mode)))
1074 ("web"
1075 (or
1076 ;; (mode . web-mode)
1077 (mode . mhtml-mode)
1078 (mode . css-mode)
1079 (mode . scss-mode)
1080 (mode . js2-mode)))
1081 ("shell"
1082 (or
1083 (mode . eshell-mode)
1084 (mode . shell-mode)
1085 (mode . term-mode)))
1086 ("programming"
1087 (or
1088 (mode . python-mode)
1089 (mode . c-mode)
1090 (mode . c++-mode)
1091 (mode . java-mode)
1092 (mode . emacs-lisp-mode)
1093 (mode . scheme-mode)
1094 (mode . haskell-mode)
1095 (mode . lean-mode)
1096 ;; (mode . go-mode)
1097 (mode . alloy-mode)))
1098 ("tex"
1099 (or
1100 (mode . bibtex-mode)
1101 (mode . latex-mode)))
1102 ("emacs"
1103 (or
1104 (name . "^\\*scratch\\*$")
1105 (name . "^\\*Messages\\*$")))
1106 ("exwm" (mode . exwm-mode))
1107 ("erc" (mode . erc-mode)))))
1108 (ibuffer-formats
1109 '((mark modified read-only locked " "
1110 (name 72 72 :left :elide)
1111 " "
1112 (size-h 9 -1 :right)
1113 " "
1114 (mode 16 16 :left :elide)
1115 " " filename-and-process)
1116 (mark " "
1117 (name 16 -1)
1118 " " filename)))
1119 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
1120
1121 (use-package outline
1122 :disabled
1123 :hook (prog-mode . outline-minor-mode)
1124 :bind
1125 (:map
1126 outline-minor-mode-map
1127 ("<s-tab>" . outline-toggle-children)
1128 ("M-p" . outline-previous-visible-heading)
1129 ("M-n" . outline-next-visible-heading)
1130 :prefix-map b/outline-prefix-map
1131 :prefix "s-O"
1132 ("TAB" . outline-toggle-children)
1133 ("a" . outline-hide-body)
1134 ("H" . outline-hide-body)
1135 ("S" . outline-show-all)
1136 ("h" . outline-hide-subtree)
1137 ("s" . outline-show-subtree)))
1138
1139 (use-package ls-lisp
1140 :custom (ls-lisp-dirs-first t))
1141
1142 (use-package dired
1143 :config
1144 (setq dired-dwim-target t
1145 dired-listing-switches "-alh"
1146 ls-lisp-use-insert-directory-program nil)
1147
1148 ;; easily diff 2 marked files
1149 ;; https://oremacs.com/2017/03/18/dired-ediff/
1150 (defun dired-ediff-files ()
1151 (interactive)
1152 (require 'dired-aux)
1153 (defvar ediff-after-quit-hook-internal)
1154 (let ((files (dired-get-marked-files))
1155 (wnd (current-window-configuration)))
1156 (if (<= (length files) 2)
1157 (let ((file1 (car files))
1158 (file2 (if (cdr files)
1159 (cadr files)
1160 (read-file-name
1161 "file: "
1162 (dired-dwim-target-directory)))))
1163 (if (file-newer-than-file-p file1 file2)
1164 (ediff-files file2 file1)
1165 (ediff-files file1 file2))
1166 (add-hook 'ediff-after-quit-hook-internal
1167 (lambda ()
1168 (setq ediff-after-quit-hook-internal nil)
1169 (set-window-configuration wnd))))
1170 (error "no more than 2 files should be marked"))))
1171
1172 (require 'dired-x)
1173 (setq dired-guess-shell-alist-user
1174 '(("\\.pdf\\'" "evince" "zathura" "okular")
1175 ("\\.doc\\'" "libreoffice")
1176 ("\\.docx\\'" "libreoffice")
1177 ("\\.ppt\\'" "libreoffice")
1178 ("\\.pptx\\'" "libreoffice")
1179 ("\\.xls\\'" "libreoffice")
1180 ("\\.xlsx\\'" "libreoffice")
1181 ("\\.flac\\'" "mpv")))
1182 :bind (:map dired-mode-map
1183 ("b" . dired-up-directory)
1184 ("E" . dired-ediff-files)
1185 ("e" . dired-toggle-read-only)
1186 ("\\" . dired-hide-details-mode)
1187 ("z" . (lambda ()
1188 (interactive)
1189 (b/dired-start-process "zathura"))))
1190 :hook (dired-mode . dired-hide-details-mode))
1191
1192 (use-package help
1193 :config
1194 (temp-buffer-resize-mode)
1195 (setq help-window-select t))
1196
1197 (use-package tramp
1198 :config
1199 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
1200 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
1201 (add-to-list 'tramp-default-proxies-alist
1202 (list (regexp-quote (system-name)) nil nil)))
1203
1204 (use-package doc-view
1205 :bind (:map doc-view-mode-map
1206 ("M-RET" . image-previous-line)))
1207
1208 \f
1209 ;;; Editing
1210
1211 ;; highlight uncommitted changes in the left fringe
1212 (use-package diff-hl
1213 :defer 0.6
1214 :config
1215 (setq diff-hl-draw-borders nil)
1216 (global-diff-hl-mode)
1217 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
1218
1219 ;; display Lisp objects at point in the echo area
1220 (use-package eldoc
1221 :when (version< "25" emacs-version)
1222 :config (global-eldoc-mode))
1223
1224 ;; highlight matching parens
1225 (use-package paren
1226 :demand
1227 :config (show-paren-mode))
1228
1229 (use-package elec-pair
1230 :demand
1231 :config (electric-pair-mode))
1232
1233 (use-package simple
1234 :config (column-number-mode)
1235 :custom
1236 ;; Save what I copy into clipboard from other applications into Emacs'
1237 ;; kill-ring, which would allow me to still be able to easily access
1238 ;; it in case I kill (cut or copy) something else inside Emacs before
1239 ;; yanking (pasting) what I'd originally intended to.
1240 (save-interprogram-paste-before-kill t))
1241
1242 ;; save minibuffer history
1243 (use-package savehist
1244 :demand
1245 :config
1246 (savehist-mode)
1247 (add-to-list 'savehist-additional-variables 'kill-ring))
1248
1249 ;; automatically save place in files
1250 (use-package saveplace
1251 :when (version< "25" emacs-version)
1252 :config (save-place-mode))
1253
1254 (use-package prog-mode
1255 :config (global-prettify-symbols-mode)
1256 (defun indicate-buffer-boundaries-left ()
1257 (setq indicate-buffer-boundaries 'left))
1258 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
1259
1260 (use-package text-mode
1261 :bind (:map text-mode-map ("C-*" . b/insert-asterism))
1262 :hook ((text-mode . indicate-buffer-boundaries-left)
1263 (text-mode . flyspell-mode)))
1264
1265 (use-package conf-mode
1266 :mode "\\.*rc$")
1267
1268 (use-package sh-mode
1269 :mode "\\.bashrc$")
1270
1271 (use-package company
1272 :disabled
1273 :bind
1274 (:map company-active-map
1275 ([tab] . company-complete-common-or-cycle)
1276 ([escape] . company-abort)
1277 ("C-p" . company-select-previous-or-abort)
1278 ("C-n" . company-select-next-or-abort))
1279 :custom
1280 (company-minimum-prefix-length 1)
1281 (company-selection-wrap-around t)
1282 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
1283 (company-dabbrev-downcase nil)
1284 (company-dabbrev-ignore-case nil)
1285 ;; :config
1286 ;; (global-company-mode t)
1287 )
1288
1289 (use-package flycheck
1290 :defer 0.6
1291 :hook (prog-mode . flycheck-mode)
1292 :bind
1293 (:map flycheck-mode-map
1294 ("M-P" . flycheck-previous-error)
1295 ("M-N" . flycheck-next-error))
1296 :config
1297 ;; Use the load-path from running Emacs when checking elisp files
1298 (setq flycheck-emacs-lisp-load-path 'inherit)
1299
1300 ;; Only flycheck when I actually save the buffer
1301 (setq flycheck-check-syntax-automatically '(mode-enabled save))
1302 :custom (flycheck-mode-line-prefix "flyc"))
1303
1304 (use-package flyspell)
1305
1306 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
1307 (use-package ispell
1308 :defer 0.6
1309 :config
1310 ;; ’ can be part of a word
1311 (setq ispell-local-dictionary-alist
1312 `((nil "[[:alpha:]]" "[^[:alpha:]]"
1313 "['\x2019]" nil ("-B") nil utf-8))
1314 ispell-program-name (executable-find "hunspell"))
1315 ;; don't send ’ to the subprocess
1316 (defun endless/replace-apostrophe (args)
1317 (cons (replace-regexp-in-string
1318 "’" "'" (car args))
1319 (cdr args)))
1320 (advice-add #'ispell-send-string :filter-args
1321 #'endless/replace-apostrophe)
1322
1323 ;; convert ' back to ’ from the subprocess
1324 (defun endless/replace-quote (args)
1325 (if (not (derived-mode-p 'org-mode))
1326 args
1327 (cons (replace-regexp-in-string
1328 "'" "’" (car args))
1329 (cdr args))))
1330 (advice-add #'ispell-parse-output :filter-args
1331 #'endless/replace-quote))
1332
1333 (use-package abbrev
1334 :hook (text-mode . abbrev-mode))
1335
1336 \f
1337 ;;; Programming modes
1338
1339 (use-package lisp-mode
1340 :config
1341 (defun indent-spaces-mode ()
1342 (setq indent-tabs-mode nil))
1343 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
1344
1345 (use-package reveal
1346 :hook (emacs-lisp-mode . reveal-mode))
1347
1348 (use-package elisp-mode)
1349
1350 ;; (use-package alloy-mode
1351 ;; :straight (:host github :repo "dwwmmn/alloy-mode")
1352 ;; :mode "\\.\\(als\\|dsh\\)\\'"
1353 ;; :config
1354 ;; (setq alloy-basic-offset 2)
1355 ;; ;; (defun b/alloy-simple-indent (start end)
1356 ;; ;; (interactive "r")
1357 ;; ;; ;; (if (region-active-p)
1358 ;; ;; ;; (indent-rigidly start end alloy-basic-offset)
1359 ;; ;; ;; (if (bolp)
1360 ;; ;; ;; (indent-rigidly (line-beginning-position)
1361 ;; ;; ;; (line-end-position)
1362 ;; ;; ;; alloy-basic-offset)))
1363 ;; ;; (indent-to (+ (current-column) alloy-basic-offset)))
1364 ;; :bind (:map alloy-mode-map
1365 ;; ("RET" . electric-newline-and-maybe-indent)
1366 ;; ;; ("TAB" . b/alloy-simple-indent)
1367 ;; ("TAB" . indent-for-tab-command))
1368 ;; :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil))))
1369
1370 (eval-when-compile (defvar lean-mode-map))
1371 (use-package lean-mode
1372 :defer 0.4
1373 :bind (:map lean-mode-map
1374 ("S-SPC" . company-complete))
1375 :config
1376 (require 'lean-input)
1377 (setq default-input-method "Lean"
1378 lean-input-tweak-all '(lean-input-compose
1379 (lean-input-prepend "/")
1380 (lean-input-nonempty))
1381 lean-input-user-translations '(("/" "/")))
1382 (lean-input-setup))
1383
1384 (use-package mhtml-mode)
1385
1386 (use-package sgml-mode
1387 :config
1388 (setq sgml-basic-offset 0))
1389
1390 (use-package css-mode
1391 :config
1392 (setq css-indent-offset 2))
1393
1394 (use-package emmet-mode
1395 :after (:any mhtml-mode css-mode sgml-mode)
1396 :bind* (("C-)" . emmet-next-edit-point)
1397 ("C-(" . emmet-prev-edit-point))
1398 :config
1399 (unbind-key "C-j" emmet-mode-keymap)
1400 (setq emmet-move-cursor-between-quotes t)
1401 :hook (css-mode html-mode sgml-mode))
1402
1403 (use-package geiser)
1404
1405 (use-package geiser-guile
1406 :config
1407 (setq geiser-guile-load-path "~/src/git/guix"))
1408
1409 (use-package guix)
1410
1411 (comment
1412 (use-package auctex
1413 :custom
1414 (font-latex-fontify-sectioning 'color)))
1415
1416 (use-package go-mode
1417 :disabled)
1418
1419 (use-package po-mode
1420 :hook
1421 (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit))))
1422
1423 (use-package tex-mode
1424 :config
1425 (cl-delete-if
1426 (lambda (p) (string-match "^---?" (car p)))
1427 tex--prettify-symbols-alist)
1428 :hook ((tex-mode . auto-fill-mode)
1429 (tex-mode . flyspell-mode)))
1430
1431 ;; (use-package george-mode
1432 ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode")
1433 ;; :mode "\\.grg\\'")
1434
1435 \f
1436 ;;; Theme
1437
1438 (add-to-list 'custom-theme-load-path
1439 (expand-file-name
1440 (convert-standard-filename "lisp") user-emacs-directory))
1441 (load-theme 'tangomod t)
1442
1443 (use-package smart-mode-line
1444 :commands (sml/apply-theme)
1445 :demand
1446 :config
1447 ;; thanks, but no thnaks; don't make fixed-width fills.
1448 (defun sml/fill-for-buffer-identification () "")
1449 (setq sml/theme 'tangomod)
1450 (sml/setup)
1451 (smart-mode-line-enable))
1452
1453 (use-package doom-modeline
1454 :disabled
1455 :demand
1456 :hook (after-init . doom-modeline-init)
1457 :custom
1458 (doom-modeline-buffer-file-name-style 'relative-to-project))
1459
1460 (use-package doom-themes)
1461
1462 (use-package moody
1463 :disabled
1464 :demand
1465 :config
1466 (setq x-underline-at-descent-line t)
1467 (let ((line (face-attribute 'mode-line :underline)))
1468 (set-face-attribute 'mode-line nil :overline line)
1469 (set-face-attribute 'mode-line-inactive nil :overline line)
1470 (set-face-attribute 'mode-line-inactive nil :underline line)
1471 (set-face-attribute 'mode-line nil :box nil)
1472 (set-face-attribute 'mode-line-inactive nil :box nil)
1473 (set-face-attribute 'mode-line-inactive nil :background "#e1e1e1")) ; d3d7cf
1474 (moody-replace-mode-line-buffer-identification)
1475 (moody-replace-vc-mode))
1476
1477 (use-package mini-modeline
1478 :disabled
1479 :demand
1480 :config (mini-modeline-mode))
1481
1482 (defvar b/org-mode-font-lock-keywords
1483 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1484 (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
1485 (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
1486 (4 '(:foreground "#c5c8c6") t))) ; title
1487 "For use with the `doom-tomorrow-night' theme.")
1488
1489 (defun b/lights-on ()
1490 "Enable my favourite light theme."
1491 (interactive)
1492 (mapc #'disable-theme custom-enabled-themes)
1493 (load-theme 'tangomod t)
1494 (when (featurep 'smart-mode-line)
1495 (sml/apply-theme 'tangomod))
1496 (font-lock-remove-keywords
1497 'org-mode b/org-mode-font-lock-keywords)
1498 (when (featurep 'erc-hl-nicks)
1499 (erc-hl-nicks-reset-face-table))
1500 (when (featurep 'exwm-systemtray)
1501 (exwm-systemtray--refresh)))
1502
1503 (defun b/lights-off ()
1504 "Go dark."
1505 (interactive)
1506 (mapc #'disable-theme custom-enabled-themes)
1507 (load-theme 'doom-one t)
1508 (when (featurep 'smart-mode-line)
1509 (sml/apply-theme 'automatic))
1510 (font-lock-add-keywords
1511 'org-mode b/org-mode-font-lock-keywords t)
1512 (when (featurep 'erc-hl-nicks)
1513 (erc-hl-nicks-reset-face-table))
1514 (when (featurep 'exwm-systemtray)
1515 (exwm-systemtray--refresh)))
1516
1517 (bind-keys
1518 ("C-c t d" . b/lights-off)
1519 ("C-c t l" . b/lights-on))
1520
1521 \f
1522 ;;; Emacs enhancements & auxiliary packages
1523
1524 (use-package man
1525 :config (setq Man-width 80))
1526
1527 (use-package which-key
1528 :defer 0.4
1529 :config
1530 (which-key-add-key-based-replacements
1531 ;; prefixes for global prefixes and minor modes
1532 "C-c @" "outline"
1533 "C-c !" "flycheck"
1534 "C-x RET" "coding system"
1535 "C-x 8" "unicode"
1536 "C-x @" "event modifiers"
1537 "C-x a" "abbrev/expand"
1538 "C-x r" "rectangle/register/bookmark"
1539 "C-x t" "tabs"
1540 "C-x v" "version control"
1541 "C-x X" "edebug"
1542 "C-x C-a" "edebug"
1543 "C-x C-k" "kmacro"
1544 ;; prefixes for my personal bindings
1545 "C-c &" "yasnippet"
1546 "C-c a" "applications"
1547 "C-c a e" "erc"
1548 "C-c a o" "org"
1549 "C-c a s" "shells"
1550 "C-c b" "buffers"
1551 "C-c c" "compile-and-comments"
1552 "C-c e" "eval"
1553 "C-c f" "files"
1554 "C-c F" "frames"
1555 "C-c g" "magit"
1556 "C-S-h" "help(ful)"
1557 "C-c m" "multiple-cursors"
1558 "C-c p" "projectile"
1559 "C-c p s" "projectile/search"
1560 "C-c p x" "projectile/execute"
1561 "C-c p 4" "projectile/other-window"
1562 "C-c q" "boxquote"
1563 "C-c t" "themes"
1564 ;; "s-O" "outline"
1565 )
1566
1567 ;; prefixes for major modes
1568 (which-key-add-major-mode-key-based-replacements 'message-mode
1569 "C-c f n" "footnote")
1570 (which-key-add-major-mode-key-based-replacements 'org-mode
1571 "C-c C-v" "org-babel")
1572
1573 (which-key-mode)
1574 :custom
1575 (which-key-add-column-padding 5)
1576 (which-key-max-description-length 32))
1577
1578 (use-package crux ; results in Waiting for git... [2 times]
1579 :defer 0.4
1580 :bind (("C-c d" . crux-duplicate-current-line-or-region)
1581 ("C-c M-d" . crux-duplicate-and-comment-current-line-or-region)
1582 ("C-c f C" . crux-copy-file-preserve-attributes)
1583 ("C-c f D" . crux-delete-file-and-buffer)
1584 ("C-c f R" . crux-rename-file-and-buffer)
1585 ("C-c j" . crux-top-join-line)
1586 ("C-S-j" . crux-top-join-line)))
1587
1588 (use-package mwim
1589 :bind (("C-a" . mwim-beginning-of-code-or-line)
1590 ("C-e" . mwim-end-of-code-or-line)
1591 ("<home>" . mwim-beginning-of-line-or-code)
1592 ("<end>" . mwim-end-of-line-or-code)))
1593
1594 (use-package projectile
1595 :disabled
1596 :defer 0.5
1597 :bind-keymap ("C-c p" . projectile-command-map)
1598 :config
1599 (projectile-mode)
1600
1601 (defun b/projectile-mode-line-fun ()
1602 "Report project name and type in the modeline."
1603 (let ((project-name (projectile-project-name))
1604 (project-type (projectile-project-type)))
1605 (format "%s%s"
1606 projectile-mode-line-prefix
1607 (if project-type
1608 (format ":%s" project-type)
1609 ""))))
1610 (setq projectile-mode-line-function 'b/projectile-mode-line-fun)
1611
1612 (defun my-projectile-invalidate-cache (&rest _args)
1613 ;; ignore the args to `magit-checkout'
1614 (projectile-invalidate-cache nil))
1615
1616 (eval-after-load 'magit-branch
1617 '(progn
1618 (advice-add 'magit-checkout
1619 :after #'my-projectile-invalidate-cache)
1620 (advice-add 'magit-branch-and-checkout
1621 :after #'my-projectile-invalidate-cache)))
1622 :custom
1623 (projectile-completion-system 'ivy)
1624 (projectile-mode-line-prefix " proj"))
1625
1626 (use-package helpful
1627 :defer 0.6
1628 :bind
1629 (("C-S-h c" . helpful-command)
1630 ("C-S-h f" . helpful-callable) ; helpful-function
1631 ("C-S-h v" . helpful-variable)
1632 ("C-S-h k" . helpful-key)
1633 ("C-S-h p" . helpful-at-point)))
1634
1635 (use-package unkillable-scratch
1636 :defer 0.6
1637 :config
1638 (unkillable-scratch 1)
1639 :custom
1640 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
1641
1642 ;; ,----
1643 ;; | make pretty boxed quotes like this
1644 ;; `----
1645 (use-package boxquote
1646 :defer 0.6
1647 :bind
1648 (:prefix-map b/boxquote-prefix-map
1649 :prefix "C-c q"
1650 ("b" . boxquote-buffer)
1651 ("B" . boxquote-insert-buffer)
1652 ("d" . boxquote-defun)
1653 ("F" . boxquote-insert-file)
1654 ("hf" . boxquote-describe-function)
1655 ("hk" . boxquote-describe-key)
1656 ("hv" . boxquote-describe-variable)
1657 ("hw" . boxquote-where-is)
1658 ("k" . boxquote-kill)
1659 ("p" . boxquote-paragraph)
1660 ("q" . boxquote-boxquote)
1661 ("r" . boxquote-region)
1662 ("s" . boxquote-shell-command)
1663 ("t" . boxquote-text)
1664 ("T" . boxquote-title)
1665 ("u" . boxquote-unbox)
1666 ("U" . boxquote-unbox-region)
1667 ("y" . boxquote-yank)
1668 ("M-q" . boxquote-fill-paragraph)
1669 ("M-w" . boxquote-kill-ring-save)))
1670
1671 (use-package orgalist
1672 ;; breaks auto-fill-mode, showing this error:
1673 ;; orgalist--boundaries: Lisp nesting exceeds ‘max-lisp-eval-depth’
1674 :disabled
1675 :after message
1676 :hook (message-mode . orgalist-mode))
1677
1678 ;; highlight TODOs in buffers
1679 (use-package hl-todo
1680 :defer 0.5
1681 :config
1682 (global-hl-todo-mode))
1683
1684 (use-package multi-term
1685 :disabled
1686 :defer 0.6
1687 :bind (("C-c a s m m" . multi-term)
1688 ("C-c a s m d" . multi-term-dedicated-toggle)
1689 ("C-c a s m p" . multi-term-prev)
1690 ("C-c a s m n" . multi-term-next)
1691 :map term-mode-map
1692 ("C-c C-j" . term-char-mode))
1693 :config
1694 (setq multi-term-program "screen"
1695 multi-term-program-switches (concat "-c"
1696 (getenv "XDG_CONFIG_HOME")
1697 "/screen/screenrc")
1698 ;; TODO: add separate bindings for connecting to existing
1699 ;; session vs. always creating a new one
1700 multi-term-dedicated-select-after-open-p t
1701 multi-term-dedicated-window-height 20
1702 multi-term-dedicated-max-window-height 30
1703 term-bind-key-alist
1704 '(("C-c C-c" . term-interrupt-subjob)
1705 ("C-c C-e" . term-send-esc)
1706 ("C-c C-j" . term-line-mode)
1707 ("C-k" . kill-line)
1708 ;; ("C-y" . term-paste)
1709 ("C-y" . term-send-raw)
1710 ("M-f" . term-send-forward-word)
1711 ("M-b" . term-send-backward-word)
1712 ("M-p" . term-send-up)
1713 ("M-n" . term-send-down)
1714 ("M-j" . term-send-raw-meta)
1715 ("M-y" . term-send-raw-meta)
1716 ("M-/" . term-send-raw-meta)
1717 ("M-0" . term-send-raw-meta)
1718 ("M-1" . term-send-raw-meta)
1719 ("M-2" . term-send-raw-meta)
1720 ("M-3" . term-send-raw-meta)
1721 ("M-4" . term-send-raw-meta)
1722 ("M-5" . term-send-raw-meta)
1723 ("M-6" . term-send-raw-meta)
1724 ("M-7" . term-send-raw-meta)
1725 ("M-8" . term-send-raw-meta)
1726 ("M-9" . term-send-raw-meta)
1727 ("<C-backspace>" . term-send-backward-kill-word)
1728 ("<M-DEL>" . term-send-backward-kill-word)
1729 ("M-d" . term-send-delete-word)
1730 ("M-," . term-send-raw)
1731 ("M-." . comint-dynamic-complete))
1732 term-unbind-key-alist
1733 '("C-z" "C-x" "C-c" "C-h"
1734 ;; "C-y"
1735 "<ESC>")))
1736
1737 (use-package page-break-lines
1738 :defer 0.5
1739 :custom
1740 (page-break-lines-max-width fill-column)
1741 :config
1742 (global-page-break-lines-mode))
1743
1744 (use-package expand-region
1745 :bind ("C-=" . er/expand-region))
1746
1747 (use-package multiple-cursors
1748 :bind
1749 (("C-S-<mouse-1>" . mc/add-cursor-on-click)
1750 (:prefix-map b/mc-prefix-map
1751 :prefix "C-c m"
1752 ("c" . mc/edit-lines)
1753 ("n" . mc/mark-next-like-this)
1754 ("p" . mc/mark-previous-like-this)
1755 ("a" . mc/mark-all-like-this))))
1756
1757 (use-package yasnippet
1758 :defer 0.6
1759 :config
1760 (defconst yas-verbosity-cur yas-verbosity)
1761 (setq yas-verbosity 2)
1762 (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
1763 (yas-reload-all)
1764 (setq yas-verbosity yas-verbosity-cur)
1765
1766 (defun b/yas--maybe-expand-key-filter (cmd)
1767 (when (and (yas--maybe-expand-key-filter cmd)
1768 (not (bound-and-true-p git-commit-mode)))
1769 cmd))
1770 (defconst b/yas-maybe-expand
1771 '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter))
1772 (define-key yas-minor-mode-map
1773 (kbd "SPC") b/yas-maybe-expand)
1774
1775 (yas-global-mode))
1776
1777 (use-package debbugs
1778 :bind
1779 (("C-c D d" . debbugs-gnu)
1780 ("C-c D b" . debbugs-gnu-bugs)
1781 ("C-c D e" .
1782 (lambda ()
1783 (interactive) ; bug-gnu-emacs
1784 (setq debbugs-gnu-current-suppress t)
1785 (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
1786 ("C-c D g" . ; bug-gnuzilla
1787 (lambda ()
1788 (interactive)
1789 (setq debbugs-gnu-current-suppress t)
1790 (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
1791 ("C-c D G b" . ; bug-guix
1792 (lambda ()
1793 (interactive)
1794 (setq debbugs-gnu-current-suppress t)
1795 (debbugs-gnu debbugs-gnu-default-severities '("guix"))))
1796 ("C-c D G p" . ; guix-patches
1797 (lambda ()
1798 (interactive)
1799 (setq debbugs-gnu-current-suppress t)
1800 (debbugs-gnu debbugs-gnu-default-severities '("guix-patches"))))))
1801
1802 (use-package org-ref
1803 :init
1804 (b/setq-every '("~/usr/org/references.bib")
1805 reftex-default-bibliography
1806 org-ref-default-bibliography)
1807 (setq
1808 org-ref-bibliography-notes "~/usr/org/notes.org"
1809 org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
1810
1811 ;; (use-package fill-column-indicator)
1812
1813 (use-package window
1814 :bind
1815 (("C-c w e" . (lambda ()
1816 (interactive)
1817 (split-window-right)
1818 (other-window 1)
1819 (erc-switch-to-buffer)))
1820 ("C-c w s l" . (lambda ()
1821 (interactive)
1822 (split-window-right)
1823 (other-window 1)))
1824 ("C-c w s j" . (lambda ()
1825 (interactive)
1826 (split-window-below)
1827 (other-window 1)))
1828 ("C-c w q" . quit-window))
1829 :custom
1830 (split-width-threshold 150))
1831
1832 (use-package windmove
1833 :defer 0.6
1834 :bind
1835 (("C-c w h" . windmove-left)
1836 ("C-c w j" . windmove-down)
1837 ("C-c w k" . windmove-up)
1838 ("C-c w l" . windmove-right)
1839 ("C-c w H" . windmove-swap-states-left)
1840 ("C-c w J" . windmove-swap-states-down)
1841 ("C-c w K" . windmove-swap-states-up)
1842 ("C-c w L" . windmove-swap-states-right)))
1843
1844 (use-package pass
1845 :commands pass
1846 :bind ("C-c a p" . pass)
1847 :hook (pass-mode . View-exit))
1848
1849 (use-package pdf-tools
1850 :defer 0.5
1851 :bind (:map pdf-view-mode-map
1852 ("<C-XF86Back>" . pdf-history-backward)
1853 ("<mouse-8>" . pdf-history-backward)
1854 ("<drag-mouse-8>" . pdf-history-backward)
1855 ("<C-XF86Forward>" . pdf-history-forward)
1856 ("<mouse-9>" . pdf-history-forward)
1857 ("<drag-mouse-9>" . pdf-history-forward)
1858 ("M-RET" . image-previous-line)
1859 ("C-s" . isearch-forward)
1860 ("s s" . isearch-forward))
1861 :config (pdf-tools-install nil t)
1862 :custom (pdf-view-resize-factor 1.05))
1863
1864 (use-package org-pdftools
1865 :disabled
1866 :straight (:host github :repo "fuxialexander/org-pdftools")
1867 :demand
1868 :after org
1869 :config
1870 (with-eval-after-load 'org
1871 (require 'org-pdftools)))
1872
1873 (use-package biblio)
1874
1875 (use-package reftex
1876 :hook (latex-mode . reftex-mode))
1877
1878 (use-package reftex-cite
1879 :after reftex
1880 :disabled ; enable to disable
1881 ; reftex-cite's default choice
1882 ; of previous word
1883 :config
1884 (defun reftex-get-bibkey-default ()
1885 "If the cursor is in a citation macro, return the word before the macro."
1886 (let* ((macro (reftex-what-macro 1)))
1887 (save-excursion
1888 (when (and macro (string-match "cite" (car macro)))
1889 (goto-char (cdr macro)))
1890 (reftex-this-word)))))
1891
1892 (use-package minions
1893 :demand
1894 :config (minions-mode))
1895
1896 (use-package dmenu
1897 :custom
1898 (dmenu-prompt-string "run: ")
1899 (dmenu-save-file (b/var "dmenu-items")))
1900
1901 (use-package eosd
1902 ;; TODO: fix build by properly building the eosd-pixbuf.c module
1903 ;; e.g. see https://github.com/raxod502/straight.el/issues/386
1904 :disabled
1905 :straight (:host github :repo "clarete/eosd")
1906 :demand
1907 :after exwm
1908 :config
1909 (eosd-start))
1910
1911 (use-package scpaste
1912 :disabled
1913 :config
1914 (setq scpaste-http-destination "https://p.bndl.org"
1915 scpaste-scp-destination "nix:/var/www/p.bndl.org"))
1916
1917 (use-package eww
1918 :bind ("C-c a e w" . eww)
1919 :custom
1920 (eww-download-directory (file-name-as-directory
1921 (getenv "XDG_DOWNLOAD_DIR"))))
1922
1923 \f
1924 ;;; Email (with Gnus)
1925
1926 (defvar b/maildir (expand-file-name "~/mail/"))
1927 (with-eval-after-load 'recentf
1928 (add-to-list 'recentf-exclude b/maildir))
1929
1930 (setq
1931 b/gnus-init-file (b/etc "gnus")
1932 mail-user-agent 'gnus-user-agent
1933 read-mail-command 'gnus)
1934
1935 (use-package gnus
1936 :bind (("s-m" . gnus-plugged)
1937 ("s-M" . gnus-unplugged)
1938 ("C-c a m" . gnus-plugged)
1939 ("C-c a M" . gnus-unplugged))
1940 :init
1941 (setq
1942 gnus-select-method '(nnnil "")
1943 gnus-secondary-select-methods
1944 '((nnimap "shemshak"
1945 (nnimap-stream plain)
1946 (nnimap-address "127.0.0.1")
1947 (nnimap-server-port 143)
1948 (nnimap-authenticator plain)
1949 (nnimap-user "amin@shemshak.local"))
1950 (nnimap "gnu"
1951 (nnimap-stream plain)
1952 (nnimap-address "127.0.0.1")
1953 (nnimap-server-port 143)
1954 (nnimap-authenticator plain)
1955 (nnimap-user "bandali@gnu.local")
1956 (nnimap-inbox "INBOX")
1957 (nnimap-split-methods 'nnimap-split-fancy)
1958 (nnimap-split-fancy (|
1959 ;; (: gnus-registry-split-fancy-with-parent)
1960 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1961 ;; gnu
1962 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
1963 ;; gnus
1964 (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
1965 ;; libreplanet
1966 (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
1967 ;; *.lists.sr.ht, omitting one dot if present
1968 ;; add more \\.?\\([^.]*\\) if needed
1969 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
1970 ;; webmasters
1971 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1972 ;; other
1973 (list ".*atreus.freelists.org" "l.atreus")
1974 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1975 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
1976 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
1977 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
1978 ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
1979 ;; ----------------------------------
1980 ;; legend: (u)nsubscribed | (d)ead
1981 ;; ----------------------------------
1982 ;; otherwise, leave mail in INBOX
1983 "INBOX")))
1984 (nnimap "uw"
1985 (nnimap-stream plain)
1986 (nnimap-address "127.0.0.1")
1987 (nnimap-server-port 143)
1988 (nnimap-authenticator plain)
1989 (nnimap-user "abandali@uw.local")
1990 (nnimap-inbox "INBOX")
1991 (nnimap-split-methods 'nnimap-split-fancy)
1992 (nnimap-split-fancy (|
1993 ;; (: gnus-registry-split-fancy-with-parent)
1994 ;; se212-f19
1995 ("subject" "SE\\s-?212" "course.se212-f19")
1996 (from "SE\\s-?212" "course.se212-f19")
1997 ;; catch-all
1998 "INBOX")))
1999 (nnimap "csc"
2000 (nnimap-stream plain)
2001 (nnimap-address "127.0.0.1")
2002 (nnimap-server-port 143)
2003 (nnimap-authenticator plain)
2004 (nnimap-user "abandali@csc.uw.local")))
2005 gnus-message-archive-group "nnimap+gnu:INBOX"
2006 gnus-parameters
2007 '(("l\\.atreus"
2008 (to-address . "atreus@freelists.org")
2009 (to-list . "atreus@freelists.org"))
2010 ("l\\.deepspec"
2011 (to-address . "deepspec@lists.cs.princeton.edu")
2012 (to-list . "deepspec@lists.cs.princeton.edu")
2013 (list-identifier . "\\[deepspec\\]"))
2014 ("l\\.emacs-devel"
2015 (to-address . "emacs-devel@gnu.org")
2016 (to-list . "emacs-devel@gnu.org"))
2017 ("l\\.help-gnu-emacs"
2018 (to-address . "help-gnu-emacs@gnu.org")
2019 (to-list . "help-gnu-emacs@gnu.org"))
2020 ("l\\.info-gnu-emacs"
2021 (to-address . "info-gnu-emacs@gnu.org")
2022 (to-list . "info-gnu-emacs@gnu.org"))
2023 ("l\\.emacs-orgmode"
2024 (to-address . "emacs-orgmode@gnu.org")
2025 (to-list . "emacs-orgmode@gnu.org")
2026 (list-identifier . "\\[O\\]"))
2027 ("l\\.emacs-tangents"
2028 (to-address . "emacs-tangents@gnu.org")
2029 (to-list . "emacs-tangents@gnu.org"))
2030 ("l\\.emacsconf-committee"
2031 (to-address . "emacsconf-committee@gnu.org")
2032 (to-list . "emacsconf-committee@gnu.org"))
2033 ("l\\.emacsconf-discuss"
2034 (to-address . "emacsconf-discuss@gnu.org")
2035 (to-list . "emacsconf-discuss@gnu.org"))
2036 ("l\\.emacsconf-register"
2037 (to-address . "emacsconf-register@gnu.org")
2038 (to-list . "emacsconf-register@gnu.org"))
2039 ("l\\.emacsconf-submit"
2040 (to-address . "emacsconf-submit@gnu.org")
2041 (to-list . "emacsconf-submit@gnu.org"))
2042 ("l\\.fencepost-users"
2043 (to-address . "fencepost-users@gnu.org")
2044 (to-list . "fencepost-users@gnu.org")
2045 (list-identifier . "\\[Fencepost-users\\]"))
2046 ("l\\.gnewsense-art"
2047 (to-address . "gnewsense-art@nongnu.org")
2048 (to-list . "gnewsense-art@nongnu.org")
2049 (list-identifier . "\\[gNewSense-art\\]"))
2050 ("l\\.gnewsense-dev"
2051 (to-address . "gnewsense-dev@nongnu.org")
2052 (to-list . "gnewsense-dev@nongnu.org")
2053 (list-identifier . "\\[Gnewsense-dev\\]"))
2054 ("l\\.gnewsense-users"
2055 (to-address . "gnewsense-users@nongnu.org")
2056 (to-list . "gnewsense-users@nongnu.org")
2057 (list-identifier . "\\[gNewSense-users\\]"))
2058 ("l\\.gnunet-developers"
2059 (to-address . "gnunet-developers@gnu.org")
2060 (to-list . "gnunet-developers@gnu.org")
2061 (list-identifier . "\\[GNUnet-developers\\]"))
2062 ("l\\.help-gnunet"
2063 (to-address . "help-gnunet@gnu.org")
2064 (to-list . "help-gnunet@gnu.org")
2065 (list-identifier . "\\[Help-gnunet\\]"))
2066 ("l\\.bug-gnuzilla"
2067 (to-address . "bug-gnuzilla@gnu.org")
2068 (to-list . "bug-gnuzilla@gnu.org")
2069 (list-identifier . "\\[Bug-gnuzilla\\]"))
2070 ("l\\.gnuzilla-dev"
2071 (to-address . "gnuzilla-dev@gnu.org")
2072 (to-list . "gnuzilla-dev@gnu.org")
2073 (list-identifier . "\\[Gnuzilla-dev\\]"))
2074 ("l\\.guile-devel"
2075 (to-address . "guile-devel@gnu.org")
2076 (to-list . "guile-devel@gnu.org"))
2077 ("l\\.guile-user"
2078 (to-address . "guile-user@gnu.org")
2079 (to-list . "guile-user@gnu.org"))
2080 ("l\\.guix-devel"
2081 (to-address . "guix-devel@gnu.org")
2082 (to-list . "guix-devel@gnu.org"))
2083 ("l\\.help-guix"
2084 (to-address . "help-guix@gnu.org")
2085 (to-list . "help-guix@gnu.org"))
2086 ("l\\.info-guix"
2087 (to-address . "info-guix@gnu.org")
2088 (to-list . "info-guix@gnu.org"))
2089 ("l\\.savannah-hackers-public"
2090 (to-address . "savannah-hackers-public@gnu.org")
2091 (to-list . "savannah-hackers-public@gnu.org"))
2092 ("l\\.savannah-users"
2093 (to-address . "savannah-users@gnu.org")
2094 (to-list . "savannah-users@gnu.org"))
2095 ("l\\.www-commits"
2096 (to-address . "www-commits@gnu.org")
2097 (to-list . "www-commits@gnu.org"))
2098 ("l\\.www-discuss"
2099 (to-address . "www-discuss@gnu.org")
2100 (to-list . "www-discuss@gnu.org"))
2101 ("l\\.haskell-art"
2102 (to-address . "haskell-art@we.lurk.org")
2103 (to-list . "haskell-art@we.lurk.org")
2104 (list-identifier . "\\[haskell-art\\]"))
2105 ("l\\.haskell-cafe"
2106 (to-address . "haskell-cafe@haskell.org")
2107 (to-list . "haskell-cafe@haskell.org")
2108 (list-identifier . "\\[Haskell-cafe\\]"))
2109 ("l\\.notmuch"
2110 (to-address . "notmuch@notmuchmail.org")
2111 (to-list . "notmuch@notmuchmail.org"))
2112 ("l\\.parabola-dev"
2113 (to-address . "dev@lists.parabola.nu")
2114 (to-list . "dev@lists.parabola.nu")
2115 (list-identifier . "\\[Dev\\]"))
2116 ("l\\.~bandali\\.public-inbox"
2117 (to-address . "~bandali/public-inbox@lists.sr.ht")
2118 (to-list . "~bandali/public-inbox@lists.sr.ht"))
2119 ("l\\.~sircmpwn\\.free-writers-club"
2120 (to-address . "~sircmpwn/free-writers-club@lists.sr.ht")
2121 (to-list . "~sircmpwn/free-writers-club@lists.sr.ht"))
2122 ("l\\.~sircmpwn\\.srht-admins"
2123 (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht")
2124 (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht"))
2125 ("l\\.~sircmpwn\\.srht-announce"
2126 (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht")
2127 (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht"))
2128 ("l\\.~sircmpwn\\.srht-dev"
2129 (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht")
2130 (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht"))
2131 ("l\\.~sircmpwn\\.srht-discuss"
2132 (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht")
2133 (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht"))
2134 ("webmasters"
2135 (to-address . "webmasters@gnu.org")
2136 (to-list . "webmasters@gnu.org"))
2137 ("gnu.*"
2138 (gcc-self . t))
2139 ("l\\."
2140 (subscribed . t))
2141 ("nnimap\\+uw:.*"
2142 (gcc-self . t)))
2143 gnus-large-newsgroup 50
2144 gnus-home-directory (b/var "gnus/")
2145 gnus-directory (concat gnus-home-directory "news/")
2146 message-directory (concat gnus-home-directory "mail/")
2147 nndraft-directory (concat gnus-home-directory "drafts/")
2148 gnus-save-newsrc-file nil
2149 gnus-read-newsrc-file nil
2150 gnus-interactive-exit nil
2151 gnus-gcc-mark-as-read t)
2152 :config
2153 (when (version< emacs-version "27")
2154 (with-eval-after-load 'nnmail
2155 (add-to-list
2156 'nnmail-split-abbrev-alist
2157 '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
2158 t)))
2159
2160 ;; (gnus-registry-initialize)
2161
2162 (with-eval-after-load 'recentf
2163 (add-to-list 'recentf-exclude gnus-home-directory)))
2164
2165 (use-package gnus-art
2166 :config
2167 (setq
2168 gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)")
2169 gnus-sorted-header-list '("^From:"
2170 "^X-RT-Originator"
2171 "^Newsgroups:"
2172 "^Subject:"
2173 "^Date:"
2174 "^Envelope-To:"
2175 "^Followup-To:"
2176 "^Reply-To:"
2177 "^Organization:"
2178 "^Summary:"
2179 "^Abstract:"
2180 "^Keywords:"
2181 "^To:"
2182 "^[BGF]?Cc:"
2183 "^Posted-To:"
2184 "^Mail-Copies-To:"
2185 "^Mail-Followup-To:"
2186 "^Apparently-To:"
2187 "^Resent-From:"
2188 "^User-Agent:"
2189 "^X-detected-operating-system:"
2190 "^Message-ID:"
2191 ;; "^References:"
2192 "^List-Id:"
2193 "^Gnus-Warning:")
2194 gnus-visible-headers (mapconcat 'identity
2195 gnus-sorted-header-list
2196 "\\|")
2197 ;; local-lapsed article dates
2198 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
2199 gnus-article-date-headers '(user-defined)
2200 gnus-article-time-format
2201 (lambda (time)
2202 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
2203 (local (article-make-date-line date 'local))
2204 (combined-lapsed (article-make-date-line date
2205 'combined-lapsed))
2206 (lapsed (progn
2207 (string-match " (.+" combined-lapsed)
2208 (match-string 0 combined-lapsed))))
2209 (concat local lapsed))))
2210 (bind-keys
2211 :map gnus-article-mode-map
2212 ("M-L" . org-store-link)))
2213
2214 (use-package gnus-sum
2215 :bind (:map gnus-summary-mode-map
2216 :prefix-map b/gnus-summary-prefix-map
2217 :prefix "v"
2218 ("r" . gnus-summary-reply)
2219 ("w" . gnus-summary-wide-reply)
2220 ("v" . gnus-summary-show-raw-article))
2221 :config
2222 (bind-keys
2223 :map gnus-summary-mode-map
2224 ("M-L" . org-store-link))
2225 :hook (gnus-summary-mode . b/no-mouse-autoselect-window)
2226 :custom
2227 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
2228 gnus-thread-sort-by-subject
2229 gnus-thread-sort-by-date)))
2230
2231 (use-package gnus-msg
2232 :config
2233 (defvar b/shemshak-signature "Amin Bandali
2234 https://shemshak.org/~amin")
2235 (defvar b/uw-signature "Amin Bandali, MMath Student
2236 Cheriton School of Computer Science
2237 University of Waterloo
2238 https://bandali.eu.org")
2239 (defvar b/csc-signature "Amin Bandali
2240 System Administrator, Systems Committee
2241 Computer Science Club, University of Waterloo
2242 https://csclub.uwaterloo.ca/~abandali")
2243 (setq gnus-message-replysign t
2244 gnus-posting-styles
2245 '((".*"
2246 (address "bandali@gnu.org"))
2247 ("nnimap\\+gnu:l\\..*"
2248 (signature nil))
2249 ("nnimap\\+gnu:.*"
2250 (organization "GNU"))
2251 ((header "subject" "ThankCRM")
2252 (to "webmasters-comment@gnu.org")
2253 (body "")
2254 (eval (setq b/message-cite-say-hi nil)))
2255 ("nnimap\\+shemshak:.*"
2256 (address "amin@shemshak.org")
2257 (body "\nBest,\n")
2258 (signature b/shemshak-signature)
2259 (gcc "nnimap+shemshak:Sent")
2260 (eval (setq b/message-cite-say-hi t)))
2261 ("nnimap\\+uw:.*"
2262 (address "bandali@uwaterloo.ca")
2263 (body "\nBest,\n")
2264 (signature b/uw-signature))
2265 ("nnimap\\+uw:INBOX"
2266 (gcc "\"nnimap+uw:Sent Items\""))
2267 ("nnimap\\+csc:.*"
2268 (address "bandali@csclub.uwaterloo.ca")
2269 (signature b/csc-signature)
2270 (gcc "nnimap+csc:Sent"))))
2271 :hook (gnus-message-setup . (lambda ()
2272 (unless (mml-secure-is-encrypted-p)
2273 (mml-secure-message-sign)))))
2274
2275 (use-package gnus-topic
2276 :hook (gnus-group-mode . gnus-topic-mode)
2277 :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n"))
2278
2279 (use-package gnus-agent
2280 :config
2281 (setq gnus-agent-synchronize-flags 'ask)
2282 :hook (gnus-group-mode . gnus-agent-mode))
2283
2284 (use-package gnus-group
2285 :config
2286 (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)"))
2287
2288 (comment
2289 ;; problematic with ebdb's popup, *EBDB-Gnus*
2290 (use-package gnus-win
2291 :config
2292 (setq gnus-use-full-window nil)))
2293
2294 (use-package gnus-dired
2295 :commands gnus-dired-mode
2296 :init
2297 (add-hook 'dired-mode-hook 'gnus-dired-mode))
2298
2299 (comment
2300 (use-package gnus-utils
2301 :custom
2302 (gnus-completing-read-function 'gnus-ido-completing-read)))
2303
2304 (use-package mm-decode
2305 :config
2306 (setq mm-discouraged-alternatives '("text/html" "text/richtext")
2307 mm-decrypt-option 'known
2308 mm-verify-option 'known))
2309
2310 (use-package mm-uu
2311 :config
2312 (when (version< "27" emacs-version)
2313 (set-face-attribute 'mm-uu-extract nil :extend t))
2314 :custom
2315 (mm-uu-diff-groups-regexp
2316 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
2317
2318 (use-package sendmail
2319 :config
2320 (setq sendmail-program (executable-find "msmtp")
2321 ;; message-sendmail-extra-arguments '("-v" "-d")
2322 mail-specify-envelope-from t
2323 mail-envelope-from 'header))
2324
2325 (use-package message
2326 :bind (:map message-mode-map ("<C-return>" . b/insert-asterism))
2327 :config
2328 ;; redefine for a simplified In-Reply-To header
2329 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
2330 (defun message-make-in-reply-to ()
2331 "Return the In-Reply-To header for this message."
2332 (when message-reply-headers
2333 (let ((from (mail-header-from message-reply-headers))
2334 (msg-id (mail-header-id message-reply-headers)))
2335 (when from
2336 msg-id))))
2337
2338 (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:")
2339 (defconst message-cite-style-bandali
2340 '((message-cite-function 'message-cite-original)
2341 (message-citation-line-function 'message-insert-formatted-citation-line)
2342 (message-cite-reply-position 'traditional)
2343 (message-yank-prefix "> ")
2344 (message-yank-cited-prefix ">")
2345 (message-yank-empty-prefix ">")
2346 (message-citation-line-format
2347 (if b/message-cite-say-hi
2348 (concat "Hi %F,\n\n" b/message-cite-style-format)
2349 b/message-cite-style-format)))
2350 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
2351 (setq ;; message-cite-style 'message-cite-style-bandali
2352 message-kill-buffer-on-exit t
2353 message-send-mail-function 'message-send-mail-with-sendmail
2354 message-sendmail-envelope-from 'header
2355 message-subscribed-address-functions
2356 '(gnus-find-subscribed-addresses)
2357 message-dont-reply-to-names
2358 "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)")
2359 ;; (require 'company-ebdb)
2360 :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
2361 (message-mode . flyspell-mode)
2362 (message-mode . (lambda ()
2363 ;; (setq-local fill-column b/fill-column
2364 ;; message-fill-column b/fill-column)
2365 (make-local-variable 'company-idle-delay)
2366 (setq company-idle-delay 0.2))))
2367 ;; :custom-face
2368 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
2369 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
2370 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
2371 :custom
2372 (message-elide-ellipsis "[...]\n"))
2373
2374 (use-package mml)
2375
2376 (use-package mml-sec
2377 :custom
2378 (mml-secure-openpgp-encrypt-to-self t)
2379 (mml-secure-openpgp-sign-with-sender t))
2380
2381 (use-package footnote
2382 :after message
2383 ;; :config
2384 ;; (setq footnote-start-tag ""
2385 ;; footnote-end-tag ""
2386 ;; footnote-style 'unicode)
2387 :bind
2388 (:map message-mode-map
2389 :prefix-map b/footnote-prefix-map
2390 :prefix "C-c f n"
2391 ("a" . footnote-add-footnote)
2392 ("b" . footnote-back-to-message)
2393 ("c" . footnote-cycle-style)
2394 ("d" . footnote-delete-footnote)
2395 ("g" . footnote-goto-footnote)
2396 ("r" . footnote-renumber-footnotes)
2397 ("s" . footnote-set-style)))
2398
2399 (use-package ebdb
2400 :demand
2401 :after gnus
2402 :bind (:map gnus-group-mode-map ("e" . ebdb))
2403 :config
2404 (setq ebdb-sources (b/var "ebdb"))
2405 (with-eval-after-load 'swiper
2406 (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
2407
2408 (use-package ebdb-com
2409 :after ebdb)
2410
2411 (use-package ebdb-complete
2412 :after ebdb
2413 :config
2414 ;; (setq ebdb-complete-mail 'capf)
2415 (ebdb-complete-enable))
2416
2417 (use-package ebdb-message
2418 :demand
2419 :after ebdb)
2420
2421 ;; (use-package company-ebdb
2422 ;; :config
2423 ;; (defun company-ebdb--post-complete (_) nil))
2424
2425 (use-package ebdb-gnus
2426 :after ebdb
2427 :custom
2428 (ebdb-gnus-window-size 0.3))
2429
2430 (use-package ebdb-mua
2431 :demand
2432 :after ebdb
2433 :custom (ebdb-mua-pop-up t))
2434
2435 ;; (use-package ebdb-message
2436 ;; :after ebdb)
2437
2438 ;; (use-package ebdb-vcard
2439 ;; :after ebdb)
2440
2441 (use-package message-x)
2442
2443 (comment
2444 (use-package message-x
2445 :custom
2446 (message-x-completion-alist
2447 (quote
2448 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address)
2449 ((if
2450 (boundp
2451 (quote message-newgroups-header-regexp))
2452 message-newgroups-header-regexp message-newsgroups-header-regexp)
2453 . message-expand-group))))))
2454
2455 (comment
2456 (use-package gnus-harvest
2457 :commands gnus-harvest-install
2458 :demand t
2459 :config
2460 (if (featurep 'message-x)
2461 (gnus-harvest-install 'message-x)
2462 (gnus-harvest-install))))
2463
2464 (use-package gnus-article-treat-patch
2465 :disabled
2466 :demand
2467 :load-path "lisp/"
2468 :config
2469 ;; note: be sure to customize faces with `:foreground "white"' when
2470 ;; using a theme with a white/light background :)
2471 (setq ft/gnus-article-patch-conditions
2472 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
2473
2474 \f
2475 ;;; IRC (with ERC and ZNC)
2476
2477 (use-package erc
2478 :bind (("C-c b b" . erc-switch-to-buffer)
2479 :map erc-mode-map
2480 ("M-a" . erc-track-switch-buffer))
2481 :custom
2482 (erc-join-buffer 'bury)
2483 (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
2484 (erc-nick "bandali")
2485 (erc-prompt "erc>")
2486 (erc-rename-buffers t)
2487 (erc-server-reconnect-attempts 5)
2488 (erc-server-reconnect-timeout 3)
2489 :config
2490 (defun erc-cmd-OPME ()
2491 "Request chanserv to op me."
2492 (erc-message "PRIVMSG"
2493 (format "chanserv op %s %s"
2494 (erc-default-target)
2495 (erc-current-nick)) nil))
2496 (defun erc-cmd-DEOPME ()
2497 "Deop myself from current channel."
2498 (erc-cmd-DEOP (format "%s" (erc-current-nick))))
2499 (add-to-list 'erc-modules 'keep-place)
2500 (add-to-list 'erc-modules 'notifications)
2501 (add-to-list 'erc-modules 'smiley)
2502 (add-to-list 'erc-modules 'spelling)
2503 (add-to-list 'erc-modules 'scrolltoplace)
2504 (erc-update-modules))
2505
2506 (use-package erc-fill
2507 :after erc
2508 :custom
2509 (erc-fill-column 77)
2510 (erc-fill-function 'erc-fill-static)
2511 (erc-fill-static-center 18))
2512
2513 (use-package erc-pcomplete
2514 :after erc
2515 :custom
2516 (erc-pcomplete-nick-postfix ", "))
2517
2518 (use-package erc-track
2519 :after erc
2520 :bind (("C-c a e t d" . erc-track-disable)
2521 ("C-c a e t e" . erc-track-enable))
2522 :custom
2523 (erc-track-enable-keybindings nil)
2524 (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
2525 "324" "329" "332" "333" "353" "477"))
2526 (erc-track-position-in-mode-line t)
2527 (erc-track-priority-faces-only 'all)
2528 (erc-track-shorten-function nil))
2529
2530 (use-package erc-hl-nicks
2531 :after erc)
2532
2533 (use-package erc-scrolltoplace
2534 :after erc)
2535
2536 (use-package znc
2537 :bind (("C-c a e e" . znc-erc)
2538 ("C-c a e a" . znc-all))
2539 :config
2540 (let ((pwd (let ((auth (auth-source-search :host "znca")))
2541 (cond
2542 ((null auth) (error "Couldn't find znca's authinfo"))
2543 (t (funcall (plist-get (car auth) :secret)))))))
2544 (setq znc-servers
2545 `(("znc.shemshak.org" 1337 t
2546 ((freenode "amin/freenode" ,pwd)))
2547 ("znc.shemshak.org" 1337 t
2548 ((oftc "amin/oftc" ,pwd)))))))
2549
2550 \f
2551 ;;; Post initialization
2552
2553 (message "Loading %s...done (%.3fs)" user-init-file
2554 (float-time (time-subtract (current-time)
2555 b/before-user-init-time)))
2556
2557 ;;; init.el ends here