e1cb047e7a5eb1f67b713dbd7b5ff6559857c842
[~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 p" . pp-macroexpand-last-sexp)
493 ("C-c e r" . eval-region)
494
495 ("C-c e i" . emacs-init-time)
496 ("C-c e u" . emacs-uptime)
497 ("C-c e v" . emacs-version)
498
499 ("C-c f ." . find-file)
500 ("C-c f d" . find-name-dired)
501 ("C-c f l" . find-library)
502
503 ("C-c F m" . make-frame-command)
504 ("C-c F d" . delete-frame)
505 ("C-c F D" . server-edit)
506
507 ("C-S-h C" . describe-char)
508 ("C-S-h F" . describe-face)
509
510 ("C-c x" . execute-extended-command)
511
512 ("C-x k" . b/kill-current-buffer)
513 ("C-x K" . kill-buffer)
514 ("C-x s" . save-buffer)
515 ("C-x S" . save-some-buffers)
516
517 :map emacs-lisp-mode-map
518 ("<C-return>" . b/add-elisp-section))
519
520 (when (display-graphic-p)
521 (unbind-key "C-z" global-map))
522
523 (bind-keys
524 ;; for back and forward mouse keys
525 ("<XF86Back>" . previous-buffer)
526 ("<mouse-8>" . previous-buffer)
527 ;; ("<drag-mouse-8>" . previous-buffer)
528 ("<XF86Forward>" . next-buffer)
529 ("<mouse-9>" . next-buffer)
530 ;; ("<drag-mouse-9>" . next-buffer)
531 ;; ("<drag-mouse-2>" . kill-this-buffer)
532 ;; ("<drag-mouse-3>" . switch-to-buffer)
533 )
534
535 \f
536 ;;; Essential packages
537
538 (add-to-list
539 'load-path
540 (expand-file-name
541 (convert-standard-filename "lisp") user-emacs-directory))
542
543 (when b/exwm-p
544 (require 'bandali-exwm))
545
546 (require 'bandali-org)
547
548 ;; *the* right way to do git
549 (use-package magit
550 :bind (("C-x g" . magit-status)
551 ("C-c g g" . magit-status)
552 ("C-c g b" . magit-blame-addition)
553 ("C-c g l" . magit-log-buffer-file))
554 :config
555 (magit-add-section-hook 'magit-status-sections-hook
556 'magit-insert-modules
557 'magit-insert-stashes
558 'append)
559 ;; (magit-add-section-hook 'magit-status-sections-hook
560 ;; 'magit-insert-ignored-files
561 ;; 'magit-insert-untracked-files
562 ;; 'append)
563 (setq magit-repository-directories '(("~/.emacs.d/" . 0)
564 ("~/src/git/" . 2)))
565 (nconc magit-section-initial-visibility-alist
566 '(([unpulled status] . show)
567 ([unpushed status] . show)))
568 :custom
569 (magit-diff-refine-hunk t)
570 (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
571 ;; (magit-completing-read-function 'magit-ido-completing-read)
572 :custom-face (magit-diff-file-heading ((t (:weight normal)))))
573
574 ;; recently opened files
575 (use-package recentf
576 :defer 0.2
577 ;; :config
578 ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
579 :config
580 (recentf-mode)
581 :custom
582 (recentf-max-saved-items 2000))
583
584 ;; needed for history for counsel
585 (use-package amx
586 :defer 0.3
587 :config
588 (amx-mode))
589
590 ;; (require 'bandali-ido)
591 (require 'bandali-ivy)
592
593 (require 'bandali-eshell)
594
595 (require 'bandali-ibuffer)
596
597 (use-package outline
598 :disabled
599 :hook (prog-mode . outline-minor-mode)
600 :bind
601 (:map
602 outline-minor-mode-map
603 ("<s-tab>" . outline-toggle-children)
604 ("M-p" . outline-previous-visible-heading)
605 ("M-n" . outline-next-visible-heading)
606 :prefix-map b/outline-prefix-map
607 :prefix "s-O"
608 ("TAB" . outline-toggle-children)
609 ("a" . outline-hide-body)
610 ("H" . outline-hide-body)
611 ("S" . outline-show-all)
612 ("h" . outline-hide-subtree)
613 ("s" . outline-show-subtree)))
614
615 (comment
616 (use-package ls-lisp
617 :custom (ls-lisp-dirs-first t))
618
619 (require 'bandali-dired)
620
621 (use-package help
622 :config
623 (temp-buffer-resize-mode)
624 (setq help-window-select t))
625
626 (use-package tramp
627 :config
628 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
629 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
630 (add-to-list 'tramp-default-proxies-alist
631 (list (regexp-quote (system-name)) nil nil)))
632
633 (use-package doc-view
634 :bind (:map doc-view-mode-map
635 ("M-RET" . image-previous-line)))
636
637 \f
638 ;;; Editing
639
640 ;; highlight uncommitted changes in the left fringe
641 (use-package diff-hl
642 :defer 0.6
643 :config
644 (setq diff-hl-draw-borders nil)
645 (global-diff-hl-mode)
646 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
647
648 ;; display Lisp objects at point in the echo area
649 (use-package eldoc
650 :when (version< "25" emacs-version)
651 :config (global-eldoc-mode))
652
653 ;; highlight matching parens
654 (use-package paren
655 :demand
656 :config (show-paren-mode))
657
658 (use-package elec-pair
659 :demand
660 :config (electric-pair-mode))
661
662 (use-package simple
663 :config (column-number-mode)
664 :custom
665 ;; Save what I copy into clipboard from other applications into Emacs'
666 ;; kill-ring, which would allow me to still be able to easily access
667 ;; it in case I kill (cut or copy) something else inside Emacs before
668 ;; yanking (pasting) what I'd originally intended to.
669 (save-interprogram-paste-before-kill t))
670
671 ;; save minibuffer history
672 (use-package savehist
673 :demand
674 :config
675 (savehist-mode)
676 (add-to-list 'savehist-additional-variables 'kill-ring))
677
678 ;; automatically save place in files
679 (use-package saveplace
680 :when (version< "25" emacs-version)
681 :config (save-place-mode))
682
683 (use-package prog-mode
684 :config (global-prettify-symbols-mode)
685 (defun indicate-buffer-boundaries-left ()
686 (setq indicate-buffer-boundaries 'left))
687 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
688
689 (use-package text-mode
690 :bind (:map text-mode-map ("C-*" . b/insert-asterism))
691 :hook ((text-mode . indicate-buffer-boundaries-left)
692 (text-mode . flyspell-mode)))
693
694 (use-package conf-mode
695 :mode "\\.*rc$")
696
697 (use-package sh-mode
698 :mode "\\.bashrc$")
699
700 (use-package company
701 :disabled
702 :bind
703 (:map company-active-map
704 ([tab] . company-complete-common-or-cycle)
705 ([escape] . company-abort)
706 ("C-p" . company-select-previous-or-abort)
707 ("C-n" . company-select-next-or-abort))
708 :custom
709 (company-minimum-prefix-length 1)
710 (company-selection-wrap-around t)
711 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
712 (company-dabbrev-downcase nil)
713 (company-dabbrev-ignore-case nil)
714 ;; :config
715 ;; (global-company-mode t)
716 )
717
718 (use-package flycheck
719 :defer 0.6
720 :hook (prog-mode . flycheck-mode)
721 :bind
722 (:map flycheck-mode-map
723 ("M-P" . flycheck-previous-error)
724 ("M-N" . flycheck-next-error))
725 :config
726 ;; Use the load-path from running Emacs when checking elisp files
727 (setq flycheck-emacs-lisp-load-path 'inherit)
728
729 ;; Only flycheck when I actually save the buffer
730 (setq flycheck-check-syntax-automatically '(mode-enabled save))
731 :custom (flycheck-mode-line-prefix "flyc"))
732
733 (use-package flyspell)
734
735 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
736 (use-package ispell
737 :defer 0.6
738 :config
739 ;; ’ can be part of a word
740 (setq ispell-local-dictionary-alist
741 `((nil "[[:alpha:]]" "[^[:alpha:]]"
742 "['\x2019]" nil ("-B") nil utf-8))
743 ispell-program-name (executable-find "hunspell"))
744 ;; don't send ’ to the subprocess
745 (defun endless/replace-apostrophe (args)
746 (cons (replace-regexp-in-string
747 "’" "'" (car args))
748 (cdr args)))
749 (advice-add #'ispell-send-string :filter-args
750 #'endless/replace-apostrophe)
751
752 ;; convert ' back to ’ from the subprocess
753 (defun endless/replace-quote (args)
754 (if (not (derived-mode-p 'org-mode))
755 args
756 (cons (replace-regexp-in-string
757 "'" "’" (car args))
758 (cdr args))))
759 (advice-add #'ispell-parse-output :filter-args
760 #'endless/replace-quote))
761
762 (use-package abbrev
763 :hook (text-mode . abbrev-mode))
764
765 \f
766 ;;; Programming modes
767
768 (use-package lisp-mode
769 :config
770 (defun indent-spaces-mode ()
771 (setq indent-tabs-mode nil))
772 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
773
774 (use-package reveal
775 :hook (emacs-lisp-mode . reveal-mode))
776
777 (use-package elisp-mode)
778
779 ;; (use-package alloy-mode
780 ;; :straight (:host github :repo "dwwmmn/alloy-mode")
781 ;; :mode "\\.\\(als\\|dsh\\)\\'"
782 ;; :config
783 ;; (setq alloy-basic-offset 2)
784 ;; ;; (defun b/alloy-simple-indent (start end)
785 ;; ;; (interactive "r")
786 ;; ;; ;; (if (region-active-p)
787 ;; ;; ;; (indent-rigidly start end alloy-basic-offset)
788 ;; ;; ;; (if (bolp)
789 ;; ;; ;; (indent-rigidly (line-beginning-position)
790 ;; ;; ;; (line-end-position)
791 ;; ;; ;; alloy-basic-offset)))
792 ;; ;; (indent-to (+ (current-column) alloy-basic-offset)))
793 ;; :bind (:map alloy-mode-map
794 ;; ("RET" . electric-newline-and-maybe-indent)
795 ;; ;; ("TAB" . b/alloy-simple-indent)
796 ;; ("TAB" . indent-for-tab-command))
797 ;; :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil))))
798
799 (eval-when-compile (defvar lean-mode-map))
800 (use-package lean-mode
801 :defer 0.4
802 :bind (:map lean-mode-map
803 ("S-SPC" . company-complete))
804 :config
805 (require 'lean-input)
806 (setq default-input-method "Lean"
807 lean-input-tweak-all '(lean-input-compose
808 (lean-input-prepend "/")
809 (lean-input-nonempty))
810 lean-input-user-translations '(("/" "/")))
811 (lean-input-setup))
812
813 (use-package mhtml-mode)
814
815 (use-package sgml-mode
816 :config
817 (setq sgml-basic-offset 0))
818
819 (use-package css-mode
820 :config
821 (setq css-indent-offset 2))
822
823 (use-package emmet-mode
824 :after (:any mhtml-mode css-mode sgml-mode)
825 :bind* (("C-)" . emmet-next-edit-point)
826 ("C-(" . emmet-prev-edit-point))
827 :config
828 (unbind-key "C-j" emmet-mode-keymap)
829 (setq emmet-move-cursor-between-quotes t)
830 :hook (css-mode html-mode sgml-mode))
831
832 (use-package geiser)
833
834 (use-package geiser-guile
835 :config
836 (setq geiser-guile-load-path "~/src/git/guix"))
837
838 (use-package guix)
839
840 (comment
841 (use-package auctex
842 :custom
843 (font-latex-fontify-sectioning 'color)))
844
845 (use-package go-mode
846 :disabled)
847
848 (use-package po-mode
849 :hook
850 (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit))))
851
852 (use-package tex-mode
853 :config
854 (cl-delete-if
855 (lambda (p) (string-match "^---?" (car p)))
856 tex--prettify-symbols-alist)
857 :hook ((tex-mode . auto-fill-mode)
858 (tex-mode . flyspell-mode)))
859
860 ;; (use-package george-mode
861 ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode")
862 ;; :mode "\\.grg\\'")
863
864 \f
865 ;;; Theme
866
867 (add-to-list 'custom-theme-load-path
868 (expand-file-name
869 (convert-standard-filename "lisp") user-emacs-directory))
870 (load-theme 'tangomod t)
871
872 (use-package smart-mode-line
873 :commands (sml/apply-theme)
874 :demand
875 :config
876 ;; thanks, but no thnaks; don't make fixed-width fills.
877 (defun sml/fill-for-buffer-identification () "")
878 (setq sml/theme 'tangomod)
879 (sml/setup)
880 (smart-mode-line-enable))
881
882 (use-package doom-modeline
883 :disabled
884 :demand
885 :hook (after-init . doom-modeline-init)
886 :custom
887 (doom-modeline-buffer-file-name-style 'relative-to-project))
888
889 (use-package doom-themes)
890
891 (use-package moody
892 :disabled
893 :demand
894 :config
895 (setq x-underline-at-descent-line t)
896 (let ((line (face-attribute 'mode-line :underline)))
897 (set-face-attribute 'mode-line nil :overline line)
898 (set-face-attribute 'mode-line-inactive nil :overline line)
899 (set-face-attribute 'mode-line-inactive nil :underline line)
900 (set-face-attribute 'mode-line nil :box nil)
901 (set-face-attribute 'mode-line-inactive nil :box nil)
902 (set-face-attribute 'mode-line-inactive nil :background "#e1e1e1")) ; d3d7cf
903 (moody-replace-mode-line-buffer-identification)
904 (moody-replace-vc-mode))
905
906 (use-package mini-modeline
907 :disabled
908 :demand
909 :config (mini-modeline-mode))
910
911 (defvar b/org-mode-font-lock-keywords
912 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
913 (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
914 (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
915 (4 '(:foreground "#c5c8c6") t))) ; title
916 "For use with the `doom-tomorrow-night' theme.")
917
918 (defun b/lights-on ()
919 "Enable my favourite light theme."
920 (interactive)
921 (mapc #'disable-theme custom-enabled-themes)
922 (load-theme 'tangomod t)
923 (when (featurep 'smart-mode-line)
924 (sml/apply-theme 'tangomod))
925 (font-lock-remove-keywords
926 'org-mode b/org-mode-font-lock-keywords)
927 (when (featurep 'erc-hl-nicks)
928 (erc-hl-nicks-reset-face-table))
929 (when (featurep 'exwm-systemtray)
930 (exwm-systemtray--refresh)))
931
932 (defun b/lights-off ()
933 "Go dark."
934 (interactive)
935 (mapc #'disable-theme custom-enabled-themes)
936 (load-theme 'doom-one t)
937 (when (featurep 'smart-mode-line)
938 (sml/apply-theme 'automatic))
939 (font-lock-add-keywords
940 'org-mode b/org-mode-font-lock-keywords t)
941 (when (featurep 'erc-hl-nicks)
942 (erc-hl-nicks-reset-face-table))
943 (when (featurep 'exwm-systemtray)
944 (exwm-systemtray--refresh)))
945
946 (bind-keys
947 ("C-c t d" . b/lights-off)
948 ("C-c t l" . b/lights-on))
949
950 \f
951 ;;; Emacs enhancements & auxiliary packages
952
953 (use-package man
954 :config (setq Man-width 80))
955
956 (use-package which-key
957 :defer 0.4
958 :config
959 (which-key-add-key-based-replacements
960 ;; prefixes for global prefixes and minor modes
961 "C-c @" "outline"
962 "C-c !" "flycheck"
963 "C-x RET" "coding system"
964 "C-x 8" "unicode"
965 "C-x @" "event modifiers"
966 "C-x a" "abbrev/expand"
967 "C-x r" "rectangle/register/bookmark"
968 "C-x t" "tabs"
969 "C-x v" "version control"
970 "C-x X" "edebug"
971 "C-x C-a" "edebug"
972 "C-x C-k" "kmacro"
973 ;; prefixes for my personal bindings
974 "C-c &" "yasnippet"
975 "C-c a" "applications"
976 "C-c a e" "erc"
977 "C-c a o" "org"
978 "C-c a s" "shells"
979 "C-c b" "buffers"
980 "C-c c" "compile-and-comments"
981 "C-c e" "eval"
982 "C-c f" "files"
983 "C-c F" "frames"
984 "C-c g" "magit"
985 "C-S-h" "help(ful)"
986 "C-c m" "multiple-cursors"
987 "C-c p" "projectile"
988 "C-c p s" "projectile/search"
989 "C-c p x" "projectile/execute"
990 "C-c p 4" "projectile/other-window"
991 "C-c q" "boxquote"
992 "C-c t" "themes"
993 ;; "s-O" "outline"
994 )
995
996 ;; prefixes for major modes
997 (which-key-add-major-mode-key-based-replacements 'message-mode
998 "C-c f n" "footnote")
999 (which-key-add-major-mode-key-based-replacements 'org-mode
1000 "C-c C-v" "org-babel")
1001
1002 (which-key-mode)
1003 :custom
1004 (which-key-add-column-padding 5)
1005 (which-key-max-description-length 32))
1006
1007 (use-package crux ; results in Waiting for git... [2 times]
1008 :defer 0.4
1009 :bind (("C-c d" . crux-duplicate-current-line-or-region)
1010 ("C-c M-d" . crux-duplicate-and-comment-current-line-or-region)
1011 ("C-c f C" . crux-copy-file-preserve-attributes)
1012 ("C-c f D" . crux-delete-file-and-buffer)
1013 ("C-c f R" . crux-rename-file-and-buffer)
1014 ("C-c j" . crux-top-join-line)
1015 ("C-S-j" . crux-top-join-line)))
1016
1017 (use-package mwim
1018 :bind (("C-a" . mwim-beginning-of-code-or-line)
1019 ("C-e" . mwim-end-of-code-or-line)
1020 ("<home>" . mwim-beginning-of-line-or-code)
1021 ("<end>" . mwim-end-of-line-or-code)))
1022
1023 (use-package projectile
1024 :disabled
1025 :defer 0.5
1026 :bind-keymap ("C-c p" . projectile-command-map)
1027 :config
1028 (projectile-mode)
1029
1030 (defun b/projectile-mode-line-fun ()
1031 "Report project name and type in the modeline."
1032 (let ((project-name (projectile-project-name))
1033 (project-type (projectile-project-type)))
1034 (format "%s%s"
1035 projectile-mode-line-prefix
1036 (if project-type
1037 (format ":%s" project-type)
1038 ""))))
1039 (setq projectile-mode-line-function 'b/projectile-mode-line-fun)
1040
1041 (defun my-projectile-invalidate-cache (&rest _args)
1042 ;; ignore the args to `magit-checkout'
1043 (projectile-invalidate-cache nil))
1044
1045 (eval-after-load 'magit-branch
1046 '(progn
1047 (advice-add 'magit-checkout
1048 :after #'my-projectile-invalidate-cache)
1049 (advice-add 'magit-branch-and-checkout
1050 :after #'my-projectile-invalidate-cache)))
1051 :custom
1052 (projectile-completion-system 'ivy)
1053 (projectile-mode-line-prefix " proj"))
1054
1055 (use-package helpful
1056 :defer 0.6
1057 :bind
1058 (("C-S-h c" . helpful-command)
1059 ("C-S-h f" . helpful-callable) ; helpful-function
1060 ("C-S-h v" . helpful-variable)
1061 ("C-S-h k" . helpful-key)
1062 ("C-S-h p" . helpful-at-point)))
1063
1064 (use-package unkillable-scratch
1065 :defer 0.6
1066 :config
1067 (unkillable-scratch 1)
1068 :custom
1069 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
1070
1071 ;; ,----
1072 ;; | make pretty boxed quotes like this
1073 ;; `----
1074 (use-package boxquote
1075 :defer 0.6
1076 :bind
1077 (:prefix-map b/boxquote-prefix-map
1078 :prefix "C-c q"
1079 ("b" . boxquote-buffer)
1080 ("B" . boxquote-insert-buffer)
1081 ("d" . boxquote-defun)
1082 ("F" . boxquote-insert-file)
1083 ("hf" . boxquote-describe-function)
1084 ("hk" . boxquote-describe-key)
1085 ("hv" . boxquote-describe-variable)
1086 ("hw" . boxquote-where-is)
1087 ("k" . boxquote-kill)
1088 ("p" . boxquote-paragraph)
1089 ("q" . boxquote-boxquote)
1090 ("r" . boxquote-region)
1091 ("s" . boxquote-shell-command)
1092 ("t" . boxquote-text)
1093 ("T" . boxquote-title)
1094 ("u" . boxquote-unbox)
1095 ("U" . boxquote-unbox-region)
1096 ("y" . boxquote-yank)
1097 ("M-q" . boxquote-fill-paragraph)
1098 ("M-w" . boxquote-kill-ring-save)))
1099
1100 (use-package orgalist
1101 ;; breaks auto-fill-mode, showing this error:
1102 ;; orgalist--boundaries: Lisp nesting exceeds ‘max-lisp-eval-depth’
1103 :disabled
1104 :after message
1105 :hook (message-mode . orgalist-mode))
1106
1107 ;; highlight TODOs in buffers
1108 (use-package hl-todo
1109 :defer 0.5
1110 :config
1111 (global-hl-todo-mode))
1112
1113 (use-package multi-term
1114 :disabled
1115 :defer 0.6
1116 :bind (("C-c a s m m" . multi-term)
1117 ("C-c a s m d" . multi-term-dedicated-toggle)
1118 ("C-c a s m p" . multi-term-prev)
1119 ("C-c a s m n" . multi-term-next)
1120 :map term-mode-map
1121 ("C-c C-j" . term-char-mode))
1122 :config
1123 (setq multi-term-program "screen"
1124 multi-term-program-switches (concat "-c"
1125 (getenv "XDG_CONFIG_HOME")
1126 "/screen/screenrc")
1127 ;; TODO: add separate bindings for connecting to existing
1128 ;; session vs. always creating a new one
1129 multi-term-dedicated-select-after-open-p t
1130 multi-term-dedicated-window-height 20
1131 multi-term-dedicated-max-window-height 30
1132 term-bind-key-alist
1133 '(("C-c C-c" . term-interrupt-subjob)
1134 ("C-c C-e" . term-send-esc)
1135 ("C-c C-j" . term-line-mode)
1136 ("C-k" . kill-line)
1137 ;; ("C-y" . term-paste)
1138 ("C-y" . term-send-raw)
1139 ("M-f" . term-send-forward-word)
1140 ("M-b" . term-send-backward-word)
1141 ("M-p" . term-send-up)
1142 ("M-n" . term-send-down)
1143 ("M-j" . term-send-raw-meta)
1144 ("M-y" . term-send-raw-meta)
1145 ("M-/" . term-send-raw-meta)
1146 ("M-0" . term-send-raw-meta)
1147 ("M-1" . term-send-raw-meta)
1148 ("M-2" . term-send-raw-meta)
1149 ("M-3" . term-send-raw-meta)
1150 ("M-4" . term-send-raw-meta)
1151 ("M-5" . term-send-raw-meta)
1152 ("M-6" . term-send-raw-meta)
1153 ("M-7" . term-send-raw-meta)
1154 ("M-8" . term-send-raw-meta)
1155 ("M-9" . term-send-raw-meta)
1156 ("<C-backspace>" . term-send-backward-kill-word)
1157 ("<M-DEL>" . term-send-backward-kill-word)
1158 ("M-d" . term-send-delete-word)
1159 ("M-," . term-send-raw)
1160 ("M-." . comint-dynamic-complete))
1161 term-unbind-key-alist
1162 '("C-z" "C-x" "C-c" "C-h"
1163 ;; "C-y"
1164 "<ESC>")))
1165
1166 (use-package page-break-lines
1167 :defer 0.5
1168 :custom
1169 (page-break-lines-max-width fill-column)
1170 :config
1171 (global-page-break-lines-mode))
1172
1173 (use-package expand-region
1174 :bind ("C-=" . er/expand-region))
1175
1176 (use-package multiple-cursors
1177 :bind
1178 (("C-S-<mouse-1>" . mc/add-cursor-on-click)
1179 (:prefix-map b/mc-prefix-map
1180 :prefix "C-c m"
1181 ("c" . mc/edit-lines)
1182 ("n" . mc/mark-next-like-this)
1183 ("p" . mc/mark-previous-like-this)
1184 ("a" . mc/mark-all-like-this))))
1185
1186 (use-package yasnippet
1187 :defer 0.6
1188 :config
1189 (defconst yas-verbosity-cur yas-verbosity)
1190 (setq yas-verbosity 2)
1191 (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
1192 (yas-reload-all)
1193 (setq yas-verbosity yas-verbosity-cur)
1194
1195 (defun b/yas--maybe-expand-key-filter (cmd)
1196 (when (and (yas--maybe-expand-key-filter cmd)
1197 (not (bound-and-true-p git-commit-mode)))
1198 cmd))
1199 (defconst b/yas-maybe-expand
1200 '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter))
1201 (define-key yas-minor-mode-map
1202 (kbd "SPC") b/yas-maybe-expand)
1203
1204 (yas-global-mode))
1205
1206 (use-package debbugs
1207 :bind
1208 (("C-c D d" . debbugs-gnu)
1209 ("C-c D b" . debbugs-gnu-bugs)
1210 ("C-c D e" .
1211 (lambda ()
1212 (interactive) ; bug-gnu-emacs
1213 (setq debbugs-gnu-current-suppress t)
1214 (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
1215 ("C-c D g" . ; bug-gnuzilla
1216 (lambda ()
1217 (interactive)
1218 (setq debbugs-gnu-current-suppress t)
1219 (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
1220 ("C-c D G b" . ; bug-guix
1221 (lambda ()
1222 (interactive)
1223 (setq debbugs-gnu-current-suppress t)
1224 (debbugs-gnu debbugs-gnu-default-severities '("guix"))))
1225 ("C-c D G p" . ; guix-patches
1226 (lambda ()
1227 (interactive)
1228 (setq debbugs-gnu-current-suppress t)
1229 (debbugs-gnu debbugs-gnu-default-severities '("guix-patches"))))))
1230
1231 (use-package org-ref
1232 :init
1233 (b/setq-every '("~/usr/org/references.bib")
1234 reftex-default-bibliography
1235 org-ref-default-bibliography)
1236 (setq
1237 org-ref-bibliography-notes "~/usr/org/notes.org"
1238 org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
1239
1240 ;; (use-package fill-column-indicator)
1241
1242 (use-package window
1243 :bind
1244 (("C-c w e" . (lambda ()
1245 (interactive)
1246 (split-window-right)
1247 (other-window 1)
1248 (erc-switch-to-buffer)))
1249 ("C-c w s l" . (lambda ()
1250 (interactive)
1251 (split-window-right)
1252 (other-window 1)))
1253 ("C-c w s j" . (lambda ()
1254 (interactive)
1255 (split-window-below)
1256 (other-window 1)))
1257 ("C-c w q" . quit-window))
1258 :custom
1259 (split-width-threshold 150))
1260
1261 (use-package windmove
1262 :defer 0.6
1263 :bind
1264 (("C-c w h" . windmove-left)
1265 ("C-c w j" . windmove-down)
1266 ("C-c w k" . windmove-up)
1267 ("C-c w l" . windmove-right)
1268 ("C-c w H" . windmove-swap-states-left)
1269 ("C-c w J" . windmove-swap-states-down)
1270 ("C-c w K" . windmove-swap-states-up)
1271 ("C-c w L" . windmove-swap-states-right)))
1272
1273 (use-package pass
1274 :commands pass
1275 :bind ("C-c a p" . pass)
1276 :hook (pass-mode . View-exit))
1277
1278 (use-package pdf-tools
1279 :defer 0.5
1280 :bind (:map pdf-view-mode-map
1281 ("<C-XF86Back>" . pdf-history-backward)
1282 ("<mouse-8>" . pdf-history-backward)
1283 ("<drag-mouse-8>" . pdf-history-backward)
1284 ("<C-XF86Forward>" . pdf-history-forward)
1285 ("<mouse-9>" . pdf-history-forward)
1286 ("<drag-mouse-9>" . pdf-history-forward)
1287 ("M-RET" . image-previous-line)
1288 ("C-s" . isearch-forward)
1289 ("s s" . isearch-forward))
1290 :config (pdf-tools-install nil t)
1291 :custom (pdf-view-resize-factor 1.05))
1292
1293 (use-package org-pdftools
1294 :disabled
1295 :straight (:host github :repo "fuxialexander/org-pdftools")
1296 :demand
1297 :after org
1298 :config
1299 (with-eval-after-load 'org
1300 (require 'org-pdftools)))
1301
1302 (use-package biblio)
1303
1304 (use-package reftex
1305 :hook (latex-mode . reftex-mode))
1306
1307 (use-package reftex-cite
1308 :after reftex
1309 :disabled ; enable to disable
1310 ; reftex-cite's default choice
1311 ; of previous word
1312 :config
1313 (defun reftex-get-bibkey-default ()
1314 "If the cursor is in a citation macro, return the word before the macro."
1315 (let* ((macro (reftex-what-macro 1)))
1316 (save-excursion
1317 (when (and macro (string-match "cite" (car macro)))
1318 (goto-char (cdr macro)))
1319 (reftex-this-word)))))
1320
1321 (use-package minions
1322 :demand
1323 :config (minions-mode))
1324
1325 (use-package dmenu
1326 :custom
1327 (dmenu-prompt-string "run: ")
1328 (dmenu-save-file (b/var "dmenu-items")))
1329
1330 (use-package eosd
1331 ;; TODO: fix build by properly building the eosd-pixbuf.c module
1332 ;; e.g. see https://github.com/raxod502/straight.el/issues/386
1333 :disabled
1334 :straight (:host github :repo "clarete/eosd")
1335 :demand
1336 :after exwm
1337 :config
1338 (eosd-start))
1339
1340 (use-package scpaste
1341 :disabled
1342 :config
1343 (setq scpaste-http-destination "https://p.bndl.org"
1344 scpaste-scp-destination "nix:/var/www/p.bndl.org"))
1345
1346 (use-package eww
1347 :bind ("C-c a e w" . eww)
1348 :custom
1349 (eww-download-directory (file-name-as-directory
1350 (getenv "XDG_DOWNLOAD_DIR"))))
1351
1352 \f
1353 ;;; Email (with Gnus)
1354
1355 (defvar b/maildir (expand-file-name "~/mail/"))
1356 (with-eval-after-load 'recentf
1357 (add-to-list 'recentf-exclude b/maildir))
1358
1359 (setq
1360 b/gnus-init-file (b/etc "gnus")
1361 mail-user-agent 'gnus-user-agent
1362 read-mail-command 'gnus)
1363
1364 (use-package gnus
1365 :bind (("s-m" . gnus-plugged)
1366 ("s-M" . gnus-unplugged)
1367 ("C-c a m" . gnus-plugged)
1368 ("C-c a M" . gnus-unplugged))
1369 :init
1370 (setq
1371 gnus-select-method '(nnnil "")
1372 gnus-secondary-select-methods
1373 '((nnimap "shemshak"
1374 (nnimap-stream plain)
1375 (nnimap-address "127.0.0.1")
1376 (nnimap-server-port 143)
1377 (nnimap-authenticator plain)
1378 (nnimap-user "amin@shemshak.local"))
1379 (nnimap "gnu"
1380 (nnimap-stream plain)
1381 (nnimap-address "127.0.0.1")
1382 (nnimap-server-port 143)
1383 (nnimap-authenticator plain)
1384 (nnimap-user "bandali@gnu.local")
1385 (nnimap-inbox "INBOX")
1386 (nnimap-split-methods 'nnimap-split-fancy)
1387 (nnimap-split-fancy (|
1388 ;; (: gnus-registry-split-fancy-with-parent)
1389 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1390 ;; gnu
1391 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
1392 ;; gnus
1393 (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
1394 ;; libreplanet
1395 (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
1396 ;; *.lists.sr.ht, omitting one dot if present
1397 ;; add more \\.?\\([^.]*\\) if needed
1398 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
1399 ;; webmasters
1400 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1401 ;; other
1402 (list ".*atreus.freelists.org" "l.atreus")
1403 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1404 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
1405 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
1406 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
1407 ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
1408 ;; ----------------------------------
1409 ;; legend: (u)nsubscribed | (d)ead
1410 ;; ----------------------------------
1411 ;; otherwise, leave mail in INBOX
1412 "INBOX")))
1413 (nnimap "uw"
1414 (nnimap-stream plain)
1415 (nnimap-address "127.0.0.1")
1416 (nnimap-server-port 143)
1417 (nnimap-authenticator plain)
1418 (nnimap-user "abandali@uw.local")
1419 (nnimap-inbox "INBOX")
1420 (nnimap-split-methods 'nnimap-split-fancy)
1421 (nnimap-split-fancy (|
1422 ;; (: gnus-registry-split-fancy-with-parent)
1423 ;; se212-f19
1424 ("subject" "SE\\s-?212" "course.se212-f19")
1425 (from "SE\\s-?212" "course.se212-f19")
1426 ;; catch-all
1427 "INBOX")))
1428 (nnimap "csc"
1429 (nnimap-stream plain)
1430 (nnimap-address "127.0.0.1")
1431 (nnimap-server-port 143)
1432 (nnimap-authenticator plain)
1433 (nnimap-user "abandali@csc.uw.local")))
1434 gnus-message-archive-group "nnimap+gnu:INBOX"
1435 gnus-parameters
1436 '(("l\\.atreus"
1437 (to-address . "atreus@freelists.org")
1438 (to-list . "atreus@freelists.org"))
1439 ("l\\.deepspec"
1440 (to-address . "deepspec@lists.cs.princeton.edu")
1441 (to-list . "deepspec@lists.cs.princeton.edu")
1442 (list-identifier . "\\[deepspec\\]"))
1443 ("l\\.emacs-devel"
1444 (to-address . "emacs-devel@gnu.org")
1445 (to-list . "emacs-devel@gnu.org"))
1446 ("l\\.help-gnu-emacs"
1447 (to-address . "help-gnu-emacs@gnu.org")
1448 (to-list . "help-gnu-emacs@gnu.org"))
1449 ("l\\.info-gnu-emacs"
1450 (to-address . "info-gnu-emacs@gnu.org")
1451 (to-list . "info-gnu-emacs@gnu.org"))
1452 ("l\\.emacs-orgmode"
1453 (to-address . "emacs-orgmode@gnu.org")
1454 (to-list . "emacs-orgmode@gnu.org")
1455 (list-identifier . "\\[O\\]"))
1456 ("l\\.emacs-tangents"
1457 (to-address . "emacs-tangents@gnu.org")
1458 (to-list . "emacs-tangents@gnu.org"))
1459 ("l\\.emacsconf-committee"
1460 (to-address . "emacsconf-committee@gnu.org")
1461 (to-list . "emacsconf-committee@gnu.org"))
1462 ("l\\.emacsconf-discuss"
1463 (to-address . "emacsconf-discuss@gnu.org")
1464 (to-list . "emacsconf-discuss@gnu.org"))
1465 ("l\\.emacsconf-register"
1466 (to-address . "emacsconf-register@gnu.org")
1467 (to-list . "emacsconf-register@gnu.org"))
1468 ("l\\.emacsconf-submit"
1469 (to-address . "emacsconf-submit@gnu.org")
1470 (to-list . "emacsconf-submit@gnu.org"))
1471 ("l\\.fencepost-users"
1472 (to-address . "fencepost-users@gnu.org")
1473 (to-list . "fencepost-users@gnu.org")
1474 (list-identifier . "\\[Fencepost-users\\]"))
1475 ("l\\.gnewsense-art"
1476 (to-address . "gnewsense-art@nongnu.org")
1477 (to-list . "gnewsense-art@nongnu.org")
1478 (list-identifier . "\\[gNewSense-art\\]"))
1479 ("l\\.gnewsense-dev"
1480 (to-address . "gnewsense-dev@nongnu.org")
1481 (to-list . "gnewsense-dev@nongnu.org")
1482 (list-identifier . "\\[Gnewsense-dev\\]"))
1483 ("l\\.gnewsense-users"
1484 (to-address . "gnewsense-users@nongnu.org")
1485 (to-list . "gnewsense-users@nongnu.org")
1486 (list-identifier . "\\[gNewSense-users\\]"))
1487 ("l\\.gnunet-developers"
1488 (to-address . "gnunet-developers@gnu.org")
1489 (to-list . "gnunet-developers@gnu.org")
1490 (list-identifier . "\\[GNUnet-developers\\]"))
1491 ("l\\.help-gnunet"
1492 (to-address . "help-gnunet@gnu.org")
1493 (to-list . "help-gnunet@gnu.org")
1494 (list-identifier . "\\[Help-gnunet\\]"))
1495 ("l\\.bug-gnuzilla"
1496 (to-address . "bug-gnuzilla@gnu.org")
1497 (to-list . "bug-gnuzilla@gnu.org")
1498 (list-identifier . "\\[Bug-gnuzilla\\]"))
1499 ("l\\.gnuzilla-dev"
1500 (to-address . "gnuzilla-dev@gnu.org")
1501 (to-list . "gnuzilla-dev@gnu.org")
1502 (list-identifier . "\\[Gnuzilla-dev\\]"))
1503 ("l\\.guile-devel"
1504 (to-address . "guile-devel@gnu.org")
1505 (to-list . "guile-devel@gnu.org"))
1506 ("l\\.guile-user"
1507 (to-address . "guile-user@gnu.org")
1508 (to-list . "guile-user@gnu.org"))
1509 ("l\\.guix-devel"
1510 (to-address . "guix-devel@gnu.org")
1511 (to-list . "guix-devel@gnu.org"))
1512 ("l\\.help-guix"
1513 (to-address . "help-guix@gnu.org")
1514 (to-list . "help-guix@gnu.org"))
1515 ("l\\.info-guix"
1516 (to-address . "info-guix@gnu.org")
1517 (to-list . "info-guix@gnu.org"))
1518 ("l\\.savannah-hackers-public"
1519 (to-address . "savannah-hackers-public@gnu.org")
1520 (to-list . "savannah-hackers-public@gnu.org"))
1521 ("l\\.savannah-users"
1522 (to-address . "savannah-users@gnu.org")
1523 (to-list . "savannah-users@gnu.org"))
1524 ("l\\.www-commits"
1525 (to-address . "www-commits@gnu.org")
1526 (to-list . "www-commits@gnu.org"))
1527 ("l\\.www-discuss"
1528 (to-address . "www-discuss@gnu.org")
1529 (to-list . "www-discuss@gnu.org"))
1530 ("l\\.haskell-art"
1531 (to-address . "haskell-art@we.lurk.org")
1532 (to-list . "haskell-art@we.lurk.org")
1533 (list-identifier . "\\[haskell-art\\]"))
1534 ("l\\.haskell-cafe"
1535 (to-address . "haskell-cafe@haskell.org")
1536 (to-list . "haskell-cafe@haskell.org")
1537 (list-identifier . "\\[Haskell-cafe\\]"))
1538 ("l\\.notmuch"
1539 (to-address . "notmuch@notmuchmail.org")
1540 (to-list . "notmuch@notmuchmail.org"))
1541 ("l\\.parabola-dev"
1542 (to-address . "dev@lists.parabola.nu")
1543 (to-list . "dev@lists.parabola.nu")
1544 (list-identifier . "\\[Dev\\]"))
1545 ("l\\.~bandali\\.public-inbox"
1546 (to-address . "~bandali/public-inbox@lists.sr.ht")
1547 (to-list . "~bandali/public-inbox@lists.sr.ht"))
1548 ("l\\.~sircmpwn\\.free-writers-club"
1549 (to-address . "~sircmpwn/free-writers-club@lists.sr.ht")
1550 (to-list . "~sircmpwn/free-writers-club@lists.sr.ht"))
1551 ("l\\.~sircmpwn\\.srht-admins"
1552 (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht")
1553 (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht"))
1554 ("l\\.~sircmpwn\\.srht-announce"
1555 (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht")
1556 (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht"))
1557 ("l\\.~sircmpwn\\.srht-dev"
1558 (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht")
1559 (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht"))
1560 ("l\\.~sircmpwn\\.srht-discuss"
1561 (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht")
1562 (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht"))
1563 ("webmasters"
1564 (to-address . "webmasters@gnu.org")
1565 (to-list . "webmasters@gnu.org"))
1566 ("gnu.*"
1567 (gcc-self . t))
1568 ("l\\."
1569 (subscribed . t))
1570 ("nnimap\\+uw:.*"
1571 (gcc-self . t)))
1572 gnus-large-newsgroup 50
1573 gnus-home-directory (b/var "gnus/")
1574 gnus-directory (concat gnus-home-directory "news/")
1575 message-directory (concat gnus-home-directory "mail/")
1576 nndraft-directory (concat gnus-home-directory "drafts/")
1577 gnus-save-newsrc-file nil
1578 gnus-read-newsrc-file nil
1579 gnus-interactive-exit nil
1580 gnus-gcc-mark-as-read t)
1581 :config
1582 (when (version< emacs-version "27")
1583 (with-eval-after-load 'nnmail
1584 (add-to-list
1585 'nnmail-split-abbrev-alist
1586 '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
1587 t)))
1588
1589 ;; (gnus-registry-initialize)
1590
1591 (with-eval-after-load 'recentf
1592 (add-to-list 'recentf-exclude gnus-home-directory)))
1593
1594 (use-package gnus-art
1595 :config
1596 (setq
1597 gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)")
1598 gnus-sorted-header-list '("^From:"
1599 "^X-RT-Originator"
1600 "^Newsgroups:"
1601 "^Subject:"
1602 "^Date:"
1603 "^Envelope-To:"
1604 "^Followup-To:"
1605 "^Reply-To:"
1606 "^Organization:"
1607 "^Summary:"
1608 "^Abstract:"
1609 "^Keywords:"
1610 "^To:"
1611 "^[BGF]?Cc:"
1612 "^Posted-To:"
1613 "^Mail-Copies-To:"
1614 "^Mail-Followup-To:"
1615 "^Apparently-To:"
1616 "^Resent-From:"
1617 "^User-Agent:"
1618 "^X-detected-operating-system:"
1619 "^Message-ID:"
1620 ;; "^References:"
1621 "^List-Id:"
1622 "^Gnus-Warning:")
1623 gnus-visible-headers (mapconcat 'identity
1624 gnus-sorted-header-list
1625 "\\|")
1626 ;; local-lapsed article dates
1627 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1628 gnus-article-date-headers '(user-defined)
1629 gnus-article-time-format
1630 (lambda (time)
1631 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
1632 (local (article-make-date-line date 'local))
1633 (combined-lapsed (article-make-date-line date
1634 'combined-lapsed))
1635 (lapsed (progn
1636 (string-match " (.+" combined-lapsed)
1637 (match-string 0 combined-lapsed))))
1638 (concat local lapsed))))
1639 (bind-keys
1640 :map gnus-article-mode-map
1641 ("M-L" . org-store-link)))
1642
1643 (use-package gnus-sum
1644 :bind (:map gnus-summary-mode-map
1645 :prefix-map b/gnus-summary-prefix-map
1646 :prefix "v"
1647 ("r" . gnus-summary-reply)
1648 ("w" . gnus-summary-wide-reply)
1649 ("v" . gnus-summary-show-raw-article))
1650 :config
1651 (bind-keys
1652 :map gnus-summary-mode-map
1653 ("M-L" . org-store-link))
1654 :hook (gnus-summary-mode . b/no-mouse-autoselect-window)
1655 :custom
1656 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
1657 gnus-thread-sort-by-subject
1658 gnus-thread-sort-by-date)))
1659
1660 (use-package gnus-msg
1661 :config
1662 (defvar b/shemshak-signature "Amin Bandali
1663 https://shemshak.org/~amin")
1664 (defvar b/uw-signature "Amin Bandali, MMath Student
1665 Cheriton School of Computer Science
1666 University of Waterloo
1667 https://bandali.eu.org")
1668 (defvar b/csc-signature "Amin Bandali
1669 System Administrator, Systems Committee
1670 Computer Science Club, University of Waterloo
1671 https://csclub.uwaterloo.ca/~abandali")
1672 (setq gnus-message-replysign t
1673 gnus-posting-styles
1674 '((".*"
1675 (address "bandali@gnu.org"))
1676 ("nnimap\\+gnu:l\\..*"
1677 (signature nil))
1678 ("nnimap\\+gnu:.*"
1679 (organization "GNU"))
1680 ((header "subject" "ThankCRM")
1681 (to "webmasters-comment@gnu.org")
1682 (body "")
1683 (eval (setq b/message-cite-say-hi nil)))
1684 ("nnimap\\+shemshak:.*"
1685 (address "amin@shemshak.org")
1686 (body "\nBest,\n")
1687 (signature b/shemshak-signature)
1688 (gcc "nnimap+shemshak:Sent")
1689 (eval (setq b/message-cite-say-hi t)))
1690 ("nnimap\\+uw:.*"
1691 (address "bandali@uwaterloo.ca")
1692 (body "\nBest,\n")
1693 (signature b/uw-signature))
1694 ("nnimap\\+uw:INBOX"
1695 (gcc "\"nnimap+uw:Sent Items\""))
1696 ("nnimap\\+csc:.*"
1697 (address "bandali@csclub.uwaterloo.ca")
1698 (signature b/csc-signature)
1699 (gcc "nnimap+csc:Sent"))))
1700 :hook (gnus-message-setup . (lambda ()
1701 (unless (mml-secure-is-encrypted-p)
1702 (mml-secure-message-sign)))))
1703
1704 (use-package gnus-topic
1705 :hook (gnus-group-mode . gnus-topic-mode)
1706 :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n"))
1707
1708 (use-package gnus-agent
1709 :config
1710 (setq gnus-agent-synchronize-flags 'ask)
1711 :hook (gnus-group-mode . gnus-agent-mode))
1712
1713 (use-package gnus-group
1714 :config
1715 (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)"))
1716
1717 (comment
1718 ;; problematic with ebdb's popup, *EBDB-Gnus*
1719 (use-package gnus-win
1720 :config
1721 (setq gnus-use-full-window nil)))
1722
1723 (use-package gnus-dired
1724 :commands gnus-dired-mode
1725 :init
1726 (add-hook 'dired-mode-hook 'gnus-dired-mode))
1727
1728 (comment
1729 (use-package gnus-utils
1730 :custom
1731 (gnus-completing-read-function 'gnus-ido-completing-read)))
1732
1733 (use-package mm-decode
1734 :config
1735 (setq mm-discouraged-alternatives '("text/html" "text/richtext")
1736 mm-decrypt-option 'known
1737 mm-verify-option 'known))
1738
1739 (use-package mm-uu
1740 :config
1741 (when (version< "27" emacs-version)
1742 (set-face-attribute 'mm-uu-extract nil :extend t))
1743 :custom
1744 (mm-uu-diff-groups-regexp
1745 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
1746
1747 (use-package sendmail
1748 :config
1749 (setq sendmail-program (executable-find "msmtp")
1750 ;; message-sendmail-extra-arguments '("-v" "-d")
1751 mail-specify-envelope-from t
1752 mail-envelope-from 'header))
1753
1754 (use-package message
1755 :bind (:map message-mode-map ("<C-return>" . b/insert-asterism))
1756 :config
1757 ;; redefine for a simplified In-Reply-To header
1758 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
1759 (defun message-make-in-reply-to ()
1760 "Return the In-Reply-To header for this message."
1761 (when message-reply-headers
1762 (let ((from (mail-header-from message-reply-headers))
1763 (msg-id (mail-header-id message-reply-headers)))
1764 (when from
1765 msg-id))))
1766
1767 (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:")
1768 (defconst message-cite-style-bandali
1769 '((message-cite-function 'message-cite-original)
1770 (message-citation-line-function 'message-insert-formatted-citation-line)
1771 (message-cite-reply-position 'traditional)
1772 (message-yank-prefix "> ")
1773 (message-yank-cited-prefix ">")
1774 (message-yank-empty-prefix ">")
1775 (message-citation-line-format
1776 (if b/message-cite-say-hi
1777 (concat "Hi %F,\n\n" b/message-cite-style-format)
1778 b/message-cite-style-format)))
1779 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
1780 (setq ;; message-cite-style 'message-cite-style-bandali
1781 message-kill-buffer-on-exit t
1782 message-send-mail-function 'message-send-mail-with-sendmail
1783 message-sendmail-envelope-from 'header
1784 message-subscribed-address-functions
1785 '(gnus-find-subscribed-addresses)
1786 message-dont-reply-to-names
1787 "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)")
1788 ;; (require 'company-ebdb)
1789 :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
1790 (message-mode . flyspell-mode)
1791 (message-mode . (lambda ()
1792 ;; (setq-local fill-column b/fill-column
1793 ;; message-fill-column b/fill-column)
1794 (make-local-variable 'company-idle-delay)
1795 (setq company-idle-delay 0.2))))
1796 ;; :custom-face
1797 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
1798 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
1799 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
1800 :custom
1801 (message-elide-ellipsis "[...]\n"))
1802
1803 (use-package mml)
1804
1805 (use-package mml-sec
1806 :custom
1807 (mml-secure-openpgp-encrypt-to-self t)
1808 (mml-secure-openpgp-sign-with-sender t))
1809
1810 (use-package footnote
1811 :after message
1812 ;; :config
1813 ;; (setq footnote-start-tag ""
1814 ;; footnote-end-tag ""
1815 ;; footnote-style 'unicode)
1816 :bind
1817 (:map message-mode-map
1818 :prefix-map b/footnote-prefix-map
1819 :prefix "C-c f n"
1820 ("a" . footnote-add-footnote)
1821 ("b" . footnote-back-to-message)
1822 ("c" . footnote-cycle-style)
1823 ("d" . footnote-delete-footnote)
1824 ("g" . footnote-goto-footnote)
1825 ("r" . footnote-renumber-footnotes)
1826 ("s" . footnote-set-style)))
1827
1828 (use-package ebdb
1829 :demand
1830 :after gnus
1831 :bind (:map gnus-group-mode-map ("e" . ebdb))
1832 :config
1833 (setq ebdb-sources (b/var "ebdb"))
1834 (with-eval-after-load 'swiper
1835 (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
1836
1837 (use-package ebdb-com
1838 :after ebdb)
1839
1840 (use-package ebdb-complete
1841 :after ebdb
1842 :config
1843 ;; (setq ebdb-complete-mail 'capf)
1844 (ebdb-complete-enable))
1845
1846 (use-package ebdb-message
1847 :demand
1848 :after ebdb)
1849
1850 ;; (use-package company-ebdb
1851 ;; :config
1852 ;; (defun company-ebdb--post-complete (_) nil))
1853
1854 (use-package ebdb-gnus
1855 :after ebdb
1856 :custom
1857 (ebdb-gnus-window-size 0.3))
1858
1859 (use-package ebdb-mua
1860 :demand
1861 :after ebdb
1862 :custom (ebdb-mua-pop-up t))
1863
1864 ;; (use-package ebdb-message
1865 ;; :after ebdb)
1866
1867 ;; (use-package ebdb-vcard
1868 ;; :after ebdb)
1869
1870 (use-package message-x)
1871
1872 (comment
1873 (use-package message-x
1874 :custom
1875 (message-x-completion-alist
1876 (quote
1877 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address)
1878 ((if
1879 (boundp
1880 (quote message-newgroups-header-regexp))
1881 message-newgroups-header-regexp message-newsgroups-header-regexp)
1882 . message-expand-group))))))
1883
1884 (comment
1885 (use-package gnus-harvest
1886 :commands gnus-harvest-install
1887 :demand t
1888 :config
1889 (if (featurep 'message-x)
1890 (gnus-harvest-install 'message-x)
1891 (gnus-harvest-install))))
1892
1893 (use-package gnus-article-treat-patch
1894 :disabled
1895 :demand
1896 :load-path "lisp/"
1897 :config
1898 ;; note: be sure to customize faces with `:foreground "white"' when
1899 ;; using a theme with a white/light background :)
1900 (setq ft/gnus-article-patch-conditions
1901 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
1902
1903 \f
1904 ;;; IRC (with ERC and ZNC)
1905
1906 (use-package erc
1907 :bind (("C-c b b" . erc-switch-to-buffer)
1908 :map erc-mode-map
1909 ("M-a" . erc-track-switch-buffer))
1910 :custom
1911 (erc-join-buffer 'bury)
1912 (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
1913 (erc-nick "bandali")
1914 (erc-prompt "erc>")
1915 (erc-rename-buffers t)
1916 (erc-server-reconnect-attempts 5)
1917 (erc-server-reconnect-timeout 3)
1918 :config
1919 (defun erc-cmd-OPME ()
1920 "Request chanserv to op me."
1921 (erc-message "PRIVMSG"
1922 (format "chanserv op %s %s"
1923 (erc-default-target)
1924 (erc-current-nick)) nil))
1925 (defun erc-cmd-DEOPME ()
1926 "Deop myself from current channel."
1927 (erc-cmd-DEOP (format "%s" (erc-current-nick))))
1928 (add-to-list 'erc-modules 'keep-place)
1929 (add-to-list 'erc-modules 'notifications)
1930 (add-to-list 'erc-modules 'smiley)
1931 (add-to-list 'erc-modules 'spelling)
1932 (add-to-list 'erc-modules 'scrolltoplace)
1933 (erc-update-modules))
1934
1935 (use-package erc-fill
1936 :after erc
1937 :custom
1938 (erc-fill-column 77)
1939 (erc-fill-function 'erc-fill-static)
1940 (erc-fill-static-center 18))
1941
1942 (use-package erc-pcomplete
1943 :after erc
1944 :custom
1945 (erc-pcomplete-nick-postfix ", "))
1946
1947 (use-package erc-track
1948 :after erc
1949 :bind (("C-c a e t d" . erc-track-disable)
1950 ("C-c a e t e" . erc-track-enable))
1951 :custom
1952 (erc-track-enable-keybindings nil)
1953 (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
1954 "324" "329" "332" "333" "353" "477"))
1955 (erc-track-position-in-mode-line t)
1956 (erc-track-priority-faces-only 'all)
1957 (erc-track-shorten-function nil))
1958
1959 (use-package erc-hl-nicks
1960 :after erc)
1961
1962 (use-package erc-scrolltoplace
1963 :after erc)
1964
1965 (use-package znc
1966 :bind (("C-c a e e" . znc-erc)
1967 ("C-c a e a" . znc-all))
1968 :config
1969 (let ((pwd (let ((auth (auth-source-search :host "znca")))
1970 (cond
1971 ((null auth) (error "Couldn't find znca's authinfo"))
1972 (t (funcall (plist-get (car auth) :secret)))))))
1973 (setq znc-servers
1974 `(("znc.shemshak.org" 1337 t
1975 ((freenode "amin/freenode" ,pwd)))
1976 ("znc.shemshak.org" 1337 t
1977 ((oftc "amin/oftc" ,pwd)))))))
1978
1979 \f
1980 ;;; Post initialization
1981
1982 )
1983 (message "Loading %s...done (%.3fs)" user-init-file
1984 (float-time (time-subtract (current-time)
1985 b/before-user-init-time)))
1986
1987 ;;; init.el ends here