589dda3592904c68ec8da8765ba0e652bc3d728f
[~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 (tex-mode . (lambda () (electric-indent-local-mode -1)))))
1447
1448 \f
1449 ;;; Theme
1450
1451 (add-to-list 'custom-theme-load-path
1452 (expand-file-name
1453 (convert-standard-filename "lisp") user-emacs-directory))
1454 (load-theme 'tangomod t)
1455
1456 (use-package smart-mode-line
1457 :commands (sml/apply-theme)
1458 :demand
1459 :config
1460 (sml/setup)
1461 (smart-mode-line-enable))
1462
1463 (use-package doom-themes)
1464
1465 (defvar b/org-mode-font-lock-keywords
1466 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1467 (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
1468 (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
1469 (4 '(:foreground "#c5c8c6") t)))) ; title
1470
1471 (defun b/lights-on ()
1472 "Enable my favourite light theme."
1473 (interactive)
1474 (mapc #'disable-theme custom-enabled-themes)
1475 (load-theme 'tangomod t)
1476 (sml/apply-theme 'automatic)
1477 (font-lock-remove-keywords
1478 'org-mode b/org-mode-font-lock-keywords))
1479
1480 (defun b/lights-off ()
1481 "Go dark."
1482 (interactive)
1483 (mapc #'disable-theme custom-enabled-themes)
1484 (load-theme 'doom-tomorrow-night t)
1485 (sml/apply-theme 'automatic)
1486 (font-lock-add-keywords
1487 'org-mode b/org-mode-font-lock-keywords t))
1488
1489 (bind-keys
1490 ("C-c t d" . b/lights-off)
1491 ("C-c t l" . b/lights-on))
1492
1493 \f
1494 ;;; Emacs enhancements & auxiliary packages
1495
1496 (use-package man
1497 :config (setq Man-width 80))
1498
1499 (use-package which-key
1500 :defer 0.4
1501 :delight
1502 :config
1503 (which-key-add-key-based-replacements
1504 ;; prefixes for global prefixes and minor modes
1505 "C-c @" "outline"
1506 "C-c !" "flycheck"
1507 "C-c 8" "typo"
1508 "C-c 8 -" "typo/dashes"
1509 "C-c 8 <" "typo/left-brackets"
1510 "C-c 8 >" "typo/right-brackets"
1511 "C-x 8" "unicode"
1512 "C-x a" "abbrev/expand"
1513 "C-x r" "rectangle/register/bookmark"
1514 "C-x v" "version control"
1515 ;; prefixes for my personal bindings
1516 "C-c a" "applications"
1517 "C-c a e" "erc"
1518 "C-c a o" "org"
1519 "C-c a s" "shells"
1520 "C-c b" "buffers"
1521 "C-c c" "compile-and-comments"
1522 "C-c e" "eval"
1523 "C-c f" "files"
1524 "C-c F" "frames"
1525 "C-c g" "magit"
1526 "C-S-h" "help(ful)"
1527 "C-c m" "multiple-cursors"
1528 "C-c P" "projectile"
1529 "C-c P s" "projectile/search"
1530 "C-c P x" "projectile/execute"
1531 "C-c P 4" "projectile/other-window"
1532 "C-c q" "boxquote"
1533 "C-c t" "themes"
1534 ;; "s-O" "outline"
1535 )
1536
1537 ;; prefixes for major modes
1538 (which-key-add-major-mode-key-based-replacements 'message-mode
1539 "C-c f n" "footnote")
1540 (which-key-add-major-mode-key-based-replacements 'org-mode
1541 "C-c C-v" "org-babel")
1542 (which-key-add-major-mode-key-based-replacements 'web-mode
1543 "C-c C-a" "web/attributes"
1544 "C-c C-b" "web/blocks"
1545 "C-c C-d" "web/dom"
1546 "C-c C-e" "web/element"
1547 "C-c C-t" "web/tags")
1548
1549 (which-key-mode)
1550 :custom
1551 (which-key-add-column-padding 5)
1552 (which-key-max-description-length 32))
1553
1554 (use-package crux ; results in Waiting for git... [2 times]
1555 :defer 0.4
1556 :bind (("C-c d" . crux-duplicate-current-line-or-region)
1557 ("C-c D" . crux-duplicate-and-comment-current-line-or-region)
1558 ("C-c f c" . crux-copy-file-preserve-attributes)
1559 ("C-c f d" . crux-delete-file-and-buffer)
1560 ("C-c f r" . crux-rename-file-and-buffer)
1561 ("C-c j" . crux-top-join-line)
1562 ("C-S-j" . crux-top-join-line)))
1563
1564 (use-package mwim
1565 :bind (("C-a" . mwim-beginning-of-code-or-line)
1566 ("C-e" . mwim-end-of-code-or-line)
1567 ("<home>" . mwim-beginning-of-line-or-code)
1568 ("<end>" . mwim-end-of-line-or-code)))
1569
1570 (use-package projectile
1571 :defer 0.5
1572 :bind-keymap ("C-c P" . projectile-command-map)
1573 :config
1574 (projectile-mode)
1575
1576 (defun b/projectile-mode-line-fun ()
1577 "Report project name and type in the modeline."
1578 (let ((project-name (projectile-project-name))
1579 (project-type (projectile-project-type)))
1580 (format "%s%s"
1581 projectile-mode-line-prefix
1582 (if project-type
1583 (format ":%s" project-type)
1584 ""))))
1585 (setq projectile-mode-line-function 'b/projectile-mode-line-fun)
1586
1587 (defun my-projectile-invalidate-cache (&rest _args)
1588 ;; ignore the args to `magit-checkout'
1589 (projectile-invalidate-cache nil))
1590
1591 (eval-after-load 'magit-branch
1592 '(progn
1593 (advice-add 'magit-checkout
1594 :after #'my-projectile-invalidate-cache)
1595 (advice-add 'magit-branch-and-checkout
1596 :after #'my-projectile-invalidate-cache)))
1597 :custom
1598 (projectile-completion-system 'ivy)
1599 (projectile-mode-line-prefix " proj"))
1600
1601 (use-package helpful
1602 :defer 0.6
1603 :bind
1604 (("C-S-h c" . helpful-command)
1605 ("C-S-h f" . helpful-callable) ; helpful-function
1606 ("C-S-h v" . helpful-variable)
1607 ("C-S-h k" . helpful-key)
1608 ("C-S-h p" . helpful-at-point)))
1609
1610 (use-package unkillable-scratch
1611 :defer 0.6
1612 :config
1613 (unkillable-scratch 1)
1614 :custom
1615 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
1616
1617 ;; ,----
1618 ;; | make pretty boxed quotes like this
1619 ;; `----
1620 (use-package boxquote
1621 :defer 0.6
1622 :bind
1623 (:prefix-map b/boxquote-prefix-map
1624 :prefix "C-c q"
1625 ("b" . boxquote-buffer)
1626 ("B" . boxquote-insert-buffer)
1627 ("d" . boxquote-defun)
1628 ("F" . boxquote-insert-file)
1629 ("hf" . boxquote-describe-function)
1630 ("hk" . boxquote-describe-key)
1631 ("hv" . boxquote-describe-variable)
1632 ("hw" . boxquote-where-is)
1633 ("k" . boxquote-kill)
1634 ("p" . boxquote-paragraph)
1635 ("q" . boxquote-boxquote)
1636 ("r" . boxquote-region)
1637 ("s" . boxquote-shell-command)
1638 ("t" . boxquote-text)
1639 ("T" . boxquote-title)
1640 ("u" . boxquote-unbox)
1641 ("U" . boxquote-unbox-region)
1642 ("y" . boxquote-yank)
1643 ("M-q" . boxquote-fill-paragraph)
1644 ("M-w" . boxquote-kill-ring-save)))
1645
1646 (use-package orgalist
1647 ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
1648 :disabled t
1649 :after message
1650 :hook (message-mode . orgalist-mode))
1651
1652 ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹›
1653 (use-package typo
1654 :defer 0.5
1655 :delight " typo"
1656 :config
1657 (typo-global-mode 1)
1658 :hook (((text-mode erc-mode) . typo-mode)
1659 (tex-mode . (lambda ()(typo-mode -1)))))
1660
1661 ;; highlight TODOs in buffers
1662 (use-package hl-todo
1663 :defer 0.5
1664 :config
1665 (global-hl-todo-mode))
1666
1667 (use-package shrink-path
1668 :defer 0.5
1669 :after eshell
1670 :config
1671 (defvar user-@-host (concat (user-login-name) "@" (system-name) " "))
1672 (defun +eshell/prompt ()
1673 (let ((base/dir (shrink-path-prompt default-directory)))
1674 (concat (propertize user-@-host 'face 'default)
1675 (propertize (car base/dir)
1676 'face 'font-lock-comment-face)
1677 (propertize (cdr base/dir)
1678 'face 'font-lock-constant-face)
1679 (propertize "> " 'face 'default))))
1680 (setq eshell-prompt-regexp (concat user-@-host ".*> ")
1681 eshell-prompt-function #'+eshell/prompt))
1682
1683 (use-package eshell-up
1684 :after eshell
1685 :commands eshell-up)
1686
1687 (use-package multi-term
1688 :defer 0.6
1689 :bind (("C-c a s m m" . multi-term)
1690 ("C-c a s m d" . multi-term-dedicated-toggle)
1691 ("C-c a s m p" . multi-term-prev)
1692 ("C-c a s m n" . multi-term-next)
1693 :map term-mode-map
1694 ("C-c C-j" . term-char-mode))
1695 :config
1696 (setq multi-term-program "screen"
1697 multi-term-program-switches (concat "-c"
1698 (getenv "XDG_CONFIG_HOME")
1699 "/screen/screenrc")
1700 ;; TODO: add separate bindings for connecting to existing
1701 ;; session vs. always creating a new one
1702 multi-term-dedicated-select-after-open-p t
1703 multi-term-dedicated-window-height 20
1704 multi-term-dedicated-max-window-height 30
1705 term-bind-key-alist
1706 '(("C-c C-c" . term-interrupt-subjob)
1707 ("C-c C-e" . term-send-esc)
1708 ("C-c C-j" . term-line-mode)
1709 ("C-k" . kill-line)
1710 ;; ("C-y" . term-paste)
1711 ("C-y" . term-send-raw)
1712 ("M-f" . term-send-forward-word)
1713 ("M-b" . term-send-backward-word)
1714 ("M-p" . term-send-up)
1715 ("M-n" . term-send-down)
1716 ("M-j" . term-send-raw-meta)
1717 ("M-y" . term-send-raw-meta)
1718 ("M-/" . term-send-raw-meta)
1719 ("M-0" . term-send-raw-meta)
1720 ("M-1" . term-send-raw-meta)
1721 ("M-2" . term-send-raw-meta)
1722 ("M-3" . term-send-raw-meta)
1723 ("M-4" . term-send-raw-meta)
1724 ("M-5" . term-send-raw-meta)
1725 ("M-6" . term-send-raw-meta)
1726 ("M-7" . term-send-raw-meta)
1727 ("M-8" . term-send-raw-meta)
1728 ("M-9" . term-send-raw-meta)
1729 ("<C-backspace>" . term-send-backward-kill-word)
1730 ("<M-DEL>" . term-send-backward-kill-word)
1731 ("M-d" . term-send-delete-word)
1732 ("M-," . term-send-raw)
1733 ("M-." . comint-dynamic-complete))
1734 term-unbind-key-alist
1735 '("C-z" "C-x" "C-c" "C-h"
1736 ;; "C-y"
1737 "<ESC>")))
1738
1739 (use-package page-break-lines
1740 :defer 0.5
1741 :delight " pgln"
1742 :custom
1743 (page-break-lines-max-width fill-column)
1744 :config
1745 (global-page-break-lines-mode))
1746
1747 (use-package expand-region
1748 :bind ("C-=" . er/expand-region))
1749
1750 (use-package multiple-cursors
1751 :bind
1752 (("C-S-<mouse-1>" . mc/add-cursor-on-click)
1753 (:prefix-map b/mc-prefix-map
1754 :prefix "C-c m"
1755 ("c" . mc/edit-lines)
1756 ("n" . mc/mark-next-like-this)
1757 ("p" . mc/mark-previous-like-this)
1758 ("a" . mc/mark-all-like-this))))
1759
1760 (comment
1761 ;; TODO
1762 (use-package forge
1763 :after magit
1764 :demand))
1765
1766 (use-package yasnippet
1767 :defer 0.6
1768 :config
1769 (defconst yas-verbosity-cur yas-verbosity)
1770 (setq yas-verbosity 2)
1771 (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
1772 (yas-reload-all)
1773 (setq yas-verbosity yas-verbosity-cur)
1774
1775 (defun b/yas--maybe-expand-key-filter (cmd)
1776 (when (and (yas--maybe-expand-key-filter cmd)
1777 (not (bound-and-true-p git-commit-mode)))
1778 cmd))
1779 (defconst b/yas-maybe-expand
1780 '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter))
1781 (define-key yas-minor-mode-map
1782 (kbd "SPC") b/yas-maybe-expand)
1783
1784 (yas-global-mode))
1785
1786 (use-package debbugs
1787 :straight (debbugs
1788 :host github
1789 :repo "emacs-straight/debbugs"
1790 :files (:defaults "Debbugs.wsdl")))
1791
1792 (use-package org-ref
1793 :init
1794 (b/setq-every '("~/usr/org/references.bib")
1795 reftex-default-bibliography
1796 org-ref-default-bibliography)
1797 (setq
1798 org-ref-bibliography-notes "~/usr/org/notes.org"
1799 org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
1800
1801 (use-package alert
1802 :commands (alert)
1803 :init (setq alert-default-style 'notifications))
1804
1805 ;; (use-package fill-column-indicator)
1806
1807 (use-package emojify
1808 :hook (erc-mode . emojify-mode))
1809
1810 (use-feature window
1811 :bind
1812 (("C-c w <right>" . split-window-right)
1813 ("C-c w <down>" . split-window-below)
1814 ("C-c w s l" . split-window-right)
1815 ("C-c w s j" . split-window-below)
1816 ("C-c w q" . quit-window))
1817 :custom
1818 (split-width-threshold 150))
1819
1820 (use-feature windmove
1821 :defer 0.6
1822 :bind
1823 (("C-c w h" . windmove-left)
1824 ("C-c w j" . windmove-down)
1825 ("C-c w k" . windmove-up)
1826 ("C-c w l" . windmove-right)
1827 ("C-c w H" . windmove-swap-states-left)
1828 ("C-c w J" . windmove-swap-states-down)
1829 ("C-c w K" . windmove-swap-states-up)
1830 ("C-c w L" . windmove-swap-states-right)))
1831
1832 (use-package pass
1833 :commands pass
1834 :bind ("C-c a p" . pass)
1835 :hook (pass-mode . View-exit))
1836
1837 (use-package pdf-tools
1838 :defer 0.5
1839 :bind (:map pdf-view-mode-map
1840 ("<C-XF86Back>" . pdf-history-backward)
1841 ("<mouse-8>" . pdf-history-backward)
1842 ("<drag-mouse-8>" . pdf-history-backward)
1843 ("<C-XF86Forward>" . pdf-history-forward)
1844 ("<mouse-9>" . pdf-history-forward)
1845 ("<drag-mouse-9>" . pdf-history-forward)
1846 ("M-RET" . image-previous-line))
1847 :config (pdf-tools-install nil t)
1848 :custom (pdf-view-resize-factor 1.05))
1849
1850 (use-package biblio)
1851
1852 (use-feature reftex
1853 :hook (latex-mode . reftex-mode))
1854
1855 (use-feature reftex-cite
1856 :after reftex
1857 :disabled ; enable to disable
1858 ; reftex-cite's default choice
1859 ; of previous word
1860 :config
1861 (defun reftex-get-bibkey-default ()
1862 "If the cursor is in a citation macro, return the word before the macro."
1863 (let* ((macro (reftex-what-macro 1)))
1864 (save-excursion
1865 (when (and macro (string-match "cite" (car macro)))
1866 (goto-char (cdr macro)))
1867 (reftex-this-word)))))
1868
1869 \f
1870 ;;; Email (with Gnus)
1871
1872 (defvar b/maildir (expand-file-name "~/mail/"))
1873 (with-eval-after-load 'recentf
1874 (add-to-list 'recentf-exclude b/maildir))
1875
1876 (setq
1877 b/gnus-init-file (b/etc "gnus")
1878 mail-user-agent 'gnus-user-agent
1879 read-mail-command 'gnus)
1880
1881 (use-feature gnus
1882 :bind (("s-m" . gnus)
1883 ("s-M" . gnus-unplugged)
1884 ("C-c a m" . gnus)
1885 ("C-c a M" . gnus-unplugged))
1886 :init
1887 (setq
1888 gnus-select-method '(nnnil "")
1889 gnus-secondary-select-methods
1890 '((nnimap "shemshak"
1891 (nnimap-stream plain)
1892 (nnimap-address "127.0.0.1")
1893 (nnimap-server-port 143)
1894 (nnimap-authenticator plain)
1895 (nnimap-user "amin@shemshak.local"))
1896 (nnimap "gnu"
1897 (nnimap-stream plain)
1898 (nnimap-address "127.0.0.1")
1899 (nnimap-server-port 143)
1900 (nnimap-authenticator plain)
1901 (nnimap-user "bandali@gnu.local")
1902 (nnimap-inbox "INBOX")
1903 (nnimap-split-methods 'nnimap-split-fancy)
1904 (nnimap-split-fancy (|
1905 ;; (: gnus-registry-split-fancy-with-parent)
1906 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1907 ;; gnu
1908 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
1909 ;; *@lists.sr.ht, omitting one dot if present
1910 ;; add more \\.?\\([^.@]*\\) if needed
1911 (list ".*<~\\(.*\\)/\\([^.@]*\\)\\.?\\([^.@]*\\)@lists.sr.ht>.*" "l.~\\1.\\2\\3")
1912 ;; webmasters
1913 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1914 ;; other
1915 (list ".*atreus.freelists.org" "l.atreus")
1916 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1917 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
1918 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
1919 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
1920 ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
1921 ;; ----------------------------------
1922 ;; legend: (u)nsubscribed | (d)ead
1923 ;; ----------------------------------
1924 ;; otherwise, leave mail in INBOX
1925 "INBOX")))
1926 (nnimap "uw"
1927 (nnimap-stream plain)
1928 (nnimap-address "127.0.0.1")
1929 (nnimap-server-port 143)
1930 (nnimap-authenticator plain)
1931 (nnimap-user "abandali@uw.local")
1932 (nnimap-inbox "INBOX")
1933 (nnimap-split-methods 'nnimap-split-fancy)
1934 (nnimap-split-fancy (|
1935 ;; (: gnus-registry-split-fancy-with-parent)
1936 ;; se212-f19
1937 ("subject" "SE\\s-?212" "course.se212-f19")
1938 (from "SE\\s-?212" "course.se212-f19")
1939 ;; catch-all
1940 "INBOX")))
1941 (nnimap "csc"
1942 (nnimap-stream plain)
1943 (nnimap-address "127.0.0.1")
1944 (nnimap-server-port 143)
1945 (nnimap-authenticator plain)
1946 (nnimap-user "abandali@csc.uw.local")))
1947 gnus-message-archive-group "nnimap+shemshak:Sent"
1948 gnus-parameters
1949 '(("l\\.atreus"
1950 (to-address . "atreus@freelists.org")
1951 (to-list . "atreus@freelists.org"))
1952 ("l\\.deepspec"
1953 (to-address . "deepspec@lists.cs.princeton.edu")
1954 (to-list . "deepspec@lists.cs.princeton.edu")
1955 (list-identifier . "\\[deepspec\\]"))
1956 ("l\\.emacs-devel"
1957 (to-address . "emacs-devel@gnu.org")
1958 (to-list . "emacs-devel@gnu.org"))
1959 ("l\\.help-gnu-emacs"
1960 (to-address . "help-gnu-emacs@gnu.org")
1961 (to-list . "help-gnu-emacs@gnu.org"))
1962 ("l\\.info-gnu-emacs"
1963 (to-address . "info-gnu-emacs@gnu.org")
1964 (to-list . "info-gnu-emacs@gnu.org"))
1965 ("l\\.emacs-orgmode"
1966 (to-address . "emacs-orgmode@gnu.org")
1967 (to-list . "emacs-orgmode@gnu.org")
1968 (list-identifier . "\\[O\\]"))
1969 ("l\\.emacs-tangents"
1970 (to-address . "emacs-tangents@gnu.org")
1971 (to-list . "emacs-tangents@gnu.org"))
1972 ("l\\.emacsconf-discuss"
1973 (to-address . "emacsconf-discuss@gnu.org")
1974 (to-list . "emacsconf-discuss@gnu.org"))
1975 ("l\\.emacsconf-register"
1976 (to-address . "emacsconf-register@gnu.org")
1977 (to-list . "emacsconf-register@gnu.org"))
1978 ("l\\.emacsconf-submit"
1979 (to-address . "emacsconf-submit@gnu.org")
1980 (to-list . "emacsconf-submit@gnu.org"))
1981 ("l\\.fencepost-users"
1982 (to-address . "fencepost-users@gnu.org")
1983 (to-list . "fencepost-users@gnu.org")
1984 (list-identifier . "\\[Fencepost-users\\]"))
1985 ("l\\.gnewsense-art"
1986 (to-address . "gnewsense-art@nongnu.org")
1987 (to-list . "gnewsense-art@nongnu.org")
1988 (list-identifier . "\\[gNewSense-art\\]"))
1989 ("l\\.gnewsense-dev"
1990 (to-address . "gnewsense-dev@nongnu.org")
1991 (to-list . "gnewsense-dev@nongnu.org")
1992 (list-identifier . "\\[Gnewsense-dev\\]"))
1993 ("l\\.gnewsense-users"
1994 (to-address . "gnewsense-users@nongnu.org")
1995 (to-list . "gnewsense-users@nongnu.org")
1996 (list-identifier . "\\[gNewSense-users\\]"))
1997 ("l\\.gnunet-developers"
1998 (to-address . "gnunet-developers@gnu.org")
1999 (to-list . "gnunet-developers@gnu.org")
2000 (list-identifier . "\\[GNUnet-developers\\]"))
2001 ("l\\.help-gnunet"
2002 (to-address . "help-gnunet@gnu.org")
2003 (to-list . "help-gnunet@gnu.org")
2004 (list-identifier . "\\[Help-gnunet\\]"))
2005 ("l\\.bug-gnuzilla"
2006 (to-address . "bug-gnuzilla@gnu.org")
2007 (to-list . "bug-gnuzilla@gnu.org")
2008 (list-identifier . "\\[Bug-gnuzilla\\]"))
2009 ("l\\.gnuzilla-dev"
2010 (to-address . "gnuzilla-dev@gnu.org")
2011 (to-list . "gnuzilla-dev@gnu.org")
2012 (list-identifier . "\\[Gnuzilla-dev\\]"))
2013 ("l\\.guile-devel"
2014 (to-address . "guile-devel@gnu.org")
2015 (to-list . "guile-devel@gnu.org"))
2016 ("l\\.guile-user"
2017 (to-address . "guile-user@gnu.org")
2018 (to-list . "guile-user@gnu.org"))
2019 ("l\\.guix-devel"
2020 (to-address . "guix-devel@gnu.org")
2021 (to-list . "guix-devel@gnu.org"))
2022 ("l\\.help-guix"
2023 (to-address . "help-guix@gnu.org")
2024 (to-list . "help-guix@gnu.org"))
2025 ("l\\.info-guix"
2026 (to-address . "info-guix@gnu.org")
2027 (to-list . "info-guix@gnu.org"))
2028 ("l\\.savannah-hackers-public"
2029 (to-address . "savannah-hackers-public@gnu.org")
2030 (to-list . "savannah-hackers-public@gnu.org"))
2031 ("l\\.savannah-users"
2032 (to-address . "savannah-users@gnu.org")
2033 (to-list . "savannah-users@gnu.org"))
2034 ("l\\.www-commits"
2035 (to-address . "www-commits@gnu.org")
2036 (to-list . "www-commits@gnu.org"))
2037 ("l\\.www-discuss"
2038 (to-address . "www-discuss@gnu.org")
2039 (to-list . "www-discuss@gnu.org"))
2040 ("l\\.haskell-art"
2041 (to-address . "haskell-art@we.lurk.org")
2042 (to-list . "haskell-art@we.lurk.org")
2043 (list-identifier . "\\[haskell-art\\]"))
2044 ("l\\.haskell-cafe"
2045 (to-address . "haskell-cafe@haskell.org")
2046 (to-list . "haskell-cafe@haskell.org")
2047 (list-identifier . "\\[Haskell-cafe\\]"))
2048 ("l\\.notmuch"
2049 (to-address . "notmuch@notmuchmail.org")
2050 (to-list . "notmuch@notmuchmail.org"))
2051 ("l\\.parabola-dev"
2052 (to-address . "dev@lists.parabola.nu")
2053 (to-list . "dev@lists.parabola.nu")
2054 (list-identifier . "\\[Dev\\]"))
2055 ("l\\.~bandali\\.public-inbox"
2056 (to-address . "~bandali/public-inbox@lists.sr.ht")
2057 (to-list . "~bandali/public-inbox@lists.sr.ht"))
2058 ("l\\.~sircmpwn\\.free-writers-club"
2059 (to-address . "~sircmpwn/free-writers-club@lists.sr.ht")
2060 (to-list . "~sircmpwn/free-writers-club@lists.sr.ht"))
2061 ("l\\.~sircmpwn\\.srht-admins"
2062 (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht")
2063 (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht"))
2064 ("l\\.~sircmpwn\\.srht-announce"
2065 (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht")
2066 (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht"))
2067 ("l\\.~sircmpwn\\.srht-dev"
2068 (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht")
2069 (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht"))
2070 ("l\\.~sircmpwn\\.srht-discuss"
2071 (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht")
2072 (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht"))
2073 ("webmasters"
2074 (to-address . "webmasters@gnu.org")
2075 (to-list . "webmasters@gnu.org"))
2076 ("gnu.*"
2077 (gcc-self . t))
2078 ("gnu\\."
2079 (subscribed . t))
2080 ("nnimap\\+uw:.*"
2081 (gcc-self . t)))
2082 gnus-large-newsgroup 50
2083 gnus-home-directory (b/var "gnus/")
2084 gnus-directory (concat gnus-home-directory "news/")
2085 message-directory (concat gnus-home-directory "mail/")
2086 nndraft-directory (concat gnus-home-directory "drafts/")
2087 gnus-save-newsrc-file nil
2088 gnus-read-newsrc-file nil
2089 gnus-interactive-exit nil
2090 gnus-gcc-mark-as-read t)
2091 :config
2092 (require 'ebdb)
2093 (require 'ebdb-mua)
2094 (require 'ebdb-gnus)
2095
2096 (when (version< emacs-version "27")
2097 (add-to-list
2098 'nnmail-split-abbrev-alist
2099 '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
2100 t))
2101
2102 ;; (gnus-registry-initialize)
2103
2104 (with-eval-after-load 'recentf
2105 (add-to-list 'recentf-exclude gnus-home-directory)))
2106
2107 (use-feature gnus-art
2108 :config
2109 (setq
2110 gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)")
2111 gnus-visible-headers
2112 (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
2113 gnus-sorted-header-list
2114 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
2115 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
2116 "^Newsgroups:" "List-Id:" "^Organization:"
2117 "^User-Agent:" "^Date:")
2118 ;; local-lapsed article dates
2119 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
2120 gnus-article-date-headers '(user-defined)
2121 gnus-article-time-format
2122 (lambda (time)
2123 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
2124 (local (article-make-date-line date 'local))
2125 (combined-lapsed (article-make-date-line date
2126 'combined-lapsed))
2127 (lapsed (progn
2128 (string-match " (.+" combined-lapsed)
2129 (match-string 0 combined-lapsed))))
2130 (concat local lapsed))))
2131 (bind-keys
2132 :map gnus-article-mode-map
2133 ("M-L" . org-store-link)))
2134
2135 (use-feature gnus-sum
2136 :bind (:map gnus-summary-mode-map
2137 :prefix-map b/gnus-summary-prefix-map
2138 :prefix "v"
2139 ("r" . gnus-summary-reply)
2140 ("w" . gnus-summary-wide-reply)
2141 ("v" . gnus-summary-show-raw-article))
2142 :config
2143 (bind-keys
2144 :map gnus-summary-mode-map
2145 ("M-L" . org-store-link))
2146 :hook (gnus-summary-mode . b/no-mouse-autoselect-window)
2147 :custom
2148 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
2149 gnus-thread-sort-by-subject
2150 gnus-thread-sort-by-date)))
2151
2152 (use-feature gnus-msg
2153 :config
2154 (defvar b/signature "Amin Bandali
2155 Free Software Activist | GNU Webmaster & Volunteer
2156 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
2157 https://shemshak.org/~amin")
2158 (defvar b/gnu-signature "Amin Bandali
2159 Free Software Activist | GNU Webmaster & Volunteer
2160 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
2161 https://bandali.eu.org")
2162 (defvar b/uw-signature "Amin Bandali, MMath Student
2163 Cheriton School of Computer Science
2164 University of Waterloo
2165 https://bandali.eu.org")
2166 (defvar b/csc-signature "Amin Bandali
2167 Systems Committee
2168 Computer Science Club, University of Waterloo
2169 https://csclub.uwaterloo.ca/~abandali")
2170 (setq gnus-posting-styles
2171 '((".*"
2172 (address "amin@shemshak.org")
2173 (body "\nBest,\n")
2174 (signature b/signature)
2175 (eval (setq b/message-cite-say-hi t)))
2176 ("nnimap\\+gnu:.*"
2177 (address "bandali@gnu.org")
2178 (signature b/gnu-signature)
2179 (eval (set (make-local-variable 'message-user-fqdn) "fencepost.gnu.org")))
2180 ((header "subject" "ThankCRM")
2181 (to "webmasters-comment@gnu.org")
2182 (body "")
2183 (eval (setq b/message-cite-say-hi nil)))
2184 ("nnimap\\+uw:.*"
2185 (address "abandali@uwaterloo.ca")
2186 (signature b/uw-signature))
2187 ("nnimap\\+uw:INBOX"
2188 (gcc "\"nnimap+uw:Sent Items\""))
2189 ("nnimap\\+csc:.*"
2190 (address "abandali@csclub.uwaterloo.ca")
2191 (signature b/csc-signature)
2192 (gcc "nnimap+csc:Sent")))))
2193
2194 (use-feature gnus-topic
2195 :hook (gnus-group-mode . gnus-topic-mode)
2196 :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n"))
2197
2198 (use-feature gnus-agent
2199 :config
2200 (setq gnus-agent-synchronize-flags 'ask)
2201 :hook (gnus-group-mode . gnus-agent-mode))
2202
2203 (use-feature gnus-group
2204 :config
2205 (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)"))
2206
2207 (comment
2208 ;; problematic with ebdb's popup, *EBDB-Gnus*
2209 (use-feature gnus-win
2210 :config
2211 (setq gnus-use-full-window nil)))
2212
2213 (use-feature gnus-dired
2214 :commands gnus-dired-mode
2215 :init
2216 (add-hook 'dired-mode-hook 'gnus-dired-mode))
2217
2218 (use-feature mm-decode
2219 :config
2220 (setq mm-discouraged-alternatives '("text/html" "text/richtext")
2221 mm-decrypt-option 'known
2222 mm-verify-option 'known))
2223
2224 (use-feature mm-uu
2225 :custom
2226 (mm-uu-diff-groups-regexp
2227 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
2228
2229 (use-feature sendmail
2230 :config
2231 (setq sendmail-program (executable-find "msmtp")
2232 ;; message-sendmail-extra-arguments '("-v" "-d")
2233 mail-specify-envelope-from t
2234 mail-envelope-from 'header))
2235
2236 (use-feature message
2237 :config
2238 ;; redefine for a simplified In-Reply-To header
2239 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
2240 (defun message-make-in-reply-to ()
2241 "Return the In-Reply-To header for this message."
2242 (when message-reply-headers
2243 (let ((from (mail-header-from message-reply-headers))
2244 (msg-id (mail-header-id message-reply-headers)))
2245 (when from
2246 msg-id))))
2247
2248 (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:")
2249 (defconst message-cite-style-bandali
2250 '((message-cite-function 'message-cite-original)
2251 (message-citation-line-function 'message-insert-formatted-citation-line)
2252 (message-cite-reply-position 'traditional)
2253 (message-yank-prefix "> ")
2254 (message-yank-cited-prefix ">")
2255 (message-yank-empty-prefix ">")
2256 (message-citation-line-format
2257 (if b/message-cite-say-hi
2258 (concat "Hi %F,\n\n" b/message-cite-style-format)
2259 b/message-cite-style-format)))
2260 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
2261 (setq ;; message-cite-style 'message-cite-style-bandali
2262 message-kill-buffer-on-exit t
2263 message-send-mail-function 'message-send-mail-with-sendmail
2264 message-sendmail-envelope-from 'header
2265 message-subscribed-address-functions
2266 '(gnus-find-subscribed-addresses)
2267 message-dont-reply-to-names
2268 "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(amin@bndl\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
2269 (require 'company-ebdb)
2270 :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
2271 (message-mode . flyspell-mode)
2272 (message-mode . (lambda ()
2273 ;; (setq fill-column 65
2274 ;; message-fill-column 65)
2275 (make-local-variable 'company-idle-delay)
2276 (setq company-idle-delay 0.2))))
2277 ;; :custom-face
2278 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
2279 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
2280 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
2281 )
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