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