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