1 ;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t -*-
3 ;; Copyright (C) 2018-2019 Amin Bandali <bandali@gnu.org>
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.
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.
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/>.
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.
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:
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
38 ;;; Emacs initialization
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
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)
58 ;; set them back to their defaults once we're done initializing
60 (setq gc-cons-threshold a
/gc-cons-threshold
61 gc-cons-percentage a
/gc-cons-percentage
62 file-name-handler-alist a
/file-name-handler-alist
))
63 (add-hook 'after-init-hook
#'a
/post-init
)
65 ;; increase number of lines kept in *Messages* log
66 (setq message-log-max
20000)
68 ;; optionally, uncomment to supress some byte-compiler warnings
69 ;; (see C-h v byte-compile-warnings RET for more info)
70 ;; (setq byte-compile-warnings
71 ;; '(not free-vars unresolved noruntime lexical make-local))
76 (setq user-full-name
"Amin Bandali"
77 user-mail-address
"amin@bndl.org")
82 ;; useful for commenting out multiple sexps at a time
83 (defmacro comment
(&rest _
)
84 "Comment out one or more s-expressions."
85 (declare (indent defun
))
89 ;;; Package management
91 ;; No package.el (for emacs 26 and before, uncomment the following)
92 ;; Not necessary when using straight.el
93 ;; (C-h v straight-package-neutering-mode RET)
96 (not (featurep 'straight
))
97 (version< emacs-version
"27"))
98 (setq package-enable-at-startup nil
)
99 ;; (package-initialize)
102 ;; for emacs 27 and later, we use early-init.el. see
103 ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b
107 ;; Main engine start...
109 (setq straight-repository-branch
"develop"
110 straight-check-for-modifications
'(check-on-save find-when-checking
))
112 (defun a/bootstrap-straight
()
113 (defvar bootstrap-version
)
114 (let ((bootstrap-file
115 (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory
))
116 (bootstrap-version 5))
117 (unless (file-exists-p bootstrap-file
)
119 (url-retrieve-synchronously
120 "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
121 'silent
'inhibit-cookies
)
122 (goto-char (point-max))
123 (eval-print-last-sexp)))
124 (load bootstrap-file nil
'nomessage
)))
126 ;; Solid rocket booster ignition...
128 (a/bootstrap-straight
)
132 (setq straight-use-package-by-default t
)
134 (defmacro use-feature
(name &rest args
)
135 "Like `use-package', but with `straight-use-package-by-default' disabled."
136 (declare (indent defun
))
141 (with-eval-after-load 'recentf
142 (add-to-list 'recentf-exclude
143 (expand-file-name "~/.emacs.d/straight/build/")))
145 (defun a/reload-init
()
148 (straight-transaction
149 (straight-mark-transaction-as-init)
150 (setq a
/file-name-handler-alist file-name-handler-alist
)
151 (load user-init-file
)
155 (straight-use-package 'use-package
)
156 (if nil
; set to t when need to debug init
158 (setq use-package-verbose t
159 use-package-expand-minimally nil
160 use-package-compute-statistics t
162 (require 'use-package
))
163 (setq use-package-verbose nil
164 use-package-expand-minimally t
))
166 (setq use-package-always-defer t
)
169 ;; for browsing the Emacsmirror package database
172 :commands
(epkg-list-packages epkg-describe-package
)
174 (("C-c p e d" . epkg-describe-package
)
175 ("C-c p e p" . epkg-list-packages
))
177 (setq epkg-repository
"~/.emacs.d/straight/repos/epkgs/")
178 (eval-when-compile (defvar ivy-initial-inputs-alist
))
179 (with-eval-after-load 'ivy
181 'ivy-initial-inputs-alist
'(epkg-describe-package .
"^") t
))))
186 ;; keep ~/.emacs.d clean
187 (use-package no-littering
191 (add-to-list 'savehist-additional-variables
'kill-ring
)
193 (setq auto-save-file-name-transforms
194 `((".*" ,(no-littering-expand-var-file-name "auto-save/") t
))))
196 ;; separate custom file (don't want it mixing with init.el)
200 (setq custom-file
(no-littering-expand-etc-file-name "custom.el"))
201 (when (file-exists-p custom-file
)
203 ;; while at it, treat themes as safe
204 (setf custom-safe-themes t
))
206 ;; load the secrets file if it exists, otherwise show a warning
208 (load (no-littering-expand-etc-file-name "secrets")))
210 ;; better $PATH (and other environment variable) handling
211 (use-package exec-path-from-shell
214 (setq exec-path-from-shell-arguments nil
215 exec-path-from-shell-check-startup-files nil
)
217 (exec-path-from-shell-initialize)
218 ;; while we're at it, let's fix access to our running ssh-agent
219 (exec-path-from-shell-copy-env "SSH_AGENT_PID")
220 (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
222 ;; only one custom theme at a time
224 (defadvice load-theme
(before clear-previous-themes activate
)
225 "Clear existing theme settings instead of layering them"
226 (mapc #'disable-theme custom-enabled-themes
)))
228 ;; start up emacs server. see
229 ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server
232 :config
(or (server-running-p) (server-mode)))
236 (dolist (ft (fontset-list))
240 (font-spec :name
"Source Code Pro" :size
14))
244 (font-spec :name
"DejaVu Sans Mono")
251 ;; :name "Symbola monospacified for DejaVu Sans Mono")
257 ;; (font-spec :name "DejaVu Sans Mono")
263 (font-spec :name
"DejaVu Sans Mono" :size
14)
267 ;; gentler font resizing
268 (setq text-scale-mode-step
1.05)
270 ;; focus follows mouse
271 (setq mouse-autoselect-window t
)
273 (defun a/no-mouse-autoselect-window
()
274 "Conveniently disable `focus-follows-mouse'.
275 For disabling the behaviour for certain buffers and/or modes."
276 (make-local-variable 'mouse-autoselect-window
)
277 (setq mouse-autoselect-window nil
))
280 (setq ;; scroll-margin 1
281 ;; scroll-conservatively 10000
283 scroll-conservatively
10
284 scroll-preserve-screen-position
1)
289 (setq mouse-wheel-scroll-amount
'(1 ((shift) .
1)) ; one line at a time
290 mouse-wheel-progressive-speed nil
; don't accelerate scrolling
291 mouse-wheel-follow-mouse t
)) ; scroll window under mouse
293 (use-feature pixel-scroll
295 :config
(pixel-scroll-mode 1))
297 ;; ask for GPG passphrase in minibuffer
298 (setq epg-pinentry-mode
'loopback
)
307 (defmacro a
/setq-every
(value &rest vars
)
308 "Set all the variables from VARS to value VALUE."
309 (declare (indent defun
) (debug t
))
310 `(progn ,@(mapcar (lambda (x) (list 'setq x value
)) vars
)))
312 (defun a/start-process
(program &rest args
)
313 "Same as `start-process', but doesn't bother about name and buffer."
314 (let ((process-name (concat program
"_process"))
315 (buffer-name (generate-new-buffer-name
316 (concat program
"_output"))))
317 (apply #'start-process
318 process-name buffer-name program args
)))
320 (defun a/dired-start-process
(program &optional args
)
321 "Open current file with a PROGRAM."
322 ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can
323 ;; be nil, so remove it).
324 (apply #'a
/start-process
326 (remove nil
(list args
(dired-get-file-for-visit)))))
328 (defun a/add-elisp-section
()
332 (insert "\n\f\n;;; "))
337 ;; time and battery in mode-line
341 (setq display-time-default-load-average nil
)
347 (display-battery-mode)))
350 ;; (fringe-mode '(3 . 1))
353 ;; disable disabled commands
354 (setq disabled-command-function nil
)
356 ;; Save what I copy into clipboard from other applications into Emacs'
357 ;; kill-ring, which would allow me to still be able to easily access
358 ;; it in case I kill (cut or copy) something else inside Emacs before
359 ;; yanking (pasting) what I'd originally intended to.
360 (setq save-interprogram-paste-before-kill t
)
363 (setq enable-recursive-minibuffers t
364 resize-mini-windows t
)
366 ;; lazy-person-friendly yes/no prompts
367 (defalias 'yes-or-no-p
#'y-or-n-p
)
369 ;; i want *scratch* as my startup buffer
370 (setq initial-buffer-choice t
)
372 ;; i don't need the default hint
373 (setq initial-scratch-message nil
)
375 ;; use customizable text-mode as major mode for *scratch*
376 (setq initial-major-mode
'text-mode
)
378 ;; inhibit buffer list when more than 2 files are loaded
379 (setq inhibit-startup-buffer-menu t
)
381 ;; don't need to see the startup screen or the echo area message
382 (advice-add #'display-startup-echo-area-message
:override
#'ignore
)
383 (setq inhibit-startup-screen t
384 inhibit-startup-echo-area-message user-login-name
)
386 ;; more useful frame titles
387 (setq frame-title-format
388 '("" invocation-name
" - "
389 (:eval
(if (buffer-file-name)
390 (abbreviate-file-name (buffer-file-name))
393 ;; backups (C-h v make-backup-files RET)
394 (setq backup-by-copying t
396 delete-old-versions t
)
398 ;; enable automatic reloading of changed buffers and files
399 (global-auto-revert-mode 1)
400 (setq auto-revert-verbose nil
401 global-auto-revert-non-file-buffers nil
)
403 ;; always use space for indentation
406 require-final-newline t
409 ;; enable winner-mode (C-h f winner-mode RET)
412 ;; don't display *compilation* buffer on success. based on
413 ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
414 ;; instead of the now obsolete `flet'.
415 (with-eval-after-load 'compile
416 (defun a/compilation-finish-function
(buffer outstr
)
417 (unless (string-match "finished" outstr
)
418 (switch-to-buffer-other-window buffer
))
421 (setq compilation-finish-functions
#'a
/compilation-finish-function
)
425 (defadvice compilation-start
426 (around inhibit-display
427 (command &optional mode name-function highlight-regexp
))
428 (if (not (string-match "^\\(find\\|grep\\)" command
))
429 (cl-letf (((symbol-function 'display-buffer
) #'ignore
))
430 (save-window-excursion ad-do-it
))
432 (ad-activate 'compilation-start
))
434 ;; search for non-ASCII characters: i’d like non-ASCII characters such
435 ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII
436 ;; counterpart. shoutout to
437 ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html
438 (setq search-default-mode
#'char-fold-to-regexp
)
439 ;; uncomment to extend this behaviour to query-replace
440 ;; (setq replace-char-fold t)
443 (setq-default cursor-type
'bar
)
445 ;; allow scrolling in Isearch
446 (setq isearch-allow-scroll t
)
449 :bind
("C-x v C-=" . vc-ediff
))
452 :config
(add-hook 'ediff-after-quit-hook-internal
'winner-undo
)
453 :custom
((ediff-window-setup-function 'ediff-setup-windows-plain
)
454 (ediff-split-window-function 'split-window-horizontally
)))
462 ("C-c e b" . eval-buffer
)
463 ("C-c e r" . eval-region
)
465 ("C-c e i" . emacs-init-time
)
466 ("C-c e u" . emacs-uptime
)
468 ("C-c F m" . make-frame-command
)
469 ("C-c F d" . delete-frame
)
470 ("C-c F D" . server-edit
)
472 ("C-c o" . other-window
)
474 ("C-S-h C" . describe-char
)
475 ("C-S-h F" . describe-face
)
477 ("C-x k" . kill-this-buffer
)
478 ("C-x K" . kill-buffer
)
480 ("s-p" . beginning-of-buffer
)
481 ("s-n" . end-of-buffer
)
483 :map emacs-lisp-mode-map
484 ("<C-return>" . a
/add-elisp-section
))
486 (when (display-graphic-p)
487 (unbind-key "C-z" global-map
))
490 :prefix-map a
/straight-prefix-map
492 ("u" . straight-use-package
)
493 ("f" . straight-freeze-versions
)
494 ("t" . straight-thaw-versions
)
495 ("P" . straight-prune-build
)
496 ("g" . straight-get-recipe
)
497 ("r" . a
/reload-init
)
498 ;; M-x ^straight-.*-all$
499 ("a c" . straight-check-all
)
500 ("a f" . straight-fetch-all
)
501 ("a m" . straight-merge-all
)
502 ("a n" . straight-normalize-all
)
503 ("a F" . straight-pull-all
)
504 ("a P" . straight-push-all
)
505 ("a r" . straight-rebuild-all
)
506 ;; M-x ^straight-.*-package$
507 ("p c" . straight-check-package
)
508 ("p f" . straight-fetch-package
)
509 ("p m" . straight-merge-package
)
510 ("p n" . straight-normalize-package
)
511 ("p F" . straight-pull-package
)
512 ("p P" . straight-push-package
)
513 ("p r" . straight-rebuild-package
))
516 ;;; Essential packages
518 (use-package auto-compile
521 (auto-compile-on-load-mode)
522 (auto-compile-on-save-mode)
523 (setq auto-compile-display-buffer nil
524 auto-compile-mode-line-counter t
525 auto-compile-source-recreate-deletes-dest t
526 auto-compile-toggle-deletes-nonlib-dest t
527 auto-compile-update-autoloads t
)
528 (add-hook 'auto-compile-inhibit-compile-hook
529 'auto-compile-inhibit-compile-detached-git-head
))
531 ;; use the org-plus-contrib package to get the whole deal
532 (straight-use-package 'org-plus-contrib
)
537 (setq org-src-tab-acts-natively t
538 org-src-preserve-indentation nil
539 org-edit-src-content-indentation
0
540 org-link-email-description-format
"Email %c: %s" ; %.30s
541 org-highlight-latex-and-related
'(entities)
542 org-use-speed-commands t
543 org-startup-folded
'content
544 org-catch-invisible-edits
'show-and-error
546 (add-to-list 'org-structure-template-alist
'("L" .
"src emacs-lisp") t
)
548 (("C-c a o a" . org-agenda
)
550 ("M-L" . org-insert-last-stored-link
)
551 ("M-O" . org-toggle-link-display
)
553 :hook
((org-mode . org-indent-mode
)
554 (org-mode . auto-fill-mode
)
555 (org-mode . flyspell-mode
))
557 (org-agenda-files '("~/usr/org/todos/personal.org"
558 "~/usr/org/todos/masters.org"))
559 (org-agenda-start-on-weekday 0)
560 (org-latex-packages-alist '(("" "listings") ("" "color")))
562 '(org-block-begin-line ((t (:foreground
"#5a5b5a" :background
"#1d1f21"))))
563 '(org-block ((t (:background
"#1d1f21"))))
564 '(org-latex-and-related ((t (:foreground
"#b294bb")))))
566 (use-feature ox-latex
569 (setq org-latex-listings
'listings
570 ;; org-latex-prefer-user-labels t
572 (add-to-list 'org-latex-classes
573 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
574 ("\\section{%s}" .
"\\section*{%s}")
575 ("\\subsection{%s}" .
"\\subsection*{%s}")
576 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
577 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
578 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
580 (require 'ox-beamer
))
582 (use-feature ox-extra
584 (ox-extras-activate '(latex-header-blocks ignore-headlines
)))
586 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
587 ;; org file. closely inspired by
588 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
589 (with-eval-after-load 'org
590 (defvar a
/show-async-tangle-results nil
591 "Keep *emacs* async buffers around for later inspection.")
593 (defvar a
/show-async-tangle-time nil
594 "Show the time spent tangling the file.")
596 (defun a/async-babel-tangle
()
597 "Tangle org file asynchronously."
599 (let* ((file-tangle-start-time (current-time))
600 (file (buffer-file-name))
601 (file-nodir (file-name-nondirectory file
))
602 ;; (async-quiet-switch "-q")
603 (file-noext (file-name-sans-extension file
)))
607 (org-babel-tangle-file ,file
))
608 (unless a
/show-async-tangle-results
611 (message "Tangled %s%s"
613 (if a
/show-async-tangle-time
615 (float-time (time-subtract (current-time)
616 ',file-tangle-start-time
)))
618 (message "Tangling %s failed" ,file-nodir
))))))))
621 'safe-local-variable-values
622 '(eval add-hook
'after-save-hook
#'a
/async-babel-tangle
'append
'local
))
624 ;; *the* right way to do git
627 :bind
(("C-x g" . magit-status
)
628 ("s-g s" . magit-status
)
629 ("s-g l" . magit-log-buffer-file
))
631 (magit-add-section-hook 'magit-status-sections-hook
632 'magit-insert-modules
633 'magit-insert-stashes
635 (setq magit-repository-directories
'(("~/" .
0)
637 (nconc magit-section-initial-visibility-alist
638 '(([unpulled status
] . show
)
639 ([unpushed status
] . show
)))
640 :custom
(magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1
)
641 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
643 ;; recently opened files
647 (add-to-list 'recentf-exclude
"^/\\(?:ssh\\|su\\|sudo\\)?:")
648 (setq recentf-max-saved-items
40))
650 ;; smart M-x enhancement (needed by counsel for history)
656 (:map ivy-minibuffer-map
657 ([escape] . keyboard-escape-quit)
658 ([S-up] . ivy-previous-history-element)
659 ([S-down] . ivy-next-history-element)
660 ("DEL" . ivy-backward-delete-char))
664 ivy-use-virtual-buffers t
665 ivy-virtual-abbreviate 'abbreviate
666 ivy-count-format "%d/%d ")
669 ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
670 ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold))))
671 ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold))))
676 :bind (("C-s" . swiper-isearch)
678 ("C-S-s" . isearch-forward)))
682 :bind (([remap execute-extended-command] . counsel-M-x)
683 ([remap find-file] . counsel-find-file)
684 ("C-c x" . counsel-M-x)
685 ("C-c f ." . counsel-find-file)
686 ("C-c f l" . counsel-find-library)
687 ("C-c f r" . counsel-recentf)
688 ("s-." . counsel-find-file)
689 ("s-r" . ivy-switch-buffer)
690 :map minibuffer-local-map
691 ("C-r" . counsel-minibuffer-history))
694 (defalias 'locate #'counsel-locate))
698 :commands (helm-M-x helm-mini helm-resume)
699 :bind (("M-x" . helm-M-x)
700 ("M-y" . helm-show-kill-ring)
701 ("C-x b" . helm-mini)
702 ("C-x C-b" . helm-buffers-list)
703 ("C-x C-f" . helm-find-files)
704 ("C-h r" . helm-info-emacs)
705 ("s-r" . helm-recentf)
706 ("C-s-r" . helm-resume)
708 ("<tab>" . helm-execute-persistent-action)
709 ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals
710 ("C-z" . helm-select-action)) ; List actions
711 :config (helm-mode 1)))
716 :bind ("C-c a s e" . eshell)
718 (eval-when-compile (defvar eshell-prompt-regexp))
719 (defun a/eshell-quit-or-delete-char (arg)
721 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
722 (eshell-life-is-too-much)
725 (defun a/eshell-clear ()
727 (let ((inhibit-read-only t))
731 (defun a/eshell-setup ()
732 (make-local-variable 'company-idle-delay)
733 (defvar company-idle-delay)
734 (setq company-idle-delay nil)
735 (bind-keys :map eshell-mode-map
736 ("C-d" . a/eshell-quit-or-delete-char)
737 ("C-S-l" . a/eshell-clear)
738 ("M-r" . counsel-esh-history)
739 ([tab] . company-complete)))
741 :hook (eshell-mode . a/eshell-setup)
743 (eshell-hist-ignoredups t)
744 (eshell-input-filter 'eshell-input-filter-initial-space))
748 (("C-x C-b" . ibuffer-other-window)
749 :map ibuffer-mode-map
750 ("P" . ibuffer-backward-filter-group)
751 ("N" . ibuffer-forward-filter-group)
752 ("M-p" . ibuffer-do-print)
753 ("M-n" . ibuffer-do-shell-command-pipe-replace))
755 ;; Use human readable Size column instead of original one
756 (define-ibuffer-column size-h
757 (:name "Size" :inline t)
759 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
760 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
761 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
762 (t (format "%8d" (buffer-size)))))
764 (ibuffer-saved-filter-groups
766 ("dired" (mode . dired-mode))
767 ("org" (mode . org-mode))
770 (mode . gnus-group-mode)
771 (mode . gnus-summary-mode)
772 (mode . gnus-article-mode)
773 ;; not really, but...
774 (mode . message-mode)))
792 (mode . emacs-lisp-mode)
794 (mode . haskell-mode)
797 (mode . alloy-mode)))
801 (mode . latex-mode)))
804 (name . "^\\*scratch\\*$")
805 (name . "^\\*Messages\\*$")))
806 ("erc" (mode . erc-mode)))))
808 '((mark modified read-only locked " "
809 (name 18 18 :left :elide)
813 (mode 16 16 :left :elide)
814 " " filename-and-process)
818 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
821 :hook (prog-mode . outline-minor-mode)
824 outline-minor-mode-map
825 ("<s-tab>" . outline-toggle-children)
826 ("M-p" . outline-previous-visible-heading)
827 ("M-n" . outline-next-visible-heading)
828 :prefix-map a/outline-prefix-map
830 ("TAB" . outline-toggle-children)
831 ("a" . outline-hide-body)
832 ("H" . outline-hide-body)
833 ("S" . outline-show-all)
834 ("h" . outline-hide-subtree)
835 ("s" . outline-show-subtree)))
838 :custom (ls-lisp-dirs-first t))
842 (setq dired-listing-switches "-alh"
843 ls-lisp-use-insert-directory-program nil)
845 ;; easily diff 2 marked files
846 ;; https://oremacs.com/2017/03/18/dired-ediff/
847 (defun dired-ediff-files ()
850 (defvar ediff-after-quit-hook-internal)
851 (let ((files (dired-get-marked-files))
852 (wnd (current-window-configuration)))
853 (if (<= (length files) 2)
854 (let ((file1 (car files))
855 (file2 (if (cdr files)
859 (dired-dwim-target-directory)))))
860 (if (file-newer-than-file-p file1 file2)
861 (ediff-files file2 file1)
862 (ediff-files file1 file2))
863 (add-hook 'ediff-after-quit-hook-internal
865 (setq ediff-after-quit-hook-internal nil)
866 (set-window-configuration wnd))))
867 (error "no more than 2 files should be marked"))))
870 (setq dired-guess-shell-alist-user
871 '(("\\.pdf\\'" "evince" "zathura" "okular")
872 ("\\.doc\\'" "libreoffice")
873 ("\\.docx\\'" "libreoffice")
874 ("\\.ppt\\'" "libreoffice")
875 ("\\.pptx\\'" "libreoffice")
876 ("\\.xls\\'" "libreoffice")
877 ("\\.xlsx\\'" "libreoffice")
878 ("\\.flac\\'" "mpv")))
879 :bind (:map dired-mode-map
880 ("b" . dired-up-directory)
881 ("e" . dired-ediff-files)
882 ("E" . dired-toggle-read-only)
883 ("\\" . dired-hide-details-mode)
886 (a/dired-start-process "zathura"))))
887 :hook (dired-mode . dired-hide-details-mode))
891 (temp-buffer-resize-mode)
892 (setq help-window-select t))
896 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
897 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
898 (add-to-list 'tramp-default-proxies-alist
899 (list (regexp-quote (system-name)) nil nil)))
902 :config (dash-enable-font-lock))
904 (use-package doc-view
905 :bind (:map doc-view-mode-map
906 ("M-RET" . image-previous-line)))
911 ;; highlight uncommitted changes in the left fringe
915 (setq diff-hl-draw-borders nil)
916 (global-diff-hl-mode)
917 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
919 ;; display Lisp objects at point in the echo area
921 :when (version< "25" emacs-version)
922 :config (global-eldoc-mode))
924 ;; highlight matching parens
927 :config (show-paren-mode))
930 :config (column-number-mode))
932 ;; save minibuffer history
933 (use-feature savehist
934 :config (savehist-mode))
936 ;; automatically save place in files
937 (use-feature saveplace
938 :when (version< "25" emacs-version)
939 :config (save-place-mode))
941 (use-feature prog-mode
942 :config (global-prettify-symbols-mode)
943 (defun indicate-buffer-boundaries-left ()
944 (setq indicate-buffer-boundaries 'left))
945 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
947 (use-feature text-mode
948 :hook ((text-mode . indicate-buffer-boundaries-left)
949 (text-mode . abbrev-mode)))
951 (use-feature conf-mode
960 (:map company-active-map
961 ([tab] . company-complete-common-or-cycle)
962 ([escape] . company-abort
))
964 (company-minimum-prefix-length 1)
965 (company-selection-wrap-around t
)
966 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
967 (company-dabbrev-downcase nil
)
968 (company-dabbrev-ignore-case nil
)
970 (global-company-mode t
))
972 (use-package flycheck
974 :hook
(prog-mode . flycheck-mode
)
976 (:map flycheck-mode-map
977 ("M-P" . flycheck-previous-error
)
978 ("M-N" . flycheck-next-error
))
980 ;; Use the load-path from running Emacs when checking elisp files
981 (setq flycheck-emacs-lisp-load-path
'inherit
)
983 ;; Only flycheck when I actually save the buffer
984 (setq flycheck-check-syntax-automatically
'(mode-enabled save
)))
986 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
990 ;; ’ can be part of a word
991 (setq ispell-local-dictionary-alist
992 `((nil "[[:alpha:]]" "[^[:alpha:]]"
993 "['\x2019]" nil
("-B") nil utf-8
)))
994 ;; don't send ’ to the subprocess
995 (defun endless/replace-apostrophe
(args)
996 (cons (replace-regexp-in-string
999 (advice-add #'ispell-send-string
:filter-args
1000 #'endless
/replace-apostrophe
)
1002 ;; convert ' back to ’ from the subprocess
1003 (defun endless/replace-quote
(args)
1004 (if (not (derived-mode-p 'org-mode
))
1006 (cons (replace-regexp-in-string
1009 (advice-add #'ispell-parse-output
:filter-args
1010 #'endless
/replace-quote
))
1013 ;;; Programming modes
1015 (use-feature lisp-mode
1017 (add-hook 'emacs-lisp-mode-hook
'outline-minor-mode
)
1018 (add-hook 'emacs-lisp-mode-hook
'reveal-mode
)
1019 (defun indent-spaces-mode ()
1020 (setq indent-tabs-mode nil
))
1021 (add-hook 'lisp-interaction-mode-hook
#'indent-spaces-mode
))
1023 (use-package alloy-mode
1024 :straight
(:host github
:repo
"dwwmmn/alloy-mode")
1026 :config
(setq alloy-basic-offset
2))
1028 (use-package proof-site
; for Coq
1029 :straight proof-general
)
1031 (eval-when-compile (defvar lean-mode-map
))
1032 (use-package lean-mode
1034 :bind
(:map lean-mode-map
1035 ("S-SPC" . company-complete
))
1037 (require 'lean-input
)
1038 (setq default-input-method
"Lean"
1039 lean-input-tweak-all
'(lean-input-compose
1040 (lean-input-prepend "/")
1041 (lean-input-nonempty))
1042 lean-input-user-translations
'(("/" "/")))
1045 (use-package haskell-mode
1047 (setq haskell-indentation-layout-offset
4
1048 haskell-indentation-left-offset
4
1049 flycheck-checker
'haskell-hlint
1050 flycheck-disabled-checkers
'(haskell-stack-ghc haskell-ghc
)))
1054 :commands dante-mode
1055 :hook
(haskell-mode . dante-mode
))
1057 (use-package hlint-refactor
1059 :bind
(:map hlint-refactor-mode-map
1060 ("C-c l b" . hlint-refactor-refactor-buffer
)
1061 ("C-c l r" . hlint-refactor-refactor-at-point
))
1062 :hook
(haskell-mode . hlint-refactor-mode
))
1064 (use-package flycheck-haskell
1065 :after haskell-mode
)
1066 ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el
1068 (use-package sgml-mode
1070 (setq sgml-basic-offset
2))
1072 (use-package css-mode
1074 (setq css-indent-offset
2))
1076 (use-package web-mode
1080 web-mode-code-indent-offset
1081 web-mode-css-indent-offset
1082 web-mode-markup-indent-offset
))
1084 (use-package emmet-mode
1085 :after
(:any web-mode css-mode sgml-mode
)
1086 :bind
* (("C-)" . emmet-next-edit-point
)
1087 ("C-(" . emmet-prev-edit-point
))
1089 (unbind-key "C-j" emmet-mode-keymap
)
1090 (setq emmet-move-cursor-between-quotes t
)
1091 :hook
(web-mode css-mode html-mode sgml-mode
))
1094 (use-package meghanada
1096 (:map meghanada-mode-map
1097 (("C-M-o" . meghanada-optimize-import
)
1098 ("C-M-t" . meghanada-import-all
)))
1099 :hook
(java-mode . meghanada-mode
)))
1102 (use-package treemacs
1103 :config
(setq treemacs-never-persist t
))
1105 (use-package yasnippet
1107 ;; (yas-global-mode)
1110 (use-package lsp-mode
1111 :init
(setq lsp-eldoc-render-all nil
1112 lsp-highlight-symbol-at-point nil
)
1117 (use-package company-lsp
1120 (setq company-lsp-cache-candidates t
1121 company-lsp-async t
))
1125 (setq lsp-ui-sideline-update-mode
'point
))
1127 (use-package lsp-java
1129 (add-hook 'java-mode-hook
1131 (setq-local company-backends
(list 'company-lsp
))))
1133 (add-hook 'java-mode-hook
'lsp-java-enable
)
1134 (add-hook 'java-mode-hook
'flycheck-mode
)
1135 (add-hook 'java-mode-hook
'company-mode
)
1136 (add-hook 'java-mode-hook
'lsp-ui-mode
))
1138 (use-package dap-mode
1144 (use-package dap-java
1147 (use-package lsp-java-treemacs
1152 :bind
(:map eclim-mode-map
("S-SPC" . company-complete
))
1153 :hook
((java-mode . eclim-mode
)
1154 (eclim-mode .
(lambda ()
1155 (make-local-variable 'company-idle-delay
)
1156 (defvar company-idle-delay
)
1157 ;; (setq company-idle-delay 0.7)
1158 (setq company-idle-delay nil
))))
1160 (eclim-auto-save nil
)
1161 ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp")
1162 (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim")
1163 (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse"))))
1165 (use-package geiser
)
1167 (use-feature geiser-guile
1169 (setq geiser-guile-load-path
"~/src/git/guix"))
1176 (font-latex-fontify-sectioning 'color
)))
1178 (use-package go-mode
)
1183 (add-to-list 'custom-theme-load-path
"~/.emacs.d/lisp")
1184 (load-theme 'tangomod t
)
1186 (use-package smart-mode-line
1187 :commands
(sml/apply-theme
)
1192 (use-package doom-themes
)
1194 (defvar a
/org-mode-font-lock-keywords
1195 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1196 (1 '(:foreground
"#5a5b5a" :background
"#292b2b") t
) ; directive
1197 (3 '(:foreground
"#81a2be" :background
"#292b2b") t
) ; kind
1198 (4 '(:foreground
"#c5c8c6") t
)))) ; title
1200 (defun a/lights-on
()
1201 "Enable my favourite light theme."
1203 (mapc #'disable-theme custom-enabled-themes
)
1204 (load-theme 'tangomod t
)
1205 (sml/apply-theme
'automatic
)
1206 (font-lock-remove-keywords
1207 'org-mode a
/org-mode-font-lock-keywords
))
1209 (defun a/lights-off
()
1212 (mapc #'disable-theme custom-enabled-themes
)
1213 (load-theme 'doom-tomorrow-night t
)
1214 (sml/apply-theme
'automatic
)
1215 (font-lock-add-keywords
1216 'org-mode a
/org-mode-font-lock-keywords t
))
1219 ("s-t d" . a
/lights-off
)
1220 ("s-t l" . a
/lights-on
))
1223 ;;; Emacs enhancements & auxiliary packages
1226 :config
(setq Man-width
80))
1228 (use-package which-key
1231 (which-key-add-key-based-replacements
1232 ;; prefixes for global prefixes and minor modes
1236 "C-c 8 -" "typo/dashes"
1237 "C-c 8 <" "typo/left-brackets"
1238 "C-c 8 >" "typo/right-brackets"
1240 "C-x a" "abbrev/expand"
1241 "C-x r" "rectangle/register/bookmark"
1242 "C-x v" "version control"
1243 ;; prefixes for my personal bindings
1244 "C-c a" "applications"
1248 "C-c p" "package-management"
1249 ;; "C-c p e" "package-management/epkg"
1250 "C-c p s" "straight.el"
1253 "C-c c" "compile-and-comments"
1258 "C-c m" "multiple-cursors"
1259 "C-c P" "projectile"
1260 "C-c P s" "projectile/search"
1261 "C-c P x" "projectile/execute"
1262 "C-c P 4" "projectile/other-window"
1268 ;; prefixes for major modes
1269 (which-key-add-major-mode-key-based-replacements 'message-mode
1271 (which-key-add-major-mode-key-based-replacements 'org-mode
1272 "C-c C-v" "org-babel")
1273 (which-key-add-major-mode-key-based-replacements 'web-mode
1274 "C-c C-a" "web/attributes"
1275 "C-c C-b" "web/blocks"
1277 "C-c C-e" "web/element"
1278 "C-c C-t" "web/tags")
1282 (which-key-add-column-padding 5)
1283 (which-key-max-description-length 32))
1285 (use-package crux
; results in Waiting for git... [2 times]
1287 :bind
(("C-c b k" . crux-kill-other-buffers
)
1288 ("C-c d" . crux-duplicate-current-line-or-region
)
1289 ("C-c D" . crux-duplicate-and-comment-current-line-or-region
)
1290 ("C-c f c" . crux-copy-file-preserve-attributes
)
1291 ("C-c f d" . crux-delete-file-and-buffer
)
1292 ("C-c f r" . crux-rename-file-and-buffer
)
1293 ("C-c j" . crux-top-join-line
)
1294 ("C-S-j" . crux-top-join-line
)))
1297 :bind
(("C-a" . mwim-beginning-of-code-or-line
)
1298 ("C-e" . mwim-end-of-code-or-line
)
1299 ("<home>" . mwim-beginning-of-line-or-code
)
1300 ("<end>" . mwim-end-of-line-or-code
)))
1302 (use-package projectile
1303 :bind-keymap
("C-c P" . projectile-command-map
)
1307 (defun my-projectile-invalidate-cache (&rest _args
)
1308 ;; ignore the args to `magit-checkout'
1309 (projectile-invalidate-cache nil
))
1311 (eval-after-load 'magit-branch
1313 (advice-add 'magit-checkout
1314 :after
#'my-projectile-invalidate-cache
)
1315 (advice-add 'magit-branch-and-checkout
1316 :after
#'my-projectile-invalidate-cache
)))
1317 :custom
(projectile-completion-system 'ivy
))
1319 (use-package helpful
1322 (("C-S-h c" . helpful-command
)
1323 ("C-S-h f" . helpful-callable
) ; helpful-function
1324 ("C-S-h v" . helpful-variable
)
1325 ("C-S-h k" . helpful-key
)
1326 ("C-S-h p" . helpful-at-point
)))
1328 (use-package unkillable-scratch
1331 (unkillable-scratch 1)
1333 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
1336 ;; | make pretty boxed quotes like this
1338 (use-package boxquote
1341 (:prefix-map a
/boxquote-prefix-map
1343 ("b" . boxquote-buffer
)
1344 ("B" . boxquote-insert-buffer
)
1345 ("d" . boxquote-defun
)
1346 ("F" . boxquote-insert-file
)
1347 ("hf" . boxquote-describe-function
)
1348 ("hk" . boxquote-describe-key
)
1349 ("hv" . boxquote-describe-variable
)
1350 ("hw" . boxquote-where-is
)
1351 ("k" . boxquote-kill
)
1352 ("p" . boxquote-paragraph
)
1353 ("q" . boxquote-boxquote
)
1354 ("r" . boxquote-region
)
1355 ("s" . boxquote-shell-command
)
1356 ("t" . boxquote-text
)
1357 ("T" . boxquote-title
)
1358 ("u" . boxquote-unbox
)
1359 ("U" . boxquote-unbox-region
)
1360 ("y" . boxquote-yank
)
1361 ("M-q" . boxquote-fill-paragraph
)
1362 ("M-w" . boxquote-kill-ring-save
)))
1364 (use-package orgalist
1365 ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
1368 :hook
(message-mode . orgalist-mode
))
1370 ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹›
1374 (typo-global-mode 1)
1375 :hook
(text-mode . typo-mode
))
1377 ;; highlight TODOs in buffers
1378 (use-package hl-todo
1381 (global-hl-todo-mode))
1383 (use-package shrink-path
1387 (defvar user-
@-host
(concat (user-login-name) "@" (system-name) " "))
1388 (defun +eshell
/prompt
()
1389 (let ((base/dir
(shrink-path-prompt default-directory
)))
1390 (concat (propertize user-
@-host
'face
'default
)
1391 (propertize (car base
/dir
)
1392 'face
'font-lock-comment-face
)
1393 (propertize (cdr base
/dir
)
1394 'face
'font-lock-constant-face
)
1395 (propertize "> " 'face
'default
))))
1396 (setq eshell-prompt-regexp
(concat user-
@-host
".*> ")
1397 eshell-prompt-function
#'+eshell
/prompt
))
1399 (use-package eshell-up
1401 :commands eshell-up
)
1403 (use-package multi-term
1405 :bind
(("C-c a s m m" . multi-term
)
1406 ("C-c a s m d" . multi-term-dedicated-toggle
)
1407 ("C-c a s m p" . multi-term-prev
)
1408 ("C-c a s m n" . multi-term-next
)
1410 ("C-c C-j" . term-char-mode
))
1412 (setq multi-term-program
"screen"
1413 multi-term-program-switches
(concat "-c"
1414 (getenv "XDG_CONFIG_HOME")
1416 ;; TODO: add separate bindings for connecting to existing
1417 ;; session vs. always creating a new one
1418 multi-term-dedicated-select-after-open-p t
1419 multi-term-dedicated-window-height
20
1420 multi-term-dedicated-max-window-height
30
1422 '(("C-c C-c" . term-interrupt-subjob
)
1423 ("C-c C-e" . term-send-esc
)
1424 ("C-c C-j" . term-line-mode
)
1426 ;; ("C-y" . term-paste)
1427 ("C-y" . term-send-raw
)
1428 ("M-f" . term-send-forward-word
)
1429 ("M-b" . term-send-backward-word
)
1430 ("M-p" . term-send-up
)
1431 ("M-n" . term-send-down
)
1432 ("M-j" . term-send-raw-meta
)
1433 ("M-y" . term-send-raw-meta
)
1434 ("M-/" . term-send-raw-meta
)
1435 ("M-0" . term-send-raw-meta
)
1436 ("M-1" . term-send-raw-meta
)
1437 ("M-2" . term-send-raw-meta
)
1438 ("M-3" . term-send-raw-meta
)
1439 ("M-4" . term-send-raw-meta
)
1440 ("M-5" . term-send-raw-meta
)
1441 ("M-6" . term-send-raw-meta
)
1442 ("M-7" . term-send-raw-meta
)
1443 ("M-8" . term-send-raw-meta
)
1444 ("M-9" . term-send-raw-meta
)
1445 ("<C-backspace>" . term-send-backward-kill-word
)
1446 ("<M-DEL>" . term-send-backward-kill-word
)
1447 ("M-d" . term-send-delete-word
)
1448 ("M-," . term-send-raw
)
1449 ("M-." . comint-dynamic-complete
))
1450 term-unbind-key-alist
1451 '("C-z" "C-x" "C-c" "C-h"
1455 (use-package page-break-lines
1458 (global-page-break-lines-mode))
1460 (use-package expand-region
1461 :bind
("C-=" . er
/expand-region
))
1463 (use-package multiple-cursors
1465 (("C-S-<mouse-1>" . mc
/add-cursor-on-click
)
1466 (:prefix-map a
/mc-prefix-map
1468 ("c" . mc
/edit-lines
)
1469 ("n" . mc
/mark-next-like-this
)
1470 ("p" . mc
/mark-previous-like-this
)
1471 ("a" . mc
/mark-all-like-this
))))
1477 (use-package yasnippet
1480 (defconst yas-verbosity-cur yas-verbosity
)
1481 (setq yas-verbosity
2)
1482 (add-to-list 'yas-snippet-dirs
"~/src/git/guix/etc/snippets")
1484 (setq yas-verbosity yas-verbosity-cur
)
1486 (text-mode . yas-minor-mode
))
1488 (use-package debbugs
1491 :repo
"emacs-straight/debbugs"
1492 :files
(:defaults
"Debbugs.wsdl")))
1494 (use-package org-ref
1496 (a/setq-every
'("~/usr/org/references.bib")
1497 reftex-default-bibliography
1498 org-ref-default-bibliography
)
1500 org-ref-bibliography-notes
"~/usr/org/notes.org"
1501 org-ref-pdf-directory
"~/usr/org/bibtex-pdfs/"))
1505 :init
(setq alert-default-style
'notifications
))
1507 (use-package ivy-xref
1509 (setq xref-show-xrefs-function
#'ivy-xref-show-xrefs
))
1512 ;;; Email (with Gnus)
1514 (defvar a
/maildir
(expand-file-name "~/mail/"))
1515 (with-eval-after-load 'recentf
1516 (add-to-list 'recentf-exclude a
/maildir
))
1519 a
/gnus-init-file
(no-littering-expand-etc-file-name "gnus")
1520 mail-user-agent
'gnus-user-agent
1521 read-mail-command
'gnus
)
1524 :bind
(("s-m" . gnus
)
1525 ("s-M" . gnus-unplugged
))
1528 gnus-select-method
'(nnnil "")
1529 gnus-secondary-select-methods
1531 (nnimap-stream plain
)
1532 (nnimap-address "127.0.0.1")
1533 (nnimap-server-port 143)
1534 (nnimap-authenticator plain
)
1535 (nnimap-user "amin@bndl.local"))
1537 (nnimap-stream plain
)
1538 (nnimap-address "127.0.0.1")
1539 (nnimap-server-port 143)
1540 (nnimap-authenticator plain
)
1541 (nnimap-user "bandali@gnu.local")
1542 (nnimap-inbox "INBOX")
1543 (nnimap-split-methods 'nnimap-split-fancy
)
1544 (nnimap-split-fancy (|
1545 (: gnus-registry-split-fancy-with-parent
)
1546 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1548 (list ".*emacs-devel.gnu.org" "l.gnu.emacs.devel")
1549 (list ".*help-gnu-emacs.gnu.org" "l.gnu.emacs.help")
1550 (list ".*info-gnu-emacs.gnu.org" "l.gnu.emacs.info")
1551 (list ".*emacs-orgmode.gnu.org" "l.gnu.emacs.orgmode")
1552 (list ".*emacsconf-discuss.gnu.org" "l.gnu.emacsconf.discuss")
1553 (list ".*fencepost-users.gnu.org" "l.gnu.fencepost.users")
1554 (list ".*gnunet-developers.gnu.org" "l.gnu.gnunet.developers")
1555 (list ".*help-gnunet.gnu.org" "l.gnu.gnunet.help")
1556 (list ".*bug-gnuzilla.gnu.org" "l.gnu.gnuzilla.bug")
1557 (list ".*gnuzilla-dev.gnu.org" "l.gnu.gnuzilla.dev")
1558 (list ".*guile-devel.gnu.org" "l.gnu.guile.devel")
1559 (list ".*guix-devel.gnu.org" "l.gnu.guix.devel")
1560 (list ".*info-guix.gnu.org" "l.gnu.guix.info")
1561 (list ".*www-commits.gnu.org" "l.gnu.www.commits")
1562 (list ".*www-discuss.gnu.org" "l.gnu.www.discuss")
1564 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1566 (list ".*haskell-art.we.lurk.org" "l.haskell.art")
1567 (list ".*haskell-cafe.haskell.org" "l.haskell.cafe")
1569 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1570 (list ".*notmuch.notmuchmail.org" "l.notmuch")
1571 (list ".*dev.lists.parabola.nu" "l.parabola.dev")
1573 (list ".*~bandali/public-inbox@lists.sr.ht" "l.~bandali.public-inbox")
1574 (list ".*~sircmpwn/sr.ht-admins@lists.sr.ht" "l.~sircmpwn.srht.admins")
1575 (list ".*~sircmpwn/sr.ht-announce@lists.sr.ht" "l.~sircmpwn.srht.announce")
1576 (list ".*~sircmpwn/sr.ht-dev@lists.sr.ht" "l.~sircmpwn.srht.dev")
1577 (list ".*~sircmpwn/sr.ht-discuss@lists.sr.ht" "l.~sircmpwn.srht.discuss")
1580 (nnimap-stream plain
)
1581 (nnimap-address "127.0.0.1")
1582 (nnimap-server-port 143)
1583 (nnimap-authenticator plain
)
1584 (nnimap-user "abandali@uw.local"))
1586 (nnimap-stream plain
)
1587 (nnimap-address "127.0.0.1")
1588 (nnimap-server-port 143)
1589 (nnimap-authenticator plain
)
1590 (nnimap-user "abandali@csc.uw.local")))
1591 gnus-message-archive-group
"nnimap+amin:Sent"
1594 (to-address .
"deepspec@lists.cs.princeton.edu")
1595 (to-list .
"deepspec@lists.cs.princeton.edu")
1596 (list-identifier .
"\\[deepspec\\]"))
1597 ("l\\.gnu\\.emacs\\.devel"
1598 (to-address .
"emacs-devel@gnu.org")
1599 (to-list .
"emacs-devel@gnu.org"))
1600 ("l\\.gnu\\.emacs\\.help"
1601 (to-address .
"help-gnu-emacs@gnu.org")
1602 (to-list .
"help-gnu-emacs@gnu.org"))
1603 ("l\\.gnu\\.emacs\\.info"
1604 (to-address .
"info-gnu-emacs@gnu.org")
1605 (to-list .
"info-gnu-emacs@gnu.org"))
1606 ("l\\.gnu\\.emacs\\.orgmode"
1607 (to-address .
"emacs-orgmode@gnu.org")
1608 (to-list .
"emacs-orgmode@gnu.org")
1609 (list-identifier .
"\\[O\\]"))
1610 ("l\\.gnu\\.emacsconf\\.discuss"
1611 (to-address .
"emacsconf-discuss@gnu.org")
1612 (to-list .
"emacsconf-discuss@gnu.org"))
1613 ("l\\.gnu\\.fencepost\\.users"
1614 (to-address .
"fencepost-users@gnu.org")
1615 (to-list .
"fencepost-users@gnu.org")
1616 (list-identifier .
"\\[Fencepost-users\\]"))
1617 ("l\\.gnu\\.gnunet\\.developers"
1618 (to-address .
"gnunet-developers@gnu.org")
1619 (to-list .
"gnunet-developers@gnu.org")
1620 (list-identifier .
"\\[GNUnet-developers\\]"))
1621 ("l\\.gnu\\.gnunet\\.help"
1622 (to-address .
"help-gnunet@gnu.org")
1623 (to-list .
"help-gnunet@gnu.org")
1624 (list-identifier .
"\\[Help-gnunet\\]"))
1625 ("l\\.gnu\\.gnuzilla\\.bug"
1626 (to-address .
"bug-gnuzilla@gnu.org")
1627 (to-list .
"bug-gnuzilla@gnu.org")
1628 (list-identifier .
"\\[Bug-gnuzilla\\]"))
1629 ("l\\.gnu\\.gnuzilla\\.dev"
1630 (to-address .
"gnuzilla-dev@gnu.org")
1631 (to-list .
"gnuzilla-dev@gnu.org")
1632 (list-identifier .
"\\[Gnuzilla-dev\\]"))
1633 ("l\\.gnu\\.guile\\.devel"
1634 (to-address .
"guile-devel@gnu.org")
1635 (to-list .
"guile-devel@gnu.org"))
1636 ("l\\.gnu\\.guix\\.devel"
1637 (to-address .
"guix-devel@gnu.org")
1638 (to-list .
"guix-devel@gnu.org"))
1639 ("l\\.gnu\\.guix\\.info"
1640 (to-address .
"info-guix@gnu.org")
1641 (to-list .
"info-guix@gnu.org"))
1642 ("l\\.gnu\\.www\\.commits"
1643 (to-address .
"www-commits@gnu.org")
1644 (to-list .
"www-commits@gnu.org"))
1645 ("l\\.gnu\\.www\\.discuss"
1646 (to-address .
"www-discuss@gnu.org")
1647 (to-list .
"www-discuss@gnu.org"))
1648 ("l\\.haskell\\.art"
1649 (to-address .
"haskell-art@we.lurk.org")
1650 (to-list .
"haskell-art@we.lurk.org")
1651 (list-identifier .
"\\[haskell-art\\]"))
1652 ("l\\.haskell\\.cafe"
1653 (to-address .
"haskell-cafe@haskell.org")
1654 (to-list .
"haskell-cafe@haskell.org")
1655 (list-identifier .
"\\[Haskell-cafe\\]"))
1657 (to-address .
"notmuch@notmuchmail.org")
1658 (to-list .
"notmuch@notmuchmail.org"))
1659 ("l\\.parabola\\.dev"
1660 (to-address .
"dev@lists.parabola.nu")
1661 (to-list .
"dev@lists.parabola.nu")
1662 (list-identifier .
"\\[Dev\\]"))
1663 ("l\\.~bandali\\.public-inbox"
1664 (to-address .
"~bandali/public-inbox@lists.sr.ht")
1665 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
1666 ("l\\.~sircmpwn\\.srht\\.admins"
1667 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
1668 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
1669 ("l\\.~sircmpwn\\.srht\\.announce"
1670 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
1671 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
1672 ("l\\.~sircmpwn\\.srht\\.dev"
1673 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
1674 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
1675 ("l\\.~sircmpwn\\.srht\\.discuss"
1676 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
1677 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
1679 (to-address .
"webmasters@gnu.org")
1680 (to-list .
"webmasters@gnu.org"))
1687 gnus-large-newsgroup
50
1688 gnus-home-directory
(no-littering-expand-var-file-name "gnus/")
1689 gnus-directory
(concat gnus-home-directory
"news/")
1690 message-directory
(concat gnus-home-directory
"mail/")
1691 nndraft-directory
(concat gnus-home-directory
"drafts/")
1692 gnus-save-newsrc-file nil
1693 gnus-read-newsrc-file nil
1694 gnus-interactive-exit nil
1695 gnus-gcc-mark-as-read t
)
1699 (require 'ebdb-gnus
)
1701 (gnus-registry-initialize)
1703 (with-eval-after-load 'recentf
1704 (add-to-list 'recentf-exclude gnus-home-directory
)))
1706 (use-feature gnus-art
1709 gnus-visible-headers
1710 (concat gnus-visible-headers
"\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
1711 gnus-sorted-header-list
1712 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
1713 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
1714 "^Newsgroups:" "List-Id:" "^Organization:"
1715 "^User-Agent:" "^Date:")
1716 ;; local-lapsed article dates
1717 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1718 gnus-article-date-headers
'(user-defined)
1719 gnus-article-time-format
1721 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
1722 (local (article-make-date-line date
'local
))
1723 (combined-lapsed (article-make-date-line date
1726 (string-match " (.+" combined-lapsed
)
1727 (match-string 0 combined-lapsed
))))
1728 (concat local lapsed
))))
1730 :map gnus-article-mode-map
1731 ("M-L" . org-store-link
)))
1733 (use-feature gnus-sum
1734 :bind
(:map gnus-summary-mode-map
1735 :prefix-map a
/gnus-summary-prefix-map
1737 ("r" . gnus-summary-reply
)
1738 ("w" . gnus-summary-wide-reply
)
1739 ("v" . gnus-summary-show-raw-article
))
1742 :map gnus-summary-mode-map
1743 ("M-L" . org-store-link
))
1744 :hook
(gnus-summary-mode . a
/no-mouse-autoselect-window
))
1746 (use-feature gnus-msg
1748 (defvar a
/gnu-signature
"Amin Bandali | GNU Webmaster
1749 https://bandali.eu.org | https://gnu.org
1750 GPG Key: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103")
1751 (defvar a
/uw-signature
"Amin Bandali, MMath Student
1752 Cheriton School of Computer Science
1753 University of Waterloo
1754 https://bandali.eu.org")
1755 (defvar a
/csc-signature
"Amin Bandali | Termcom, CSC
1756 https://csclub.uwaterloo.ca/~abandali/")
1757 (setq gnus-posting-styles
1759 (address "amin@bndl.org")
1761 (eval (setq a
/message-cite-say-hi t
)))
1763 (address "bandali@gnu.org")
1764 (signature a
/gnu-signature
)
1765 (eval (set (make-local-variable 'message-user-fqdn
) "fencepost.gnu.org")))
1766 ((header "subject" "ThankCRM")
1767 (to "webmasters-comment@gnu.org")
1768 (body "Added to 2019supporters.html.\n\nMoving to campaigns.\n")
1769 (eval (setq a
/message-cite-say-hi nil
)))
1771 (address "abandali@uwaterloo.ca")
1772 (signature a
/uw-signature
))
1773 ("nnimap\\+uw:INBOX"
1774 (gcc "\"nnimap+uw:Sent Items\""))
1776 (address "abandali@csclub.uwaterloo.ca")
1777 (signature a
/csc-signature
)
1778 (gcc "nnimap+csc:Sent")))))
1780 (use-feature gnus-topic
1781 :hook
(gnus-group-mode . gnus-topic-mode
)
1782 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
1784 (use-feature gnus-agent
1786 (setq gnus-agent-synchronize-flags
'ask
)
1787 :hook
(gnus-group-mode . gnus-agent-mode
))
1789 (use-feature gnus-group
1791 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
1794 ;; problematic with ebdb's popup, *EBDB-Gnus*
1795 (use-feature gnus-win
1797 (setq gnus-use-full-window nil
)))
1799 (use-feature gnus-dired
1800 :commands gnus-dired-mode
1802 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
1804 (use-feature mm-decode
1806 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")))
1808 (use-feature sendmail
1810 (setq sendmail-program
"/usr/bin/msmtp"
1811 ;; message-sendmail-extra-arguments '("-v" "-d")
1812 mail-specify-envelope-from t
1813 mail-envelope-from
'header
))
1815 (use-feature message
1817 ;; redefine for a simplified In-Reply-To header
1818 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
1819 (defun message-make-in-reply-to ()
1820 "Return the In-Reply-To header for this message."
1821 (when message-reply-headers
1822 (let ((from (mail-header-from message-reply-headers
))
1823 (msg-id (mail-header-id message-reply-headers
)))
1827 (defconst a
/message-cite-style-format
"On %Y-%m-%d %l:%M %p, %N wrote:")
1828 (defconst message-cite-style-bandali
1829 '((message-cite-function 'message-cite-original
)
1830 (message-citation-line-function 'message-insert-formatted-citation-line
)
1831 (message-cite-reply-position 'traditional
)
1832 (message-yank-prefix "> ")
1833 (message-yank-cited-prefix ">")
1834 (message-yank-empty-prefix ">")
1835 (message-citation-line-format
1836 (if a
/message-cite-say-hi
1837 (concat "Hi %F,\n\n" a
/message-cite-style-format
)
1838 a
/message-cite-style-format
)))
1839 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
1840 (setq ;; message-cite-style 'message-cite-style-bandali
1841 message-kill-buffer-on-exit t
1842 message-send-mail-function
'message-send-mail-with-sendmail
1843 message-sendmail-envelope-from
'header
1844 message-subscribed-address-functions
1845 '(gnus-find-subscribed-addresses)
1846 message-dont-reply-to-names
1847 "\\(\\(amin@bndl\\.org\\)\\|\\(.*@\\(aminb\\|amin\\.bndl\\)\\.org\\)\\|\\(\\(bandali\\|aminb?\\|mab\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
1848 (require 'company-ebdb
)
1849 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
1850 (message-mode . flyspell-mode
)
1851 (message-mode .
(lambda ()
1852 ;; (setq fill-column 65
1853 ;; message-fill-column 65)
1854 (make-local-variable 'company-idle-delay
)
1855 (setq company-idle-delay
0.2))))
1857 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
1858 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
1859 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
1862 (with-eval-after-load 'mml-sec
1863 (setq mml-secure-openpgp-encrypt-to-self t
1864 mml-secure-openpgp-sign-with-sender t
))
1866 (use-feature footnote
1869 ;; (setq footnote-start-tag ""
1870 ;; footnote-end-tag ""
1871 ;; footnote-style 'unicode)
1873 (:map message-mode-map
1874 :prefix-map a
/footnote-prefix-map
1876 ("a" . footnote-add-footnote
)
1877 ("b" . footnote-back-to-message
)
1878 ("c" . footnote-cycle-style
)
1879 ("d" . footnote-delete-footnote
)
1880 ("g" . footnote-goto-footnote
)
1881 ("r" . footnote-renumber-footnotes
)
1882 ("s" . footnote-set-style
)))
1885 :straight
(:host github
:repo
"girzel/ebdb")
1887 :bind
(:map gnus-group-mode-map
("e" . ebdb
))
1889 (setq ebdb-sources
(no-littering-expand-var-file-name "ebdb"))
1890 (with-eval-after-load 'swiper
1891 (add-to-list 'swiper-font-lock-exclude
'ebdb-mode t
)))
1893 (use-feature ebdb-com
1896 ;; (use-package ebdb-complete
1899 ;; (ebdb-complete-enable))
1901 (use-package company-ebdb
1903 (defun company-ebdb--post-complete (_) nil
))
1905 (use-feature ebdb-gnus
1908 (ebdb-gnus-window-configuration
1911 (summary 0.25 point
)
1914 (ebdb-gnus 0.3))))))
1916 (use-feature ebdb-mua
1918 ;; :custom (ebdb-mua-pop-up nil)
1921 ;; (use-package ebdb-message
1925 ;; (use-package ebdb-vcard
1928 (use-package message-x
)
1931 (use-package message-x
1933 (message-x-completion-alist
1935 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
1938 (quote message-newgroups-header-regexp
))
1939 message-newgroups-header-regexp message-newsgroups-header-regexp
)
1940 . message-expand-group
))))))
1943 (use-package gnus-harvest
1944 :commands gnus-harvest-install
1947 (if (featurep 'message-x
)
1948 (gnus-harvest-install 'message-x
)
1949 (gnus-harvest-install))))
1955 :straight
(:host nil
:repo
"https://git.bndl.org/amin/znc.el")
1956 :bind
(("C-c a e e" . znc-erc
)
1957 ("C-c a e a" . znc-all
))
1959 (let ((pwd (let ((auth (auth-source-search :host
"znca")))
1961 ((null auth
) (error "Couldn't find znca's authinfo"))
1962 (t (funcall (plist-get (car auth
) :secret
)))))))
1964 `(("znc.bndl.org" 1337 t
1965 ((freenode "amin/freenode" ,pwd
)))
1966 ("znc.bndl.org" 1337 t
1967 ((moznet "amin/moznet" ,pwd
)))))))
1970 ;;; Post initialization
1972 (message "Loading %s...done (%.3fs)" user-init-file
1973 (float-time (time-subtract (current-time)
1974 a
/before-user-init-time
)))
1976 ;;; init.el ends here