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
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
)))
66 ;; increase number of lines kept in *Messages* log
67 (setq message-log-max
20000)
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))
77 (setq user-full-name
"Amin Bandali"
78 user-mail-address
"amin@bndl.org")
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
))
90 ;;; Package management
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)
97 (not (featurep 'straight
))
98 (version< emacs-version
"27"))
99 (setq package-enable-at-startup nil
)
100 ;; (package-initialize)
103 ;; for emacs 27 and later, we use early-init.el. see
104 ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b
108 ;; Main engine start...
110 (setq straight-repository-branch
"develop"
111 straight-check-for-modifications
'(check-on-save find-when-checking
))
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
)
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
)))
127 ;; Solid rocket booster ignition...
129 (a/bootstrap-straight
)
133 (setq straight-use-package-by-default t
)
135 (defmacro use-feature
(name &rest args
)
136 "Like `use-package', but with `straight-use-package-by-default' disabled."
137 (declare (indent defun
))
142 (with-eval-after-load 'recentf
143 (add-to-list 'recentf-exclude
144 (expand-file-name "~/.emacs.d/straight/build/")))
146 (defun a/reload-init
()
149 (straight-transaction
150 (straight-mark-transaction-as-init)
151 (load user-init-file
)))
154 (straight-use-package 'use-package
)
155 (if nil
; set to t when need to debug init
157 (setq use-package-verbose t
158 use-package-expand-minimally nil
159 use-package-compute-statistics t
161 (require 'use-package
))
162 (setq use-package-verbose nil
163 use-package-expand-minimally t
))
165 (setq use-package-always-defer t
)
168 ;; for browsing the Emacsmirror package database
171 :commands
(epkg-list-packages epkg-describe-package
)
173 (("C-c p e d" . epkg-describe-package
)
174 ("C-c p e p" . epkg-list-packages
))
176 (setq epkg-repository
"~/.emacs.d/straight/repos/epkgs/")
177 (eval-when-compile (defvar ivy-initial-inputs-alist
))
178 (with-eval-after-load 'ivy
180 'ivy-initial-inputs-alist
'(epkg-describe-package .
"^") t
))))
185 ;; keep ~/.emacs.d clean
186 (use-package no-littering
190 (add-to-list 'savehist-additional-variables
'kill-ring
)
192 (setq auto-save-file-name-transforms
193 `((".*" ,(no-littering-expand-var-file-name "auto-save/") t
))))
195 ;; separate custom file (don't want it mixing with init.el)
199 (setq custom-file
(no-littering-expand-etc-file-name "custom.el"))
200 (when (file-exists-p custom-file
)
202 ;; while at it, treat themes as safe
203 (setf custom-safe-themes t
))
205 ;; load the secrets file if it exists, otherwise show a warning
207 (load (no-littering-expand-etc-file-name "secrets")))
209 ;; better $PATH (and other environment variable) handling
210 (use-package exec-path-from-shell
213 (setq exec-path-from-shell-arguments nil
214 exec-path-from-shell-check-startup-files nil
)
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"))
221 ;; only one custom theme at a time
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
)))
227 ;; start up emacs server. see
228 ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server
231 :config
(or (server-running-p) (server-mode)))
235 (dolist (ft (fontset-list))
239 (font-spec :name
"Source Code Pro" :size
14))
243 (font-spec :name
"DejaVu Sans Mono")
250 ;; :name "Symbola monospacified for DejaVu Sans Mono")
256 ;; (font-spec :name "DejaVu Sans Mono")
262 (font-spec :name
"DejaVu Sans Mono" :size
14)
266 ;; gentler font resizing
267 (setq text-scale-mode-step
1.05)
269 ;; focus follows mouse
270 (setq mouse-autoselect-window t
)
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
))
279 (setq ;; scroll-margin 1
280 ;; scroll-conservatively 10000
282 scroll-conservatively
10
283 scroll-preserve-screen-position
1)
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
292 (use-feature pixel-scroll
294 :config
(pixel-scroll-mode 1))
296 ;; ask for GPG passphrase in minibuffer
297 (setq epg-pinentry-mode
'loopback
)
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
)))
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
)))
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
325 (remove nil
(list args
(dired-get-file-for-visit)))))
327 (defun a/add-elisp-section
()
331 (insert "\n\f\n;;; "))
336 ;; time and battery in mode-line
340 (setq display-time-default-load-average nil
)
346 (display-battery-mode)))
349 ;; (fringe-mode '(3 . 1))
352 ;; disable disabled commands
353 (setq disabled-command-function nil
)
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
)
362 (setq enable-recursive-minibuffers t
363 resize-mini-windows t
)
365 ;; lazy-person-friendly yes/no prompts
366 (defalias 'yes-or-no-p
#'y-or-n-p
)
368 ;; i want *scratch* as my startup buffer
369 (setq initial-buffer-choice t
)
371 ;; i don't need the default hint
372 (setq initial-scratch-message nil
)
374 ;; use customizable text-mode as major mode for *scratch*
375 (setq initial-major-mode
'text-mode
)
377 ;; inhibit buffer list when more than 2 files are loaded
378 (setq inhibit-startup-buffer-menu t
)
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
)
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))
392 ;; backups (C-h v make-backup-files RET)
393 (setq backup-by-copying t
395 delete-old-versions t
)
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
)
402 ;; always use space for indentation
405 require-final-newline t
408 ;; enable winner-mode (C-h f winner-mode RET)
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
))
420 (setq compilation-finish-functions
#'a
/compilation-finish-function
)
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
))
431 (ad-activate 'compilation-start
))
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)
442 (setq-default cursor-type
'bar
)
444 ;; allow scrolling in Isearch
445 (setq isearch-allow-scroll t
)
453 ("C-c e b" . eval-buffer
)
454 ("C-c e r" . eval-region
)
456 ("C-c e i" . emacs-init-time
)
457 ("C-c e u" . emacs-uptime
)
459 ("C-c F m" . make-frame-command
)
460 ("C-c F d" . delete-frame
)
461 ("C-c F D" . delete-other-frames
)
463 ("C-c o" . other-window
)
465 ("C-S-h C" . describe-char
)
466 ("C-S-h F" . describe-face
)
468 ("C-x k" . kill-this-buffer
)
469 ("C-x K" . kill-buffer
)
471 ("s-p" . beginning-of-buffer
)
472 ("s-n" . end-of-buffer
)
474 :map emacs-lisp-mode-map
475 ("<C-return>" . a
/add-elisp-section
))
477 (when (display-graphic-p)
478 (unbind-key "C-z" global-map
))
481 :prefix-map a
/straight-prefix-map
483 ("u" . straight-use-package
)
484 ("f" . straight-freeze-versions
)
485 ("t" . straight-thaw-versions
)
486 ("P" . straight-prune-build
)
487 ("g" . straight-get-recipe
)
488 ("r" . a
/reload-init
)
489 ;; M-x ^straight-.*-all$
490 ("a c" . straight-check-all
)
491 ("a f" . straight-fetch-all
)
492 ("a m" . straight-merge-all
)
493 ("a n" . straight-normalize-all
)
494 ("a F" . straight-pull-all
)
495 ("a P" . straight-push-all
)
496 ("a r" . straight-rebuild-all
)
497 ;; M-x ^straight-.*-package$
498 ("p c" . straight-check-package
)
499 ("p f" . straight-fetch-package
)
500 ("p m" . straight-merge-package
)
501 ("p n" . straight-normalize-package
)
502 ("p F" . straight-pull-package
)
503 ("p P" . straight-push-package
)
504 ("p r" . straight-rebuild-package
))
507 ;;; Essential packages
509 (use-package auto-compile
512 (auto-compile-on-load-mode)
513 (auto-compile-on-save-mode)
514 (setq auto-compile-display-buffer nil
515 auto-compile-mode-line-counter t
516 auto-compile-source-recreate-deletes-dest t
517 auto-compile-toggle-deletes-nonlib-dest t
518 auto-compile-update-autoloads t
)
519 (add-hook 'auto-compile-inhibit-compile-hook
520 'auto-compile-inhibit-compile-detached-git-head
))
522 ;; use the org-plus-contrib package to get the whole deal
523 (straight-use-package 'org-plus-contrib
)
528 (setq org-src-tab-acts-natively t
529 org-src-preserve-indentation nil
530 org-edit-src-content-indentation
0
531 org-link-email-description-format
"Email %c: %s" ; %.30s
532 org-highlight-latex-and-related
'(entities)
533 org-use-speed-commands t
534 org-startup-folded
'content
535 org-catch-invisible-edits
'show-and-error
537 (add-to-list 'org-structure-template-alist
'("L" .
"src emacs-lisp") t
)
539 (("C-c a o a" . org-agenda
)
541 ("M-L" . org-insert-last-stored-link
)
543 :hook
((org-mode . org-indent-mode
)
544 (org-mode . auto-fill-mode
)
545 (org-mode . flyspell-mode
))
547 (org-agenda-files '("~/usr/org/todos/personal.org"
548 "~/usr/org/todos/masters.org"))
549 (org-agenda-start-on-weekday 0)
550 (org-latex-packages-alist '(("" "listings") ("" "color")))
552 '(org-block-begin-line ((t (:foreground
"#5a5b5a" :background
"#1d1f21"))))
553 '(org-block ((t (:background
"#1d1f21"))))
554 '(org-latex-and-related ((t (:foreground
"#b294bb")))))
556 (use-feature ox-latex
559 (setq org-latex-listings
'listings
560 ;; org-latex-prefer-user-labels t
562 (add-to-list 'org-latex-classes
563 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
564 ("\\section{%s}" .
"\\section*{%s}")
565 ("\\subsection{%s}" .
"\\subsection*{%s}")
566 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
567 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
568 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
570 (require 'ox-beamer
))
572 (use-feature ox-extra
574 (ox-extras-activate '(latex-header-blocks ignore-headlines
)))
576 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
577 ;; org file. closely inspired by
578 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
579 (with-eval-after-load 'org
580 (defvar a
/show-async-tangle-results nil
581 "Keep *emacs* async buffers around for later inspection.")
583 (defvar a
/show-async-tangle-time nil
584 "Show the time spent tangling the file.")
586 (defun a/async-babel-tangle
()
587 "Tangle org file asynchronously."
589 (let* ((file-tangle-start-time (current-time))
590 (file (buffer-file-name))
591 (file-nodir (file-name-nondirectory file
))
592 ;; (async-quiet-switch "-q")
593 (file-noext (file-name-sans-extension file
)))
597 (org-babel-tangle-file ,file
))
598 (unless a
/show-async-tangle-results
601 (message "Tangled %s%s"
603 (if a
/show-async-tangle-time
605 (float-time (time-subtract (current-time)
606 ',file-tangle-start-time
)))
608 (message "Tangling %s failed" ,file-nodir
))))))))
611 'safe-local-variable-values
612 '(eval add-hook
'after-save-hook
#'a
/async-babel-tangle
'append
'local
))
614 ;; *the* right way to do git
617 :bind
(("C-x g" . magit-status
)
618 ("s-g s" . magit-status
)
619 ("s-g l" . magit-log-buffer-file
))
621 (magit-add-section-hook 'magit-status-sections-hook
622 'magit-insert-modules
623 'magit-insert-stashes
625 (setq magit-repository-directories
'(("~/" .
0)
627 (nconc magit-section-initial-visibility-alist
628 '(([unpulled status
] . show
)
629 ([unpushed status
] . show
)))
630 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
632 ;; recently opened files
636 (add-to-list 'recentf-exclude
"^/\\(?:ssh\\|su\\|sudo\\)?:")
637 (setq recentf-max-saved-items
40))
639 ;; smart M-x enhancement (needed by counsel for history)
645 (:map ivy-minibuffer-map
646 ([escape] . keyboard-escape-quit)
647 ([S-up] . ivy-previous-history-element)
648 ([S-down] . ivy-next-history-element)
649 ("DEL" . ivy-backward-delete-char))
653 ivy-use-virtual-buffers t
654 ivy-virtual-abbreviate 'abbreviate
655 ivy-count-format "%d/%d ")
658 ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
659 ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold))))
660 ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold))))
665 :bind (("C-s" . swiper-isearch)
667 ("C-S-s" . isearch-forward)))
671 :bind (([remap execute-extended-command] . counsel-M-x)
672 ([remap find-file] . counsel-find-file)
673 ("C-c x" . counsel-M-x)
674 ("C-c f ." . counsel-find-file)
675 ("C-c f l" . counsel-find-library)
676 ("C-c f r" . counsel-recentf)
677 ("s-." . counsel-find-file)
678 ("s-r" . ivy-switch-buffer)
679 :map minibuffer-local-map
680 ("C-r" . counsel-minibuffer-history))
683 (defalias 'locate #'counsel-locate))
687 :commands (helm-M-x helm-mini helm-resume)
688 :bind (("M-x" . helm-M-x)
689 ("M-y" . helm-show-kill-ring)
690 ("C-x b" . helm-mini)
691 ("C-x C-b" . helm-buffers-list)
692 ("C-x C-f" . helm-find-files)
693 ("C-h r" . helm-info-emacs)
694 ("s-r" . helm-recentf)
695 ("C-s-r" . helm-resume)
697 ("<tab>" . helm-execute-persistent-action)
698 ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals
699 ("C-z" . helm-select-action)) ; List actions
700 :config (helm-mode 1)))
705 :bind ("C-c a s e" . eshell)
707 (eval-when-compile (defvar eshell-prompt-regexp))
708 (defun a/eshell-quit-or-delete-char (arg)
710 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
711 (eshell-life-is-too-much)
714 (defun a/eshell-clear ()
716 (let ((inhibit-read-only t))
720 (defun a/eshell-setup ()
721 (make-local-variable 'company-idle-delay)
722 (defvar company-idle-delay)
723 (setq company-idle-delay nil)
724 (bind-keys :map eshell-mode-map
725 ("C-d" . a/eshell-quit-or-delete-char)
726 ("C-S-l" . a/eshell-clear)
727 ("M-r" . counsel-esh-history)
728 ([tab] . company-complete)))
730 :hook (eshell-mode . a/eshell-setup)
732 (eshell-hist-ignoredups t)
733 (eshell-input-filter 'eshell-input-filter-initial-space))
737 (("C-x C-b" . ibuffer-other-window)
738 :map ibuffer-mode-map
739 ("P" . ibuffer-backward-filter-group)
740 ("N" . ibuffer-forward-filter-group)
741 ("M-p" . ibuffer-do-print)
742 ("M-n" . ibuffer-do-shell-command-pipe-replace))
744 ;; Use human readable Size column instead of original one
745 (define-ibuffer-column size-h
746 (:name "Size" :inline t)
748 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
749 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
750 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
751 (t (format "%8d" (buffer-size)))))
753 (ibuffer-saved-filter-groups
755 ("dired" (mode . dired-mode))
756 ("org" (mode . org-mode))
759 (mode . gnus-group-mode)
760 (mode . gnus-summary-mode)
761 (mode . gnus-article-mode)
762 ;; not really, but...
763 (mode . message-mode)))
781 (mode . emacs-lisp-mode)
783 (mode . haskell-mode)
785 (mode . alloy-mode)))
789 (mode . latex-mode)))
792 (name . "^\\*scratch\\*$")
793 (name . "^\\*Messages\\*$")))
794 ("erc" (mode . erc-mode)))))
796 '((mark modified read-only locked " "
797 (name 18 18 :left :elide)
801 (mode 16 16 :left :elide)
802 " " filename-and-process)
806 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
809 :hook (prog-mode . outline-minor-mode)
812 outline-minor-mode-map
813 ("<s-tab>" . outline-toggle-children)
814 ("M-p" . outline-previous-visible-heading)
815 ("M-n" . outline-next-visible-heading)
816 :prefix-map a/outline-prefix-map
818 ("TAB" . outline-toggle-children)
819 ("a" . outline-hide-body)
820 ("H" . outline-hide-body)
821 ("S" . outline-show-all)
822 ("h" . outline-hide-subtree)
823 ("s" . outline-show-subtree)))
826 :custom (ls-lisp-dirs-first t))
830 (setq dired-listing-switches "-alh"
831 ls-lisp-use-insert-directory-program nil)
833 ;; easily diff 2 marked files
834 ;; https://oremacs.com/2017/03/18/dired-ediff/
835 (defun dired-ediff-files ()
838 (defvar ediff-after-quit-hook-internal)
839 (let ((files (dired-get-marked-files))
840 (wnd (current-window-configuration)))
841 (if (<= (length files) 2)
842 (let ((file1 (car files))
843 (file2 (if (cdr files)
847 (dired-dwim-target-directory)))))
848 (if (file-newer-than-file-p file1 file2)
849 (ediff-files file2 file1)
850 (ediff-files file1 file2))
851 (add-hook 'ediff-after-quit-hook-internal
853 (setq ediff-after-quit-hook-internal nil)
854 (set-window-configuration wnd))))
855 (error "no more than 2 files should be marked"))))
856 :bind (:map dired-mode-map
857 ("b" . dired-up-directory)
858 ("e" . dired-ediff-files)
859 ("E" . dired-toggle-read-only)
860 ("\\" . dired-hide-details-mode)
863 (a/dired-start-process "zathura"))))
864 :hook (dired-mode . dired-hide-details-mode))
868 (temp-buffer-resize-mode)
869 (setq help-window-select t))
873 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
874 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
875 (add-to-list 'tramp-default-proxies-alist
876 (list (regexp-quote (system-name)) nil nil)))
879 :config (dash-enable-font-lock))
881 (use-package doc-view
882 :bind (:map doc-view-mode-map
883 ("M-RET" . image-previous-line)))
888 ;; highlight uncommitted changes in the left fringe
892 (setq diff-hl-draw-borders nil)
893 (global-diff-hl-mode)
894 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
896 ;; display Lisp objects at point in the echo area
898 :when (version< "25" emacs-version)
899 :config (global-eldoc-mode))
901 ;; highlight matching parens
904 :config (show-paren-mode))
907 :config (column-number-mode))
909 ;; save minibuffer history
910 (use-feature savehist
911 :config (savehist-mode))
913 ;; automatically save place in files
914 (use-feature saveplace
915 :when (version< "25" emacs-version)
916 :config (save-place-mode))
918 (use-feature prog-mode
919 :config (global-prettify-symbols-mode)
920 (defun indicate-buffer-boundaries-left ()
921 (setq indicate-buffer-boundaries 'left))
922 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
924 (use-feature text-mode
925 :hook ((text-mode . indicate-buffer-boundaries-left)
926 (text-mode . abbrev-mode)))
931 (:map company-active-map
932 ([tab] . company-complete-common-or-cycle)
933 ([escape] . company-abort
))
935 (company-minimum-prefix-length 1)
936 (company-selection-wrap-around t
)
937 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
938 (company-dabbrev-downcase nil
)
939 (company-dabbrev-ignore-case nil
)
941 (global-company-mode t
))
943 (use-package flycheck
945 :hook
(prog-mode . flycheck-mode
)
947 (:map flycheck-mode-map
948 ("M-P" . flycheck-previous-error
)
949 ("M-N" . flycheck-next-error
))
951 ;; Use the load-path from running Emacs when checking elisp files
952 (setq flycheck-emacs-lisp-load-path
'inherit
)
954 ;; Only flycheck when I actually save the buffer
955 (setq flycheck-check-syntax-automatically
'(mode-enabled save
)))
957 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
961 ;; ’ can be part of a word
962 (setq ispell-local-dictionary-alist
963 `((nil "[[:alpha:]]" "[^[:alpha:]]"
964 "['\x2019]" nil
("-B") nil utf-8
)))
965 ;; don't send ’ to the subprocess
966 (defun endless/replace-apostrophe
(args)
967 (cons (replace-regexp-in-string
970 (advice-add #'ispell-send-string
:filter-args
971 #'endless
/replace-apostrophe
)
973 ;; convert ' back to ’ from the subprocess
974 (defun endless/replace-quote
(args)
975 (if (not (derived-mode-p 'org-mode
))
977 (cons (replace-regexp-in-string
980 (advice-add #'ispell-parse-output
:filter-args
981 #'endless
/replace-quote
))
984 ;;; Programming modes
986 (use-feature lisp-mode
988 (add-hook 'emacs-lisp-mode-hook
'outline-minor-mode
)
989 (add-hook 'emacs-lisp-mode-hook
'reveal-mode
)
990 (defun indent-spaces-mode ()
991 (setq indent-tabs-mode nil
))
992 (add-hook 'lisp-interaction-mode-hook
#'indent-spaces-mode
))
994 (use-package alloy-mode
995 :straight
(:host github
:repo
"dwwmmn/alloy-mode")
997 :config
(setq alloy-basic-offset
2))
999 (use-package proof-site
; for Coq
1000 :straight proof-general
)
1002 (eval-when-compile (defvar lean-mode-map
))
1003 (use-package lean-mode
1005 :bind
(:map lean-mode-map
1006 ("S-SPC" . company-complete
))
1008 (require 'lean-input
)
1009 (setq default-input-method
"Lean"
1010 lean-input-tweak-all
'(lean-input-compose
1011 (lean-input-prepend "/")
1012 (lean-input-nonempty))
1013 lean-input-user-translations
'(("/" "/")))
1016 (use-package haskell-mode
1018 (setq haskell-indentation-layout-offset
4
1019 haskell-indentation-left-offset
4
1020 flycheck-checker
'haskell-hlint
1021 flycheck-disabled-checkers
'(haskell-stack-ghc haskell-ghc
)))
1025 :commands dante-mode
1026 :hook
(haskell-mode . dante-mode
))
1028 (use-package hlint-refactor
1030 :bind
(:map hlint-refactor-mode-map
1031 ("C-c l b" . hlint-refactor-refactor-buffer
)
1032 ("C-c l r" . hlint-refactor-refactor-at-point
))
1033 :hook
(haskell-mode . hlint-refactor-mode
))
1035 (use-package flycheck-haskell
1036 :after haskell-mode
)
1037 ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el
1039 (use-package sgml-mode
1041 (setq sgml-basic-offset
2))
1043 (use-package css-mode
1045 (setq css-indent-offset
2))
1047 (use-package web-mode
1051 web-mode-code-indent-offset
1052 web-mode-css-indent-offset
1053 web-mode-markup-indent-offset
))
1055 (use-package emmet-mode
1056 :after
(:any web-mode css-mode sgml-mode
)
1057 :bind
* (("C-)" . emmet-next-edit-point
)
1058 ("C-(" . emmet-prev-edit-point
))
1060 (unbind-key "C-j" emmet-mode-keymap
)
1061 (setq emmet-move-cursor-between-quotes t
)
1062 :hook
(web-mode css-mode html-mode sgml-mode
))
1065 (use-package meghanada
1067 (:map meghanada-mode-map
1068 (("C-M-o" . meghanada-optimize-import
)
1069 ("C-M-t" . meghanada-import-all
)))
1070 :hook
(java-mode . meghanada-mode
)))
1073 (use-package treemacs
1074 :config
(setq treemacs-never-persist t
))
1076 (use-package yasnippet
1078 ;; (yas-global-mode)
1081 (use-package lsp-mode
1082 :init
(setq lsp-eldoc-render-all nil
1083 lsp-highlight-symbol-at-point nil
)
1088 (use-package company-lsp
1091 (setq company-lsp-cache-candidates t
1092 company-lsp-async t
))
1096 (setq lsp-ui-sideline-update-mode
'point
))
1098 (use-package lsp-java
1100 (add-hook 'java-mode-hook
1102 (setq-local company-backends
(list 'company-lsp
))))
1104 (add-hook 'java-mode-hook
'lsp-java-enable
)
1105 (add-hook 'java-mode-hook
'flycheck-mode
)
1106 (add-hook 'java-mode-hook
'company-mode
)
1107 (add-hook 'java-mode-hook
'lsp-ui-mode
))
1109 (use-package dap-mode
1115 (use-package dap-java
1118 (use-package lsp-java-treemacs
1123 :bind
(:map eclim-mode-map
("S-SPC" . company-complete
))
1124 :hook
((java-mode . eclim-mode
)
1125 (eclim-mode .
(lambda ()
1126 (make-local-variable 'company-idle-delay
)
1127 (defvar company-idle-delay
)
1128 ;; (setq company-idle-delay 0.7)
1129 (setq company-idle-delay nil
))))
1131 (eclim-auto-save nil
)
1132 ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp")
1133 (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim")
1134 (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse"))))
1136 (use-package geiser
)
1138 (use-feature geiser-guile
1140 (setq geiser-guile-load-path
"~/src/git/guix"))
1147 (font-latex-fontify-sectioning 'color
)))
1152 (add-to-list 'custom-theme-load-path
"~/.emacs.d/lisp")
1153 (load-theme 'tangomod t
)
1155 (use-package smart-mode-line
1156 :commands
(sml/apply-theme
)
1161 (use-package doom-themes
)
1163 (defvar a
/org-mode-font-lock-keywords
1164 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1165 (1 '(:foreground
"#5a5b5a" :background
"#292b2b") t
) ; directive
1166 (3 '(:foreground
"#81a2be" :background
"#292b2b") t
) ; kind
1167 (4 '(:foreground
"#c5c8c6") t
)))) ; title
1169 (defun a/lights-on
()
1170 "Enable my favourite light theme."
1172 (mapc #'disable-theme custom-enabled-themes
)
1173 (load-theme 'tangomod t
)
1174 (sml/apply-theme
'automatic
)
1175 (font-lock-remove-keywords
1176 'org-mode a
/org-mode-font-lock-keywords
))
1178 (defun a/lights-off
()
1181 (mapc #'disable-theme custom-enabled-themes
)
1182 (load-theme 'doom-tomorrow-night t
)
1183 (sml/apply-theme
'automatic
)
1184 (font-lock-add-keywords
1185 'org-mode a
/org-mode-font-lock-keywords t
))
1188 ("s-t d" . a
/lights-off
)
1189 ("s-t l" . a
/lights-on
))
1192 ;;; Emacs enhancements & auxiliary packages
1195 :config
(setq Man-width
80))
1197 (use-package which-key
1200 (which-key-add-key-based-replacements
1201 ;; prefixes for global prefixes and minor modes
1205 "C-c 8 -" "typo/dashes"
1206 "C-c 8 <" "typo/left-brackets"
1207 "C-c 8 >" "typo/right-brackets"
1209 "C-x a" "abbrev/expand"
1210 "C-x r" "rectangle/register/bookmark"
1211 "C-x v" "version control"
1212 ;; prefixes for my personal bindings
1213 "C-c a" "applications"
1217 "C-c p" "package-management"
1218 ;; "C-c p e" "package-management/epkg"
1219 "C-c p s" "straight.el"
1222 "C-c c" "compile-and-comments"
1227 "C-c m" "multiple-cursors"
1228 "C-c P" "projectile"
1229 "C-c P s" "projectile/search"
1230 "C-c P x" "projectile/execute"
1231 "C-c P 4" "projectile/other-window"
1237 ;; prefixes for major modes
1238 (which-key-add-major-mode-key-based-replacements 'message-mode
1240 (which-key-add-major-mode-key-based-replacements 'org-mode
1241 "C-c C-v" "org-babel")
1242 (which-key-add-major-mode-key-based-replacements 'web-mode
1243 "C-c C-a" "web/attributes"
1244 "C-c C-b" "web/blocks"
1246 "C-c C-e" "web/element"
1247 "C-c C-t" "web/tags")
1251 (which-key-add-column-padding 5)
1252 (which-key-max-description-length 32))
1254 (use-package crux
; results in Waiting for git... [2 times]
1256 :bind
(("C-c b k" . crux-kill-other-buffers
)
1257 ("C-c d" . crux-duplicate-current-line-or-region
)
1258 ("C-c D" . crux-duplicate-and-comment-current-line-or-region
)
1259 ("C-c f c" . crux-copy-file-preserve-attributes
)
1260 ("C-c f d" . crux-delete-file-and-buffer
)
1261 ("C-c f r" . crux-rename-file-and-buffer
)
1262 ("C-c j" . crux-top-join-line
)
1263 ("C-S-j" . crux-top-join-line
)))
1266 :bind
(("C-a" . mwim-beginning-of-code-or-line
)
1267 ("C-e" . mwim-end-of-code-or-line
)
1268 ("<home>" . mwim-beginning-of-line-or-code
)
1269 ("<end>" . mwim-end-of-line-or-code
)))
1271 (use-package projectile
1272 :bind-keymap
("C-c P" . projectile-command-map
)
1276 (defun my-projectile-invalidate-cache (&rest _args
)
1277 ;; ignore the args to `magit-checkout'
1278 (projectile-invalidate-cache nil
))
1280 (eval-after-load 'magit-branch
1282 (advice-add 'magit-checkout
1283 :after
#'my-projectile-invalidate-cache
)
1284 (advice-add 'magit-branch-and-checkout
1285 :after
#'my-projectile-invalidate-cache
)))
1286 :custom
(projectile-completion-system 'ivy
))
1288 (use-package helpful
1291 (("C-S-h c" . helpful-command
)
1292 ("C-S-h f" . helpful-callable
) ; helpful-function
1293 ("C-S-h v" . helpful-variable
)
1294 ("C-S-h k" . helpful-key
)
1295 ("C-S-h p" . helpful-at-point
)))
1297 (use-package unkillable-scratch
1300 (unkillable-scratch 1)
1302 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
1305 ;; | make pretty boxed quotes like this
1307 (use-package boxquote
1310 (:prefix-map a
/boxquote-prefix-map
1312 ("b" . boxquote-buffer
)
1313 ("B" . boxquote-insert-buffer
)
1314 ("d" . boxquote-defun
)
1315 ("F" . boxquote-insert-file
)
1316 ("hf" . boxquote-describe-function
)
1317 ("hk" . boxquote-describe-key
)
1318 ("hv" . boxquote-describe-variable
)
1319 ("hw" . boxquote-where-is
)
1320 ("k" . boxquote-kill
)
1321 ("p" . boxquote-paragraph
)
1322 ("q" . boxquote-boxquote
)
1323 ("r" . boxquote-region
)
1324 ("s" . boxquote-shell-command
)
1325 ("t" . boxquote-text
)
1326 ("T" . boxquote-title
)
1327 ("u" . boxquote-unbox
)
1328 ("U" . boxquote-unbox-region
)
1329 ("y" . boxquote-yank
)
1330 ("M-q" . boxquote-fill-paragraph
)
1331 ("M-w" . boxquote-kill-ring-save
)))
1333 (use-package orgalist
1334 ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
1337 :hook
(message-mode . orgalist-mode
))
1339 ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹›
1343 (typo-global-mode 1)
1344 :hook
(text-mode . typo-mode
))
1346 ;; highlight TODOs in buffers
1347 (use-package hl-todo
1350 (global-hl-todo-mode))
1352 (use-package shrink-path
1356 (defvar user-
@-host
(concat (user-login-name) "@" (system-name) " "))
1357 (defun +eshell
/prompt
()
1358 (let ((base/dir
(shrink-path-prompt default-directory
)))
1359 (concat (propertize user-
@-host
'face
'default
)
1360 (propertize (car base
/dir
)
1361 'face
'font-lock-comment-face
)
1362 (propertize (cdr base
/dir
)
1363 'face
'font-lock-constant-face
)
1364 (propertize "> " 'face
'default
))))
1365 (setq eshell-prompt-regexp
(concat user-
@-host
".*> ")
1366 eshell-prompt-function
#'+eshell
/prompt
))
1368 (use-package eshell-up
1370 :commands eshell-up
)
1372 (use-package multi-term
1374 :bind
(("C-c a s m m" . multi-term
)
1375 ("C-c a s m d" . multi-term-dedicated-toggle
)
1376 ("C-c a s m p" . multi-term-prev
)
1377 ("C-c a s m n" . multi-term-next
)
1379 ("C-c C-j" . term-char-mode
)
1381 ("C-c C-j" . term-line-mode
))
1383 (setq multi-term-program
"screen"
1384 multi-term-program-switches
(concat "-c"
1385 (getenv "XDG_CONFIG_HOME")
1387 ;; TODO: add separate bindings for connecting to existing
1388 ;; session vs. always creating a new one
1389 multi-term-dedicated-select-after-open-p t
1390 multi-term-dedicated-window-height
20
1391 multi-term-dedicated-max-window-height
30
1393 '(("C-c C-c" . term-interrupt-subjob
)
1394 ("C-c C-e" . term-send-esc
)
1396 ;; ("C-y" . term-paste)
1397 ("C-y" . term-send-raw
)
1398 ("M-f" . term-send-forward-word
)
1399 ("M-b" . term-send-backward-word
)
1400 ("M-p" . term-send-up
)
1401 ("M-n" . term-send-down
)
1402 ("M-j" . term-send-raw-meta
)
1403 ("M-y" . term-send-raw-meta
)
1404 ("M-/" . term-send-raw-meta
)
1405 ("M-0" . term-send-raw-meta
)
1406 ("M-1" . term-send-raw-meta
)
1407 ("M-2" . term-send-raw-meta
)
1408 ("M-3" . term-send-raw-meta
)
1409 ("M-4" . term-send-raw-meta
)
1410 ("M-5" . term-send-raw-meta
)
1411 ("M-6" . term-send-raw-meta
)
1412 ("M-7" . term-send-raw-meta
)
1413 ("M-8" . term-send-raw-meta
)
1414 ("M-9" . term-send-raw-meta
)
1415 ("<C-backspace>" . term-send-backward-kill-word
)
1416 ("<M-DEL>" . term-send-backward-kill-word
)
1417 ("M-d" . term-send-delete-word
)
1418 ("M-," . term-send-raw
)
1419 ("M-." . comint-dynamic-complete
))
1420 term-unbind-key-alist
1421 '("C-z" "C-x" "C-c" "C-h"
1425 (use-package page-break-lines
1428 (global-page-break-lines-mode))
1430 (use-package expand-region
1431 :bind
("C-=" . er
/expand-region
))
1433 (use-package multiple-cursors
1435 (("C-S-<mouse-1>" . mc
/add-cursor-on-click
)
1436 (:prefix-map a
/mc-prefix-map
1438 ("c" . mc
/edit-lines
)
1439 ("n" . mc
/mark-next-like-this
)
1440 ("p" . mc
/mark-previous-like-this
)
1441 ("a" . mc
/mark-all-like-this
))))
1447 (use-package yasnippet
1450 (defconst yas-verbosity-cur yas-verbosity
)
1451 (setq yas-verbosity
2)
1452 (add-to-list 'yas-snippet-dirs
"~/src/git/guix/etc/snippets")
1454 (setq yas-verbosity yas-verbosity-cur
)
1456 (text-mode . yas-minor-mode
))
1458 (use-package debbugs
1461 :repo
"emacs-straight/debbugs"
1462 :files
(:defaults
"Debbugs.wsdl")))
1464 (use-package org-ref
1466 (a/setq-every
'("~/usr/org/references.bib")
1467 reftex-default-bibliography
1468 org-ref-default-bibliography
)
1470 org-ref-bibliography-notes
"~/usr/org/notes.org"
1471 org-ref-pdf-directory
"~/usr/org/bibtex-pdfs/"))
1473 ;; ugh, temporary (still better than using the proprietary web app)
1475 :commands
(slack-start)
1477 (eval-when-compile ; silence the byte-compiler
1478 (defvar url-http-data nil
)
1479 (defvar url-http-extra-headers nil
)
1480 (defvar url-http-method nil
)
1481 (defvar url-callback-function nil
)
1482 (defvar url-callback-arguments nil
)
1483 (defvar oauth--token-data nil
))
1484 (setq slack-buffer-emojify t
1485 slack-prefer-current-team t
)
1487 (slack-register-team
1488 :name
"nday-students"
1490 :token nday-students-token
1491 :subscribed-channels
'(general)
1492 :full-and-display-names t
)
1493 (add-to-list 'swiper-font-lock-exclude
'slack-message-buffer-mode t
)
1494 (setq lui-time-stamp-format
"[%Y-%m-%d %H:%M:%S]"
1495 lui-time-stamp-only-when-changed-p t
1496 lui-time-stamp-position
'right
)
1498 (("C-c s s" . slack-start
)
1499 ("C-c s u" . slack-select-unread-rooms
)
1500 ("C-c s b" . slack-select-rooms
)
1501 ("C-c s t" . slack-change-current-team
)
1502 ("C-c s c" . slack-ws-close
)
1504 ("M-p" . slack-buffer-goto-prev-message
)
1505 ("M-n" . slack-buffer-goto-next-message
)
1506 ("C-c e" . slack-message-edit
)
1507 ("C-c k" . slack-message-delete
)
1508 ("C-c C-k" . slack-channel-leave
)
1509 ("C-c r a" . slack-message-add-reaction
)
1510 ("C-c r r" . slack-message-remove-reaction
)
1511 ("C-c r s" . slack-message-show-reaction-users
)
1512 ("C-c p l" . slack-room-pins-list
)
1513 ("C-c p a" . slack-message-pins-add
)
1514 ("C-c p r" . slack-message-pins-remove
)
1515 ("@" . slack-message-embed-mention
)
1516 ("#" . slack-message-embed-channel
)))
1521 (setq alert-default-style
'notifier
))
1524 ;;; Email (with Gnus)
1526 (defvar a
/maildir
(expand-file-name "~/mail/"))
1527 (with-eval-after-load 'recentf
1528 (add-to-list 'recentf-exclude a
/maildir
))
1531 a
/gnus-init-file
(no-littering-expand-etc-file-name "gnus")
1532 mail-user-agent
'gnus-user-agent
1533 read-mail-command
'gnus
)
1536 :bind
(("s-m" . gnus
)
1537 ("s-M" . gnus-unplugged
))
1540 gnus-select-method
'(nnnil "")
1541 gnus-secondary-select-methods
1543 (nnimap-stream plain
)
1544 (nnimap-address "127.0.0.1")
1545 (nnimap-server-port 143)
1546 (nnimap-authenticator plain
)
1547 (nnimap-user "amin@bndl.local"))
1549 (nnimap-stream plain
)
1550 (nnimap-address "127.0.0.1")
1551 (nnimap-server-port 143)
1552 (nnimap-authenticator plain
)
1553 (nnimap-user "abandali@uw.local"))
1555 (nnimap-stream plain
)
1556 (nnimap-address "127.0.0.1")
1557 (nnimap-server-port 143)
1558 (nnimap-authenticator plain
)
1559 (nnimap-user "abandali@csc.uw.local")))
1560 gnus-message-archive-group
"nnimap+amin:Sent"
1563 (to-address .
"deepspec@lists.cs.princeton.edu")
1564 (to-list .
"deepspec@lists.cs.princeton.edu"))
1565 ("gnu\\.emacs-devel"
1566 (to-address .
"emacs-devel@gnu.org")
1567 (to-list .
"emacs-devel@gnu.org"))
1568 ("gnu\\.emacs-orgmode"
1569 (to-address .
"emacs-orgmode@gnu.org")
1570 (to-list .
"emacs-orgmode@gnu.org"))
1571 ("gnu\\.emacsconf-discuss"
1572 (to-address .
"emacsconf-discuss@gnu.org")
1573 (to-list .
"emacsconf-discuss@gnu.org"))
1574 ("gnu\\.fencepost-users"
1575 (to-address .
"fencepost-users@gnu.org")
1576 (to-list .
"fencepost-users@gnu.org"))
1577 ("gnu\\.gnunet-developers"
1578 (to-address .
"gnunet-developers@gnu.org")
1579 (to-list .
"gnunet-developers@gnu.org"))
1580 ("gnu\\.guile-devel"
1581 (to-address .
"guile-devel@gnu.org")
1582 (to-list .
"guile-devel@gnu.org"))
1584 (to-address .
"guix-devel@gnu.org")
1585 (to-list .
"guix-devel@gnu.org"))
1586 ("gnu\\.haskell-art"
1587 (to-address .
"haskell-art@we.lurk.org")
1588 (to-list .
"haskell-art@we.lurk.org"))
1589 ("gnu\\.haskell-cafe"
1590 (to-address .
"haskell-cafe@haskell.org")
1591 (to-list .
"haskell-cafe@haskell.org"))
1592 ("gnu\\.help-gnu-emacs"
1593 (to-address .
"help-gnu-emacs@gnu.org")
1594 (to-list .
"help-gnu-emacs@gnu.org"))
1595 ("gnu\\.info-gnu-emacs"
1596 (to-address .
"info-gnu-emacs@gnu.org")
1597 (to-list .
"info-gnu-emacs@gnu.org"))
1599 (to-address .
"info-guix@gnu.org")
1600 (to-list .
"info-guix@gnu.org"))
1602 (to-address .
"notmuch@notmuchmail.org")
1603 (to-list .
"notmuch@notmuchmail.org"))
1604 ("gnu\\.parabola-dev"
1605 (to-address .
"dev@lists.parabola.nu")
1606 (to-list .
"dev@lists.parabola.nu"))
1608 (to-address .
"webmasters@gnu.org")
1609 (to-list .
"webmasters@gnu.org"))
1610 ("gnu\\.www-commits"
1611 (to-address .
"www-commits@gnu.org")
1612 (to-list .
"www-commits@gnu.org"))
1613 ("gnu\\.www-discuss"
1614 (to-address .
"www-discuss@gnu.org")
1615 (to-list .
"www-discuss@gnu.org"))
1616 ("gnu\\.~bandali\\.public-inbox"
1617 (to-address .
"~bandali/public-inbox@lists.sr.ht")
1618 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
1619 ("gnu\\.~sircmpwn\\.srht-admins"
1620 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
1621 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
1622 ("gnu\\.~sircmpwn\\.srht-announce"
1623 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
1624 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
1625 ("gnu\\.~sircmpwn\\.srht-dev"
1626 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
1627 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
1628 ("gnu\\.~sircmpwn\\.srht-discuss"
1629 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
1630 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
1635 gnus-large-newsgroup
50
1636 gnus-home-directory
(no-littering-expand-var-file-name "gnus/")
1637 gnus-directory
(concat gnus-home-directory
"news/")
1638 message-directory
(concat gnus-home-directory
"mail/")
1639 nndraft-directory
(concat gnus-home-directory
"drafts/")
1640 gnus-save-newsrc-file nil
1641 gnus-read-newsrc-file nil
1642 gnus-interactive-exit nil
1643 gnus-gcc-mark-as-read t
)
1647 (require 'ebdb-gnus
)
1649 (with-eval-after-load 'recentf
1650 (add-to-list 'recentf-exclude gnus-home-directory
)))
1652 (use-feature gnus-art
1655 gnus-visible-headers
1656 (concat gnus-visible-headers
"\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
1657 gnus-sorted-header-list
1658 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
1659 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
1660 "^Newsgroups:" "List-Id:" "^Organization:"
1661 "^User-Agent:" "^Date:")
1662 ;; local-lapsed article dates
1663 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1664 gnus-article-date-headers
'(user-defined)
1665 gnus-article-time-format
1667 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
1668 (local (article-make-date-line date
'local
))
1669 (combined-lapsed (article-make-date-line date
1672 (string-match " (.+" combined-lapsed
)
1673 (match-string 0 combined-lapsed
))))
1674 (concat local lapsed
))))
1676 :map gnus-article-mode-map
1677 ("M-L" . org-store-link
)))
1679 (use-feature gnus-sum
1680 :bind
(:map gnus-summary-mode-map
1681 :prefix-map a
/gnus-summary-prefix-map
1683 ("r" . gnus-summary-reply
)
1684 ("w" . gnus-summary-wide-reply
)
1685 ("v" . gnus-summary-show-raw-article
))
1688 :map gnus-summary-mode-map
1689 ("M-L" . org-store-link
))
1690 :hook
(gnus-summary-mode . a
/no-mouse-autoselect-window
))
1692 (use-feature gnus-msg
1694 (setq gnus-posting-styles
1696 (address "amin@bndl.org")
1698 (eval (setq a
/message-cite-say-hi t
)))
1700 (address "bandali@gnu.org")
1701 (eval (set (make-local-variable 'message-user-fqdn
) "fencepost.gnu.org")))
1702 ((header "subject" "ThankCRM")
1703 (to "webmasters-comment@gnu.org")
1704 (body "Added to 2019supporters.html.\n\nMoving to campaigns.\n\n-amin\n")
1705 (eval (setq a
/message-cite-say-hi nil
)))
1707 (address "abandali@uwaterloo.ca")
1708 (gcc "\"nnimap+uw:Sent Items\""))
1710 (address "abandali@csclub.uwaterloo.ca")
1711 (gcc "nnimap+csc:Sent")))))
1713 (use-feature gnus-topic
1714 :hook
(gnus-group-mode . gnus-topic-mode
)
1715 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
1717 (use-feature gnus-agent
1719 (setq gnus-agent-synchronize-flags
'ask
)
1720 :hook
(gnus-group-mode . gnus-agent-mode
))
1722 (use-feature gnus-group
1724 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
1726 (use-feature gnus-win
1728 (setq gnus-use-full-window nil
))
1730 (use-feature gnus-dired
1731 :commands gnus-dired-mode
1733 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
1735 (use-feature mm-decode
1737 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")))
1739 (use-feature sendmail
1741 (setq sendmail-program
"/usr/bin/msmtp"
1742 ;; message-sendmail-extra-arguments '("-v" "-d")
1743 mail-specify-envelope-from t
1744 mail-envelope-from
'header
))
1746 (use-feature message
1748 ;; redefine for a simplified In-Reply-To header
1749 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
1750 (defun message-make-in-reply-to ()
1751 "Return the In-Reply-To header for this message."
1752 (when message-reply-headers
1753 (let ((from (mail-header-from message-reply-headers
))
1754 (msg-id (mail-header-id message-reply-headers
)))
1758 (defconst a
/message-cite-style-format
"On %Y-%m-%d %l:%M %p, %N wrote:")
1759 (defconst message-cite-style-bandali
1760 '((message-cite-function 'message-cite-original
)
1761 (message-citation-line-function 'message-insert-formatted-citation-line
)
1762 (message-cite-reply-position 'traditional
)
1763 (message-yank-prefix "> ")
1764 (message-yank-cited-prefix ">")
1765 (message-yank-empty-prefix ">")
1766 (message-citation-line-format
1767 (if a
/message-cite-say-hi
1768 (concat "Hi %F,\n\n" a
/message-cite-style-format
)
1769 a
/message-cite-style-format
)))
1770 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
1771 (setq ;; message-cite-style 'message-cite-style-bandali
1772 message-kill-buffer-on-exit t
1773 message-send-mail-function
'message-send-mail-with-sendmail
1774 message-sendmail-envelope-from
'header
1775 message-subscribed-address-functions
1776 '(gnus-find-subscribed-addresses)
1777 message-dont-reply-to-names
1778 "\\(\\(amin@bndl\\.org\\)\\|\\(.*@\\(aminb\\|amin\\.bndl\\)\\.org\\)\\|\\(\\(bandali\\|aminb?\\|mab\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
1779 (require 'company-ebdb
)
1780 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
1781 (message-mode . flyspell-mode
)
1782 (message-mode .
(lambda ()
1783 ;; (setq fill-column 65
1784 ;; message-fill-column 65)
1785 (make-local-variable 'company-idle-delay
)
1786 (setq company-idle-delay
0.2))))
1788 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
1789 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
1790 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
1793 (with-eval-after-load 'mml-sec
1794 (setq mml-secure-openpgp-encrypt-to-self t
1795 mml-secure-openpgp-sign-with-sender t
))
1797 (use-feature footnote
1800 ;; (setq footnote-start-tag ""
1801 ;; footnote-end-tag ""
1802 ;; footnote-style 'unicode)
1804 (:map message-mode-map
1805 :prefix-map a
/footnote-prefix-map
1807 ("a" . footnote-add-footnote
)
1808 ("b" . footnote-back-to-message
)
1809 ("c" . footnote-cycle-style
)
1810 ("d" . footnote-delete-footnote
)
1811 ("g" . footnote-goto-footnote
)
1812 ("r" . footnote-renumber-footnotes
)
1813 ("s" . footnote-set-style
)))
1816 :straight
(:host github
:repo
"girzel/ebdb")
1818 :bind
(:map gnus-group-mode-map
("e" . ebdb
))
1820 (setq ebdb-sources
(no-littering-expand-var-file-name "ebdb"))
1821 (with-eval-after-load 'swiper
1822 (add-to-list 'swiper-font-lock-exclude
'ebdb-mode t
)))
1824 (use-feature ebdb-com
1827 ;; (use-package ebdb-complete
1830 ;; (ebdb-complete-enable))
1832 (use-package company-ebdb
1834 (defun company-ebdb--post-complete (_) nil
))
1836 (use-feature ebdb-gnus
1839 (ebdb-gnus-window-configuration
1842 (summary 0.25 point
)
1845 (ebdb-gnus 0.3))))))
1847 (use-feature ebdb-mua
1849 ;; :custom (ebdb-mua-pop-up nil)
1852 ;; (use-package ebdb-message
1856 ;; (use-package ebdb-vcard
1859 (use-package message-x
)
1862 (use-package message-x
1864 (message-x-completion-alist
1866 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
1869 (quote message-newgroups-header-regexp
))
1870 message-newgroups-header-regexp message-newsgroups-header-regexp
)
1871 . message-expand-group
))))))
1874 (use-package gnus-harvest
1875 :commands gnus-harvest-install
1878 (if (featurep 'message-x
)
1879 (gnus-harvest-install 'message-x
)
1880 (gnus-harvest-install))))
1886 :straight
(:host nil
:repo
"https://git.bndl.org/amin/znc.el")
1887 :bind
(("C-c a e e" . znc-erc
)
1888 ("C-c a e a" . znc-all
))
1890 (let ((pwd (let ((auth (auth-source-search :host
"znca")))
1892 ((null auth
) (error "Couldn't find znca's authinfo"))
1893 (t (funcall (plist-get (car auth
) :secret
)))))))
1895 `(("znc.bndl.org" 1337 t
1896 ((freenode "amin/freenode" ,pwd
)))
1897 ("znc.bndl.org" 1337 t
1898 ((moznet "amin/moznet" ,pwd
)))))))
1901 ;;; Post initialization
1903 (message "Loading %s...done (%.3fs)" user-init-file
1904 (float-time (time-subtract (current-time)
1905 a
/before-user-init-time
)))
1907 ;;; init.el ends here