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