1 ;;; init.el --- bandali's emacs configuration -*- 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 activist. Used to use straight.el
22 ;; for purely functional and fully reproducible package management.
23 ;; Now I just use Guix.
25 ;; Over the years, I've taken inspiration from configurations of many
26 ;; great people. Some that I can remember off the top of my head are:
28 ;; - https://github.com/dieggsy/dotfiles
29 ;; - https://github.com/dakra/dmacs
30 ;; - http://pages.sachachua.com/.emacs.d/Sacha.html
31 ;; - https://github.com/dakrone/eos
32 ;; - http://doc.rix.si/cce/cce.html
33 ;; - https://github.com/jwiegley/dot-emacs
34 ;; - https://github.com/wasamasa/dotemacs
35 ;; - https://github.com/hlissner/doom-emacs
39 ;;; Emacs initialization
41 (defvar b
/before-user-init-time
(current-time)
42 "Value of `current-time' when Emacs begins loading `user-init-file'.")
43 (message "Loading Emacs...done (%.3fs)"
44 (float-time (time-subtract b
/before-user-init-time
47 ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage'
48 ;; during startup to reduce garbage collection frequency. clearing
49 ;; `file-name-handler-alist' seems to help reduce startup time too.
50 (defvar b
/gc-cons-threshold gc-cons-threshold
)
51 (defvar b
/gc-cons-percentage gc-cons-percentage
)
52 (defvar b
/file-name-handler-alist file-name-handler-alist
)
53 (setq gc-cons-threshold
(* 400 1024 1024) ; 400 MiB
54 gc-cons-percentage
0.6
55 file-name-handler-alist nil
56 ;; sidesteps a bug when profiling with esup
57 esup-child-profile-require-level
0)
59 ;; set them back to their defaults once we're done initializing
61 (setq gc-cons-threshold b
/gc-cons-threshold
62 gc-cons-percentage b
/gc-cons-percentage
63 file-name-handler-alist b
/file-name-handler-alist
))
64 (add-hook 'after-init-hook
#'b
/post-init
)
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
"bandali@gnu.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
))
91 (if nil
; set to t when need to debug init
93 (setq use-package-verbose t
94 use-package-expand-minimally nil
95 use-package-compute-statistics t
97 (require 'use-package
))
98 (setq use-package-verbose nil
99 use-package-expand-minimally t
))
101 (setq use-package-always-defer t
)
104 (use-package delight
)
109 ;; keep ~/.emacs.d clean
112 (convert-standard-filename "etc/") user-emacs-directory
)
113 "The directory where packages place their configuration files.")
117 (convert-standard-filename "var/") user-emacs-directory
)
118 "The directory where packages place their persistent data files.")
121 "Expand filename FILE relative to `b/etc-dir'."
122 (expand-file-name (convert-standard-filename file
) b
/etc-dir
))
125 "Expand filename FILE relative to `b/var-dir'."
126 (expand-file-name (convert-standard-filename file
) b
/var-dir
))
128 (setq auto-save-list-file-prefix
(b/var
"auto-save/sessions/"))
130 ;; separate custom file (don't want it mixing with init.el)
134 (setq custom-file
(b/etc
"custom.el"))
135 (when (file-exists-p custom-file
)
137 ;; while at it, treat themes as safe
138 (setf custom-safe-themes t
))
140 ;; load the secrets file if it exists, otherwise show a warning
143 (load (b/etc
"secrets"))))
145 ;; better $PATH (and other environment variable) handling
146 (use-package exec-path-from-shell
149 (setq exec-path-from-shell-arguments nil
150 exec-path-from-shell-check-startup-files nil
)
152 (exec-path-from-shell-initialize)
153 ;; while we're at it, let's fix access to our running ssh-agent
154 (exec-path-from-shell-copy-env "SSH_AGENT_PID")
155 (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
157 ;; only one custom theme at a time
159 (defadvice load-theme
(before clear-previous-themes activate
)
160 "Clear existing theme settings instead of layering them"
161 (mapc #'disable-theme custom-enabled-themes
)))
163 ;; start up emacs server. see
164 ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server
167 :config
(or (server-running-p) (server-mode)))
171 (dolist (ft (fontset-list))
175 (font-spec :name
"Source Code Pro" :size
14))
179 (font-spec :name
"DejaVu Sans Mono")
186 ;; :name "Symbola monospacified for DejaVu Sans Mono")
192 ;; (font-spec :name "DejaVu Sans Mono")
198 (font-spec :name
"DejaVu Sans Mono" :size
14)
202 ;; gentler font resizing
203 (setq text-scale-mode-step
1.05)
205 ;; focus follows mouse
206 (setq mouse-autoselect-window t
)
208 (defun b/no-mouse-autoselect-window
()
209 "Conveniently disable `focus-follows-mouse'.
210 For disabling the behaviour for certain buffers and/or modes."
211 (make-local-variable 'mouse-autoselect-window
)
212 (setq mouse-autoselect-window nil
))
215 (setq ;; scroll-margin 1
216 ;; scroll-conservatively 10000
218 scroll-conservatively
10
219 scroll-preserve-screen-position
1)
224 (setq mouse-wheel-scroll-amount
'(1 ((shift) .
1)) ; one line at a time
225 mouse-wheel-progressive-speed nil
; don't accelerate scrolling
226 mouse-wheel-follow-mouse t
)) ; scroll window under mouse
228 (use-package pixel-scroll
230 :config
(pixel-scroll-mode 1))
232 ;; ask for GPG passphrase in minibuffer
235 ; this will fail if gpg>=2.1 is not available
236 (epa-pinentry-mode 'loopback
))
238 (use-package epg-config
241 ((epg-gpg-program (executable-find "gpg"))
242 (epg-pinentry-mode 'loopback
)))
247 (use-package pinentry
249 :after
(epa epg server
)
251 (setq pinentry--socket-dir server-socket-dir
)
261 (defmacro b
/setq-every
(value &rest vars
)
262 "Set all the variables from VARS to value VALUE."
263 (declare (indent defun
) (debug t
))
264 `(progn ,@(mapcar (lambda (x) (list 'setq x value
)) vars
)))
266 (defun b/start-process
(program &rest args
)
267 "Same as `start-process', but doesn't bother about name and buffer."
268 (let ((process-name (concat program
"_process"))
269 (buffer-name (generate-new-buffer-name
270 (concat program
"_output"))))
271 (apply #'start-process
272 process-name buffer-name program args
)))
274 (defun b/dired-start-process
(program &optional args
)
275 "Open current file with a PROGRAM."
276 ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can
277 ;; be nil, so remove it).
278 (apply #'b
/start-process
280 (remove nil
(list args
(dired-get-file-for-visit)))))
282 (defun b/add-elisp-section
()
286 (insert "\n\f\n;;; "))
291 ;; time and battery in mode-line
295 (setq display-time-default-load-average nil
)
301 (display-battery-mode)))
304 ;; (fringe-mode '(3 . 1))
307 ;; disable disabled commands
308 (setq disabled-command-function nil
)
310 ;; Save what I copy into clipboard from other applications into Emacs'
311 ;; kill-ring, which would allow me to still be able to easily access
312 ;; it in case I kill (cut or copy) something else inside Emacs before
313 ;; yanking (pasting) what I'd originally intended to.
314 (setq save-interprogram-paste-before-kill t
)
317 (setq enable-recursive-minibuffers t
318 resize-mini-windows t
)
320 ;; lazy-person-friendly yes/no prompts
321 (defalias 'yes-or-no-p
#'y-or-n-p
)
323 ;; i want *scratch* as my startup buffer
324 (setq initial-buffer-choice t
)
326 ;; i don't need the default hint
327 (setq initial-scratch-message nil
)
329 ;; use customizable text-mode as major mode for *scratch*
330 (setq initial-major-mode
'text-mode
)
332 ;; inhibit buffer list when more than 2 files are loaded
333 (setq inhibit-startup-buffer-menu t
)
335 ;; don't need to see the startup screen or the echo area message
336 (advice-add #'display-startup-echo-area-message
:override
#'ignore
)
337 (setq inhibit-startup-screen t
338 inhibit-startup-echo-area-message user-login-name
)
340 ;; more useful frame titles
341 (setq frame-title-format
342 '("" invocation-name
" - "
343 (:eval
(if (buffer-file-name)
344 (abbreviate-file-name (buffer-file-name))
347 ;; backups (C-h v make-backup-files RET)
348 (setq backup-by-copying t
349 backup-directory-alist
(list (cons "." (b/var
"backup/")))
351 delete-old-versions t
)
353 ;; enable automatic reloading of changed buffers and files
354 (global-auto-revert-mode 1)
355 (setq auto-revert-verbose nil
356 global-auto-revert-non-file-buffers nil
)
358 ;; always use space for indentation
361 require-final-newline t
364 ;; enable winner-mode (C-h f winner-mode RET)
367 ;; don't display *compilation* buffer on success. based on
368 ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
369 ;; instead of the now obsolete `flet'.
370 (with-eval-after-load 'compile
371 (defun b/compilation-finish-function
(buffer outstr
)
372 (unless (string-match "finished" outstr
)
373 (switch-to-buffer-other-window buffer
))
376 (setq compilation-finish-functions
#'b
/compilation-finish-function
)
380 (defadvice compilation-start
381 (around inhibit-display
382 (command &optional mode name-function highlight-regexp
))
383 (if (not (string-match "^\\(find\\|grep\\)" command
))
384 (cl-letf (((symbol-function 'display-buffer
) #'ignore
))
385 (save-window-excursion ad-do-it
))
387 (ad-activate 'compilation-start
))
389 ;; search for non-ASCII characters: i’d like non-ASCII characters such
390 ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII
391 ;; counterpart. shoutout to
392 ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html
393 (setq search-default-mode
#'char-fold-to-regexp
)
394 ;; uncomment to extend this behaviour to query-replace
395 ;; (setq replace-char-fold t)
398 (setq-default cursor-type
'bar
)
400 ;; allow scrolling in Isearch
401 (setq isearch-allow-scroll t
)
403 ;; open read-only file buffers in view-mode
404 ;; (enables niceties like `q' for quit)
405 (setq view-read-only t
)
408 :bind
("C-x v C-=" . vc-ediff
))
411 :config
(add-hook 'ediff-after-quit-hook-internal
'winner-undo
)
412 :custom
((ediff-window-setup-function 'ediff-setup-windows-plain
)
413 (ediff-split-window-function 'split-window-horizontally
)))
421 ("C-c e b" . eval-buffer
)
422 ("C-c e r" . eval-region
)
424 ("C-c e i" . emacs-init-time
)
425 ("C-c e u" . emacs-uptime
)
426 ("C-c e v" . emacs-version
)
428 ("C-c F m" . make-frame-command
)
429 ("C-c F d" . delete-frame
)
430 ("C-c F D" . server-edit
)
432 ("C-S-h C" . describe-char
)
433 ("C-S-h F" . describe-face
)
435 ("C-x k" . kill-this-buffer
)
436 ("C-x K" . kill-buffer
)
438 :map emacs-lisp-mode-map
439 ("<C-return>" . b
/add-elisp-section
))
441 (when (display-graphic-p)
442 (unbind-key "C-z" global-map
))
445 ;; for back and forward mouse keys
446 ("<mouse-8>" . previous-buffer
)
447 ("<drag-mouse-8>" . previous-buffer
)
448 ("<mouse-9>" . next-buffer
)
449 ("<drag-mouse-9>" . next-buffer
)
450 ("<drag-mouse-2>" . kill-this-buffer
)
451 ("<drag-mouse-3>" . ivy-switch-buffer
))
454 ;;; Essential packages
459 (setq org-src-tab-acts-natively t
460 org-src-preserve-indentation nil
461 org-edit-src-content-indentation
0
462 org-link-email-description-format
"Email %c: %s" ; %.30s
463 org-highlight-latex-and-related
'(entities)
464 org-use-speed-commands t
465 org-startup-folded
'content
466 org-catch-invisible-edits
'show-and-error
468 (add-to-list 'org-structure-template-alist
'("L" .
"src emacs-lisp") t
)
469 (add-to-list 'org-modules
'org-habit
)
471 (("C-c a o a" . org-agenda
)
473 ("M-L" . org-insert-last-stored-link
)
474 ("M-O" . org-toggle-link-display
)
476 :hook
((org-mode . org-indent-mode
)
477 (org-mode . auto-fill-mode
)
478 (org-mode . flyspell-mode
))
480 (org-agenda-files '("~/usr/org/todos/personal.org"
481 "~/usr/org/todos/habits.org"
482 "~/usr/org/todos/masters.org"))
483 (org-agenda-start-on-weekday 0)
484 (org-agenda-time-leading-zero t
)
485 (org-habit-graph-column 44)
486 (org-latex-packages-alist '(("" "listings") ("" "color")))
488 '(org-block-begin-line ((t (:foreground
"#5a5b5a" :background
"#1d1f21"))))
489 '(org-block ((t (:background
"#1d1f21"))))
490 '(org-latex-and-related ((t (:foreground
"#b294bb")))))
492 (use-package ox-latex
495 (setq org-latex-listings
'listings
496 ;; org-latex-prefer-user-labels t
498 (add-to-list 'org-latex-classes
499 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
500 ("\\section{%s}" .
"\\section*{%s}")
501 ("\\subsection{%s}" .
"\\subsection*{%s}")
502 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
503 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
504 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
506 (require 'ox-beamer
))
508 (use-package ox-extra
510 (ox-extras-activate '(latex-header-blocks ignore-headlines
)))
512 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
513 ;; org file. closely inspired by
514 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
515 (with-eval-after-load 'org
516 (defvar b
/show-async-tangle-results nil
517 "Keep *emacs* async buffers around for later inspection.")
519 (defvar b
/show-async-tangle-time nil
520 "Show the time spent tangling the file.")
522 (defun b/async-babel-tangle
()
523 "Tangle org file asynchronously."
525 (let* ((file-tangle-start-time (current-time))
526 (file (buffer-file-name))
527 (file-nodir (file-name-nondirectory file
))
528 ;; (async-quiet-switch "-q")
529 (file-noext (file-name-sans-extension file
)))
533 (org-babel-tangle-file ,file
))
534 (unless b
/show-async-tangle-results
537 (message "Tangled %s%s"
539 (if b
/show-async-tangle-time
541 (float-time (time-subtract (current-time)
542 ',file-tangle-start-time
)))
544 (message "Tangling %s failed" ,file-nodir
))))))))
547 'safe-local-variable-values
548 '(eval add-hook
'after-save-hook
#'b
/async-babel-tangle
'append
'local
))
550 ;; *the* right way to do git
553 :bind
(("C-x g" . magit-status
)
554 ("s-g s" . magit-status
)
555 ("s-g l" . magit-log-buffer-file
))
557 (magit-add-section-hook 'magit-status-sections-hook
558 'magit-insert-modules
559 'magit-insert-stashes
561 (setq magit-repository-directories
'(("~/" .
0)
563 (nconc magit-section-initial-visibility-alist
564 '(([unpulled status
] . show
)
565 ([unpushed status
] . show
)))
566 :custom
(magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1
)
567 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
569 ;; recently opened files
573 ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
575 (recentf-max-saved-items 2000)
576 (recentf-save-file (b/var
"recentf-save.el")))
578 ;; smart M-x enhancement (needed by counsel for history)
585 (:map ivy-minibuffer-map
586 ([escape] . keyboard-escape-quit)
587 ([S-up] . ivy-previous-history-element)
588 ([S-down] . ivy-next-history-element)
589 ("DEL" . ivy-backward-delete-char))
593 ivy-use-virtual-buffers t
594 ivy-virtual-abbreviate 'abbreviate
595 ivy-count-format "%d/%d ")
598 ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
599 ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold))))
600 ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold))))
605 :bind (("C-s" . swiper-isearch)
607 ("C-S-s" . isearch-forward)))
612 :bind (([remap execute-extended-command] . counsel-M-x)
613 ([remap find-file] . counsel-find-file)
614 ("C-c x" . counsel-M-x)
615 ("C-c f ." . counsel-find-file)
616 ("C-c f l" . counsel-find-library)
617 ("C-c f r" . counsel-recentf)
618 ("s-." . counsel-find-file)
619 ("s-r" . ivy-switch-buffer)
620 :map minibuffer-local-map
621 ("C-r" . counsel-minibuffer-history))
624 (defalias 'locate #'counsel-locate))
628 :commands (helm-M-x helm-mini helm-resume)
629 :bind (("M-x" . helm-M-x)
630 ("M-y" . helm-show-kill-ring)
631 ("C-x b" . helm-mini)
632 ("C-x C-b" . helm-buffers-list)
633 ("C-x C-f" . helm-find-files)
634 ("C-h r" . helm-info-emacs)
635 ("s-r" . helm-recentf)
636 ("C-s-r" . helm-resume)
638 ("<tab>" . helm-execute-persistent-action)
639 ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals
640 ("C-z" . helm-select-action)) ; List actions
641 :config (helm-mode 1)))
646 :bind ("C-c a s e" . eshell)
648 (eval-when-compile (defvar eshell-prompt-regexp))
649 (defun b/eshell-quit-or-delete-char (arg)
651 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
652 (eshell-life-is-too-much)
655 (defun b/eshell-clear ()
657 (let ((inhibit-read-only t))
661 (defun b/eshell-setup ()
662 (make-local-variable 'company-idle-delay)
663 (defvar company-idle-delay)
664 (setq company-idle-delay nil)
665 (bind-keys :map eshell-mode-map
666 ("C-d" . b/eshell-quit-or-delete-char)
667 ("C-S-l" . b/eshell-clear)
668 ("M-r" . counsel-esh-history)
669 ([tab] . company-complete)))
671 :hook (eshell-mode . b/eshell-setup)
673 (eshell-directory-name (b/var "eshell/"))
674 (eshell-hist-ignoredups t)
675 (eshell-input-filter 'eshell-input-filter-initial-space))
679 (("C-x C-b" . ibuffer)
680 :map ibuffer-mode-map
681 ("P" . ibuffer-backward-filter-group)
682 ("N" . ibuffer-forward-filter-group)
683 ("M-p" . ibuffer-do-print)
684 ("M-n" . ibuffer-do-shell-command-pipe-replace))
686 ;; Use human readable Size column instead of original one
687 (define-ibuffer-column size-h
688 (:name "Size" :inline t)
690 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
691 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
692 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
693 (t (format "%8d" (buffer-size)))))
695 (ibuffer-saved-filter-groups
697 ("dired" (mode . dired-mode))
698 ("org" (mode . org-mode))
701 (mode . gnus-group-mode)
702 (mode . gnus-summary-mode)
703 (mode . gnus-article-mode)
704 ;; not really, but...
705 (mode . message-mode)))
723 (mode . emacs-lisp-mode)
725 (mode . haskell-mode)
728 (mode . alloy-mode)))
732 (mode . latex-mode)))
735 (name . "^\\*scratch\\*$")
736 (name . "^\\*Messages\\*$")))
737 ("erc" (mode . erc-mode)))))
739 '((mark modified read-only locked " "
740 (name 18 18 :left :elide)
744 (mode 16 16 :left :elide)
745 " " filename-and-process)
749 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
752 :hook (prog-mode . outline-minor-mode)
753 :delight (outline-minor-mode " outl")
756 outline-minor-mode-map
757 ("<s-tab>" . outline-toggle-children)
758 ("M-p" . outline-previous-visible-heading)
759 ("M-n" . outline-next-visible-heading)
760 :prefix-map b/outline-prefix-map
762 ("TAB" . outline-toggle-children)
763 ("a" . outline-hide-body)
764 ("H" . outline-hide-body)
765 ("S" . outline-show-all)
766 ("h" . outline-hide-subtree)
767 ("s" . outline-show-subtree)))
770 :custom (ls-lisp-dirs-first t))
774 (setq dired-listing-switches "-alh"
775 ls-lisp-use-insert-directory-program nil)
777 ;; easily diff 2 marked files
778 ;; https://oremacs.com/2017/03/18/dired-ediff/
779 (defun dired-ediff-files ()
782 (defvar ediff-after-quit-hook-internal)
783 (let ((files (dired-get-marked-files))
784 (wnd (current-window-configuration)))
785 (if (<= (length files) 2)
786 (let ((file1 (car files))
787 (file2 (if (cdr files)
791 (dired-dwim-target-directory)))))
792 (if (file-newer-than-file-p file1 file2)
793 (ediff-files file2 file1)
794 (ediff-files file1 file2))
795 (add-hook 'ediff-after-quit-hook-internal
797 (setq ediff-after-quit-hook-internal nil)
798 (set-window-configuration wnd))))
799 (error "no more than 2 files should be marked"))))
802 (setq dired-guess-shell-alist-user
803 '(("\\.pdf\\'" "evince" "zathura" "okular")
804 ("\\.doc\\'" "libreoffice")
805 ("\\.docx\\'" "libreoffice")
806 ("\\.ppt\\'" "libreoffice")
807 ("\\.pptx\\'" "libreoffice")
808 ("\\.xls\\'" "libreoffice")
809 ("\\.xlsx\\'" "libreoffice")
810 ("\\.flac\\'" "mpv")))
811 :bind (:map dired-mode-map
812 ("b" . dired-up-directory)
813 ("e" . dired-ediff-files)
814 ("E" . dired-toggle-read-only)
815 ("\\" . dired-hide-details-mode)
818 (b/dired-start-process "zathura"))))
819 :hook (dired-mode . dired-hide-details-mode))
823 (temp-buffer-resize-mode)
824 (setq help-window-select t))
828 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
829 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
830 (add-to-list 'tramp-default-proxies-alist
831 (list (regexp-quote (system-name)) nil nil)))
834 :config (dash-enable-font-lock))
836 (use-package doc-view
837 :bind (:map doc-view-mode-map
838 ("M-RET" . image-previous-line)))
843 ;; highlight uncommitted changes in the left fringe
847 (setq diff-hl-draw-borders nil)
848 (global-diff-hl-mode)
849 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
851 ;; display Lisp objects at point in the echo area
853 :when (version< "25" emacs-version)
855 :config (global-eldoc-mode))
857 ;; highlight matching parens
860 :config (show-paren-mode))
862 (use-package elec-pair
864 :config (electric-pair-mode))
867 :delight (auto-fill-function " fill")
868 :config (column-number-mode))
870 ;; save minibuffer history
871 (use-package savehist
875 (savehist-file (b/var "savehist.el")))
877 ;; automatically save place in files
878 (use-package saveplace
879 :when (version< "25" emacs-version)
880 :config (save-place-mode)
882 (save-place-file (b/var "save-place.el")))
884 (use-package prog-mode
885 :config (global-prettify-symbols-mode)
886 (defun indicate-buffer-boundaries-left ()
887 (setq indicate-buffer-boundaries 'left))
888 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
890 (use-package text-mode
891 :hook (text-mode . indicate-buffer-boundaries-left))
893 (use-package conf-mode
903 (:map company-active-map
904 ([tab] . company-complete-common-or-cycle)
905 ([escape] . company-abort
))
907 (company-minimum-prefix-length 1)
908 (company-selection-wrap-around t
)
909 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
910 (company-dabbrev-downcase nil
)
911 (company-dabbrev-ignore-case nil
)
913 (global-company-mode t
))
915 (use-package flycheck
917 :hook
(prog-mode . flycheck-mode
)
919 (:map flycheck-mode-map
920 ("M-P" . flycheck-previous-error
)
921 ("M-N" . flycheck-next-error
))
923 ;; Use the load-path from running Emacs when checking elisp files
924 (setq flycheck-emacs-lisp-load-path
'inherit
)
926 ;; Only flycheck when I actually save the buffer
927 (setq flycheck-check-syntax-automatically
'(mode-enabled save
))
928 :custom
(flycheck-mode-line-prefix "flyc"))
930 (use-package flyspell
933 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
937 ;; ’ can be part of a word
938 (setq ispell-local-dictionary-alist
939 `((nil "[[:alpha:]]" "[^[:alpha:]]"
940 "['\x2019]" nil
("-B") nil utf-8
))
941 ispell-program-name
(executable-find "hunspell"))
942 ;; don't send ’ to the subprocess
943 (defun endless/replace-apostrophe
(args)
944 (cons (replace-regexp-in-string
947 (advice-add #'ispell-send-string
:filter-args
948 #'endless
/replace-apostrophe
)
950 ;; convert ' back to ’ from the subprocess
951 (defun endless/replace-quote
(args)
952 (if (not (derived-mode-p 'org-mode
))
954 (cons (replace-regexp-in-string
957 (advice-add #'ispell-parse-output
:filter-args
958 #'endless
/replace-quote
))
962 :hook
(text-mode . abbrev-mode
)
964 (abbrev-file-name (b/var
"abbrev.el")))
967 ;;; Programming modes
969 (use-package lisp-mode
971 (defun indent-spaces-mode ()
972 (setq indent-tabs-mode nil
))
973 (add-hook 'lisp-interaction-mode-hook
#'indent-spaces-mode
))
976 :delight
(reveal-mode " reveal")
977 :hook
(emacs-lisp-mode . reveal-mode
))
979 (use-package elisp-mode
980 :delight
(emacs-lisp-mode "Elisp" :major
))
984 (use-package alloy-mode
985 :straight
(:host github
:repo
"dwwmmn/alloy-mode")
987 :config
(setq alloy-basic-offset
2))
989 (use-package proof-site
; for Coq
990 :straight proof-general
)
992 (eval-when-compile (defvar lean-mode-map
))
993 (use-package lean-mode
995 :bind
(:map lean-mode-map
996 ("S-SPC" . company-complete
))
998 (require 'lean-input
)
999 (setq default-input-method
"Lean"
1000 lean-input-tweak-all
'(lean-input-compose
1001 (lean-input-prepend "/")
1002 (lean-input-nonempty))
1003 lean-input-user-translations
'(("/" "/")))
1006 (use-package haskell-mode
1008 (setq haskell-indentation-layout-offset
4
1009 haskell-indentation-left-offset
4
1010 flycheck-checker
'haskell-hlint
1011 flycheck-disabled-checkers
'(haskell-stack-ghc haskell-ghc
)))
1015 :commands dante-mode
1016 :hook
(haskell-mode . dante-mode
))
1018 (use-package hlint-refactor
1020 :bind
(:map hlint-refactor-mode-map
1021 ("C-c l b" . hlint-refactor-refactor-buffer
)
1022 ("C-c l r" . hlint-refactor-refactor-at-point
))
1023 :hook
(haskell-mode . hlint-refactor-mode
))
1025 (use-package flycheck-haskell
1026 :after haskell-mode
)
1027 ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el
1030 (use-package sgml-mode
1032 (setq sgml-basic-offset
2))
1034 (use-package css-mode
1036 (setq css-indent-offset
2))
1038 (use-package web-mode
1042 web-mode-code-indent-offset
1043 web-mode-css-indent-offset
1044 web-mode-markup-indent-offset
))
1046 (use-package emmet-mode
1047 :after
(:any web-mode css-mode sgml-mode
)
1048 :bind
* (("C-)" . emmet-next-edit-point
)
1049 ("C-(" . emmet-prev-edit-point
))
1051 (unbind-key "C-j" emmet-mode-keymap
)
1052 (setq emmet-move-cursor-between-quotes t
)
1053 :hook
(web-mode css-mode html-mode sgml-mode
))
1056 (use-package meghanada
1058 (:map meghanada-mode-map
1059 (("C-M-o" . meghanada-optimize-import
)
1060 ("C-M-t" . meghanada-import-all
)))
1061 :hook
(java-mode . meghanada-mode
)))
1064 (use-package treemacs
1065 :config
(setq treemacs-never-persist t
))
1067 (use-package yasnippet
1069 ;; (yas-global-mode)
1072 (use-package lsp-mode
1073 :init
(setq lsp-eldoc-render-all nil
1074 lsp-highlight-symbol-at-point nil
)
1079 (use-package company-lsp
1082 (setq company-lsp-cache-candidates t
1083 company-lsp-async t
))
1087 (setq lsp-ui-sideline-update-mode
'point
))
1089 (use-package lsp-java
1091 (add-hook 'java-mode-hook
1093 (setq-local company-backends
(list 'company-lsp
))))
1095 (add-hook 'java-mode-hook
'lsp-java-enable
)
1096 (add-hook 'java-mode-hook
'flycheck-mode
)
1097 (add-hook 'java-mode-hook
'company-mode
)
1098 (add-hook 'java-mode-hook
'lsp-ui-mode
))
1100 (use-package dap-mode
1106 (use-package dap-java
1109 (use-package lsp-java-treemacs
1114 :bind
(:map eclim-mode-map
("S-SPC" . company-complete
))
1115 :hook
((java-mode . eclim-mode
)
1116 (eclim-mode .
(lambda ()
1117 (make-local-variable 'company-idle-delay
)
1118 (defvar company-idle-delay
)
1119 ;; (setq company-idle-delay 0.7)
1120 (setq company-idle-delay nil
))))
1122 (eclim-auto-save nil
)
1123 ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp")
1124 (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim")
1125 (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse"))))
1127 (use-package geiser
)
1129 (use-package geiser-guile
1131 (setq geiser-guile-load-path
"~/src/git/guix"))
1138 (font-latex-fontify-sectioning 'color
)))
1140 (use-package go-mode
)
1142 (use-package po-mode
1144 (po-mode .
(lambda () (run-with-timer 0.1 nil
'View-exit
))))
1149 (add-to-list 'custom-theme-load-path
1151 (convert-standard-filename "lisp") user-emacs-directory
))
1152 (load-theme 'tangomod t
)
1154 (use-package smart-mode-line
1155 :commands
(sml/apply-theme
)
1159 (smart-mode-line-enable))
1163 (use-package doom-themes
))
1165 (defvar b
/org-mode-font-lock-keywords
1166 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1167 (1 '(:foreground
"#5a5b5a" :background
"#292b2b") t
) ; directive
1168 (3 '(:foreground
"#81a2be" :background
"#292b2b") t
) ; kind
1169 (4 '(:foreground
"#c5c8c6") t
)))) ; title
1171 (defun b/lights-on
()
1172 "Enable my favourite light theme."
1174 (mapc #'disable-theme custom-enabled-themes
)
1175 (load-theme 'tangomod t
)
1176 (sml/apply-theme
'automatic
)
1177 (font-lock-remove-keywords
1178 'org-mode b
/org-mode-font-lock-keywords
))
1180 (defun b/lights-off
()
1183 (mapc #'disable-theme custom-enabled-themes
)
1184 ;; (load-theme 'doom-tomorrow-night t)
1185 (sml/apply-theme
'automatic
)
1186 (font-lock-add-keywords
1187 'org-mode b
/org-mode-font-lock-keywords t
))
1190 ("s-t d" . b
/lights-off
)
1191 ("s-t l" . b
/lights-on
))
1194 ;;; Emacs enhancements & auxiliary packages
1197 :config
(setq Man-width
80))
1199 (use-package which-key
1203 (which-key-add-key-based-replacements
1204 ;; prefixes for global prefixes and minor modes
1208 "C-c 8 -" "typo/dashes"
1209 "C-c 8 <" "typo/left-brackets"
1210 "C-c 8 >" "typo/right-brackets"
1212 "C-x a" "abbrev/expand"
1213 "C-x r" "rectangle/register/bookmark"
1214 "C-x v" "version control"
1215 ;; prefixes for my personal bindings
1216 "C-c a" "applications"
1220 "C-c p" "package-management"
1221 ;; "C-c p e" "package-management/epkg"
1222 "C-c p s" "straight.el"
1225 "C-c c" "compile-and-comments"
1230 "C-c m" "multiple-cursors"
1231 "C-c P" "projectile"
1232 "C-c P s" "projectile/search"
1233 "C-c P x" "projectile/execute"
1234 "C-c P 4" "projectile/other-window"
1240 ;; prefixes for major modes
1241 (which-key-add-major-mode-key-based-replacements 'message-mode
1243 (which-key-add-major-mode-key-based-replacements 'org-mode
1244 "C-c C-v" "org-babel")
1245 (which-key-add-major-mode-key-based-replacements 'web-mode
1246 "C-c C-a" "web/attributes"
1247 "C-c C-b" "web/blocks"
1249 "C-c C-e" "web/element"
1250 "C-c C-t" "web/tags")
1254 (which-key-add-column-padding 5)
1255 (which-key-max-description-length 32))
1257 (use-package crux
; results in Waiting for git... [2 times]
1259 :bind
(("C-c b k" . crux-kill-other-buffers
)
1260 ("C-c d" . crux-duplicate-current-line-or-region
)
1261 ("C-c D" . crux-duplicate-and-comment-current-line-or-region
)
1262 ("C-c f c" . crux-copy-file-preserve-attributes
)
1263 ("C-c f d" . crux-delete-file-and-buffer
)
1264 ("C-c f r" . crux-rename-file-and-buffer
)
1265 ("C-c j" . crux-top-join-line
)
1266 ("C-S-j" . crux-top-join-line
)))
1271 :bind
(("C-a" . mwim-beginning-of-code-or-line
)
1272 ("C-e" . mwim-end-of-code-or-line
)
1273 ("<home>" . mwim-beginning-of-line-or-code
)
1274 ("<end>" . mwim-end-of-line-or-code
))))
1276 (use-package projectile
1278 :bind-keymap
("C-c P" . projectile-command-map
)
1282 (defun b/projectile-mode-line-fun
()
1283 "Report project name and type in the modeline."
1284 (let ((project-name (projectile-project-name))
1285 (project-type (projectile-project-type)))
1287 projectile-mode-line-prefix
1289 (format ":%s" project-type
)
1291 (setq projectile-mode-line-function
'b
/projectile-mode-line-fun
)
1293 (defun my-projectile-invalidate-cache (&rest _args
)
1294 ;; ignore the args to `magit-checkout'
1295 (projectile-invalidate-cache nil
))
1297 (eval-after-load 'magit-branch
1299 (advice-add 'magit-checkout
1300 :after
#'my-projectile-invalidate-cache
)
1301 (advice-add 'magit-branch-and-checkout
1302 :after
#'my-projectile-invalidate-cache
)))
1304 (projectile-completion-system 'ivy
)
1305 (projectile-mode-line-prefix " proj"))
1307 (use-package helpful
1310 (("C-S-h c" . helpful-command
)
1311 ("C-S-h f" . helpful-callable
) ; helpful-function
1312 ("C-S-h v" . helpful-variable
)
1313 ("C-S-h k" . helpful-key
)
1314 ("C-S-h p" . helpful-at-point
)))
1318 (use-package unkillable-scratch
1321 (unkillable-scratch 1)
1323 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))))
1328 ;; | make pretty boxed quotes like this
1330 (use-package boxquote
1333 (:prefix-map b
/boxquote-prefix-map
1335 ("b" . boxquote-buffer
)
1336 ("B" . boxquote-insert-buffer
)
1337 ("d" . boxquote-defun
)
1338 ("F" . boxquote-insert-file
)
1339 ("hf" . boxquote-describe-function
)
1340 ("hk" . boxquote-describe-key
)
1341 ("hv" . boxquote-describe-variable
)
1342 ("hw" . boxquote-where-is
)
1343 ("k" . boxquote-kill
)
1344 ("p" . boxquote-paragraph
)
1345 ("q" . boxquote-boxquote
)
1346 ("r" . boxquote-region
)
1347 ("s" . boxquote-shell-command
)
1348 ("t" . boxquote-text
)
1349 ("T" . boxquote-title
)
1350 ("u" . boxquote-unbox
)
1351 ("U" . boxquote-unbox-region
)
1352 ("y" . boxquote-yank
)
1353 ("M-q" . boxquote-fill-paragraph
)
1354 ("M-w" . boxquote-kill-ring-save
))))
1356 (use-package orgalist
1357 ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
1360 :hook
(message-mode . orgalist-mode
))
1362 ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹›
1367 (typo-global-mode 1)
1368 :hook
((text-mode erc-mode
) . typo-mode
))
1370 ;; highlight TODOs in buffers
1371 (use-package hl-todo
1374 (global-hl-todo-mode))
1378 (use-package shrink-path
1382 (defvar user-
@-host
(concat (user-login-name) "@" (system-name) " "))
1383 (defun +eshell
/prompt
()
1384 (let ((base/dir
(shrink-path-prompt default-directory
)))
1385 (concat (propertize user-
@-host
'face
'default
)
1386 (propertize (car base
/dir
)
1387 'face
'font-lock-comment-face
)
1388 (propertize (cdr base
/dir
)
1389 'face
'font-lock-constant-face
)
1390 (propertize "> " 'face
'default
))))
1391 (setq eshell-prompt-regexp
(concat user-
@-host
".*> ")
1392 eshell-prompt-function
#'+eshell
/prompt
)))
1394 (use-package eshell-up
1396 :commands eshell-up
)
1398 (use-package multi-term
1400 :bind
(("C-c a s m m" . multi-term
)
1401 ("C-c a s m d" . multi-term-dedicated-toggle
)
1402 ("C-c a s m p" . multi-term-prev
)
1403 ("C-c a s m n" . multi-term-next
)
1405 ("C-c C-j" . term-char-mode
))
1407 (setq multi-term-program
"screen"
1408 multi-term-program-switches
(concat "-c"
1409 (getenv "XDG_CONFIG_HOME")
1411 ;; TODO: add separate bindings for connecting to existing
1412 ;; session vs. always creating a new one
1413 multi-term-dedicated-select-after-open-p t
1414 multi-term-dedicated-window-height
20
1415 multi-term-dedicated-max-window-height
30
1417 '(("C-c C-c" . term-interrupt-subjob
)
1418 ("C-c C-e" . term-send-esc
)
1419 ("C-c C-j" . term-line-mode
)
1421 ;; ("C-y" . term-paste)
1422 ("C-y" . term-send-raw
)
1423 ("M-f" . term-send-forward-word
)
1424 ("M-b" . term-send-backward-word
)
1425 ("M-p" . term-send-up
)
1426 ("M-n" . term-send-down
)
1427 ("M-j" . term-send-raw-meta
)
1428 ("M-y" . term-send-raw-meta
)
1429 ("M-/" . term-send-raw-meta
)
1430 ("M-0" . term-send-raw-meta
)
1431 ("M-1" . term-send-raw-meta
)
1432 ("M-2" . term-send-raw-meta
)
1433 ("M-3" . term-send-raw-meta
)
1434 ("M-4" . term-send-raw-meta
)
1435 ("M-5" . term-send-raw-meta
)
1436 ("M-6" . term-send-raw-meta
)
1437 ("M-7" . term-send-raw-meta
)
1438 ("M-8" . term-send-raw-meta
)
1439 ("M-9" . term-send-raw-meta
)
1440 ("<C-backspace>" . term-send-backward-kill-word
)
1441 ("<M-DEL>" . term-send-backward-kill-word
)
1442 ("M-d" . term-send-delete-word
)
1443 ("M-," . term-send-raw
)
1444 ("M-." . comint-dynamic-complete
))
1445 term-unbind-key-alist
1446 '("C-z" "C-x" "C-c" "C-h"
1450 (use-package page-break-lines
1454 (page-break-lines-max-width fill-column
)
1456 (global-page-break-lines-mode))
1458 (use-package expand-region
1459 :bind
("C-=" . er
/expand-region
))
1461 (use-package multiple-cursors
1463 (("C-S-<mouse-1>" . mc
/add-cursor-on-click
)
1464 (:prefix-map b
/mc-prefix-map
1466 ("c" . mc
/edit-lines
)
1467 ("n" . mc
/mark-next-like-this
)
1468 ("p" . mc
/mark-previous-like-this
)
1469 ("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" t
)
1484 (setq yas-verbosity yas-verbosity-cur
)
1487 (use-package debbugs
)
1489 (use-package org-ref
1491 (b/setq-every
'("~/usr/org/references.bib")
1492 reftex-default-bibliography
1493 org-ref-default-bibliography
)
1495 org-ref-bibliography-notes
"~/usr/org/notes.org"
1496 org-ref-pdf-directory
"~/usr/org/bibtex-pdfs/"))
1500 :init
(setq alert-default-style
'notifications
))
1502 ;; (use-package fill-column-indicator)
1504 (use-package emojify
1505 :hook
(erc-mode . emojify-mode
))
1509 (("s-o" . other-window
)
1510 ("s-/ ." . split-window-right
)
1511 ("s-/ ," . split-window-below
)
1512 ("s-/ 0" . delete-window
)
1513 ("s-q" . delete-window
))
1515 (split-width-threshold 150))
1517 (use-package windmove
1520 (("s-h" . windmove-left
)
1521 ("s-j" . windmove-down
)
1522 ("s-k" . windmove-up
)
1523 ("s-l" . windmove-right
)
1524 ("s-H" . windmove-swap-states-left
)
1525 ("s-J" . windmove-swap-states-down
)
1526 ("s-K" . windmove-swap-states-up
)
1527 ("s-L" . windmove-swap-states-right
)))
1531 :bind
("C-c a p" . pass
)
1532 :hook
(pass-mode . View-exit
))
1535 ;;; Email (with Gnus)
1537 (defvar b
/maildir
(expand-file-name "~/mail/"))
1538 (with-eval-after-load 'recentf
1539 (add-to-list 'recentf-exclude b
/maildir
))
1542 b
/gnus-init-file
(b/etc
"gnus")
1543 mail-user-agent
'gnus-user-agent
1544 read-mail-command
'gnus
)
1547 :bind
(("s-m" . gnus
)
1548 ("s-M" . gnus-unplugged
))
1551 gnus-select-method
'(nnnil "")
1552 gnus-secondary-select-methods
1553 '((nnimap "shemshak"
1554 (nnimap-stream plain
)
1555 (nnimap-address "127.0.0.1")
1556 (nnimap-server-port 143)
1557 (nnimap-authenticator plain
)
1558 (nnimap-user "amin@shemshak.local"))
1560 (nnimap-stream plain
)
1561 (nnimap-address "127.0.0.1")
1562 (nnimap-server-port 143)
1563 (nnimap-authenticator plain
)
1564 (nnimap-user "bandali@gnu.local")
1565 (nnimap-inbox "INBOX")
1566 (nnimap-split-methods 'nnimap-split-fancy
)
1567 (nnimap-split-fancy (|
1568 ;; (: gnus-registry-split-fancy-with-parent)
1569 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1571 (list ".*emacs-devel.gnu.org" "l.gnu.emacs.devel")
1572 (list ".*help-gnu-emacs.gnu.org" "l.gnu.emacs.help")
1573 (list ".*info-gnu-emacs.gnu.org" "l.gnu.emacs.info")
1574 (list ".*emacs-orgmode.gnu.org" "l.gnu.emacs.orgmode")
1575 (list ".*emacs-tangents.gnu.org" "l.gnu.emacs.tangents")
1576 (list ".*emacsconf-discuss.gnu.org" "l.gnu.emacsconf.discuss")
1577 (list ".*emacsconf-register.gnu.org" "l.gnu.emacsconf.register")
1578 (list ".*emacsconf-submit.gnu.org" "l.gnu.emacsconf.submit")
1579 (list ".*fencepost-users.gnu.org" "l.gnu.fencepost.users")
1580 (list ".*gnunet-developers.gnu.org" "l.gnu.gnunet.developers")
1581 (list ".*help-gnunet.gnu.org" "l.gnu.gnunet.help")
1582 (list ".*bug-gnuzilla.gnu.org" "l.gnu.gnuzilla.bug")
1583 (list ".*gnuzilla-dev.gnu.org" "l.gnu.gnuzilla.dev")
1584 (list ".*guile-devel.gnu.org" "l.gnu.guile.devel")
1585 (list ".*guile-user.gnu.org" "l.gnu.guile.user")
1586 (list ".*guix-devel.gnu.org" "l.gnu.guix.devel")
1587 (list ".*help-guix.gnu.org" "l.gnu.guix.help")
1588 (list ".*info-guix.gnu.org" "l.gnu.guix.info")
1589 (list ".*savannah-hackers-public.gnu.org" "l.gnu.savannah.hackers.public")
1590 (list ".*savannah-users.gnu.org" "l.gnu.savannah.users")
1591 (list ".*www-commits.gnu.org" "l.gnu.www.commits")
1592 (list ".*www-discuss.gnu.org" "l.gnu.www.discuss")
1594 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1596 (list ".*haskell-art.we.lurk.org" "l.haskell.art")
1597 (list ".*haskell-cafe.haskell.org" "l.haskell.cafe")
1599 (list ".*atreus.freelists.org" "l.atreus")
1600 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1601 (list ".*notmuch.notmuchmail.org" "l.notmuch")
1602 (list ".*dev.lists.parabola.nu" "l.parabola.dev")
1604 (list ".*~bandali/public-inbox@lists.sr.ht" "l.~bandali.public-inbox")
1605 (list ".*~sircmpwn/free-writers-club@lists.sr.ht" "l.~sircmpwn.free-writers-club")
1606 (list ".*~sircmpwn/sr.ht-admins@lists.sr.ht" "l.~sircmpwn.srht.admins")
1607 (list ".*~sircmpwn/sr.ht-announce@lists.sr.ht" "l.~sircmpwn.srht.announce")
1608 (list ".*~sircmpwn/sr.ht-dev@lists.sr.ht" "l.~sircmpwn.srht.dev")
1609 (list ".*~sircmpwn/sr.ht-discuss@lists.sr.ht" "l.~sircmpwn.srht.discuss")
1612 (nnimap-stream plain
)
1613 (nnimap-address "127.0.0.1")
1614 (nnimap-server-port 143)
1615 (nnimap-authenticator plain
)
1616 (nnimap-user "abandali@uw.local")
1617 (nnimap-inbox "INBOX")
1618 (nnimap-split-methods 'nnimap-split-fancy
)
1619 (nnimap-split-fancy (|
1620 ;; (: gnus-registry-split-fancy-with-parent)
1622 ("subject" "\\(SE\\s-?463\\|Deliverable\\)" "course.se463-s19")
1623 (from "\\(SE\\s-?463\\|Gema\\|Hemant\\|Davood\\|Camilo\\|Reza\\|Michael\\|Sandy\\)" "course.se463-s19")
1627 (nnimap-stream plain
)
1628 (nnimap-address "127.0.0.1")
1629 (nnimap-server-port 143)
1630 (nnimap-authenticator plain
)
1631 (nnimap-user "abandali@csc.uw.local")))
1632 gnus-message-archive-group
"nnimap+shemshak:Sent"
1635 (to-address .
"atreus@freelists.org")
1636 (to-list .
"atreus@freelists.org"))
1638 (to-address .
"deepspec@lists.cs.princeton.edu")
1639 (to-list .
"deepspec@lists.cs.princeton.edu")
1640 (list-identifier .
"\\[deepspec\\]"))
1641 ("l\\.gnu\\.emacs\\.devel"
1642 (to-address .
"emacs-devel@gnu.org")
1643 (to-list .
"emacs-devel@gnu.org"))
1644 ("l\\.gnu\\.emacs\\.help"
1645 (to-address .
"help-gnu-emacs@gnu.org")
1646 (to-list .
"help-gnu-emacs@gnu.org"))
1647 ("l\\.gnu\\.emacs\\.info"
1648 (to-address .
"info-gnu-emacs@gnu.org")
1649 (to-list .
"info-gnu-emacs@gnu.org"))
1650 ("l\\.gnu\\.emacs\\.orgmode"
1651 (to-address .
"emacs-orgmode@gnu.org")
1652 (to-list .
"emacs-orgmode@gnu.org")
1653 (list-identifier .
"\\[O\\]"))
1654 ("l\\.gnu\\.emacs\\.tangents"
1655 (to-address .
"emacs-tangents@gnu.org")
1656 (to-list .
"emacs-tangents@gnu.org"))
1657 ("l\\.gnu\\.emacsconf\\.discuss"
1658 (to-address .
"emacsconf-discuss@gnu.org")
1659 (to-list .
"emacsconf-discuss@gnu.org"))
1660 ("l\\.gnu\\.emacsconf\\.register"
1661 (to-address .
"emacsconf-register@gnu.org")
1662 (to-list .
"emacsconf-register@gnu.org"))
1663 ("l\\.gnu\\.emacsconf\\.submit"
1664 (to-address .
"emacsconf-submit@gnu.org")
1665 (to-list .
"emacsconf-submit@gnu.org"))
1666 ("l\\.gnu\\.fencepost\\.users"
1667 (to-address .
"fencepost-users@gnu.org")
1668 (to-list .
"fencepost-users@gnu.org")
1669 (list-identifier .
"\\[Fencepost-users\\]"))
1670 ("l\\.gnu\\.gnunet\\.developers"
1671 (to-address .
"gnunet-developers@gnu.org")
1672 (to-list .
"gnunet-developers@gnu.org")
1673 (list-identifier .
"\\[GNUnet-developers\\]"))
1674 ("l\\.gnu\\.gnunet\\.help"
1675 (to-address .
"help-gnunet@gnu.org")
1676 (to-list .
"help-gnunet@gnu.org")
1677 (list-identifier .
"\\[Help-gnunet\\]"))
1678 ("l\\.gnu\\.gnuzilla\\.bug"
1679 (to-address .
"bug-gnuzilla@gnu.org")
1680 (to-list .
"bug-gnuzilla@gnu.org")
1681 (list-identifier .
"\\[Bug-gnuzilla\\]"))
1682 ("l\\.gnu\\.gnuzilla\\.dev"
1683 (to-address .
"gnuzilla-dev@gnu.org")
1684 (to-list .
"gnuzilla-dev@gnu.org")
1685 (list-identifier .
"\\[Gnuzilla-dev\\]"))
1686 ("l\\.gnu\\.guile\\.devel"
1687 (to-address .
"guile-devel@gnu.org")
1688 (to-list .
"guile-devel@gnu.org"))
1689 ("l\\.gnu\\.guile\\.user"
1690 (to-address .
"guile-user@gnu.org")
1691 (to-list .
"guile-user@gnu.org"))
1692 ("l\\.gnu\\.guix\\.devel"
1693 (to-address .
"guix-devel@gnu.org")
1694 (to-list .
"guix-devel@gnu.org"))
1695 ("l\\.gnu\\.guix\\.help"
1696 (to-address .
"help-guix@gnu.org")
1697 (to-list .
"help-guix@gnu.org"))
1698 ("l\\.gnu\\.guix\\.info"
1699 (to-address .
"info-guix@gnu.org")
1700 (to-list .
"info-guix@gnu.org"))
1701 ("l\\.gnu\\.savannah\\.hackers\\.public"
1702 (to-address .
"savannah-hackers-public@gnu.org")
1703 (to-list .
"savannah-hackers-public@gnu.org"))
1704 ("l\\.gnu\\.savannah\\.users"
1705 (to-address .
"savannah-users@gnu.org")
1706 (to-list .
"savannah-users@gnu.org"))
1707 ("l\\.gnu\\.www\\.commits"
1708 (to-address .
"www-commits@gnu.org")
1709 (to-list .
"www-commits@gnu.org"))
1710 ("l\\.gnu\\.www\\.discuss"
1711 (to-address .
"www-discuss@gnu.org")
1712 (to-list .
"www-discuss@gnu.org"))
1713 ("l\\.haskell\\.art"
1714 (to-address .
"haskell-art@we.lurk.org")
1715 (to-list .
"haskell-art@we.lurk.org")
1716 (list-identifier .
"\\[haskell-art\\]"))
1717 ("l\\.haskell\\.cafe"
1718 (to-address .
"haskell-cafe@haskell.org")
1719 (to-list .
"haskell-cafe@haskell.org")
1720 (list-identifier .
"\\[Haskell-cafe\\]"))
1722 (to-address .
"notmuch@notmuchmail.org")
1723 (to-list .
"notmuch@notmuchmail.org"))
1724 ("l\\.parabola\\.dev"
1725 (to-address .
"dev@lists.parabola.nu")
1726 (to-list .
"dev@lists.parabola.nu")
1727 (list-identifier .
"\\[Dev\\]"))
1728 ("l\\.~bandali\\.public-inbox"
1729 (to-address .
"~bandali/public-inbox@lists.sr.ht")
1730 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
1731 ("l\\.~sircmpwn\\.free-writers-club"
1732 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
1733 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
1734 ("l\\.~sircmpwn\\.srht\\.admins"
1735 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
1736 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
1737 ("l\\.~sircmpwn\\.srht\\.announce"
1738 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
1739 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
1740 ("l\\.~sircmpwn\\.srht\\.dev"
1741 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
1742 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
1743 ("l\\.~sircmpwn\\.srht\\.discuss"
1744 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
1745 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
1747 (to-address .
"webmasters@gnu.org")
1748 (to-list .
"webmasters@gnu.org"))
1755 gnus-large-newsgroup
50
1756 gnus-home-directory
(b/var
"gnus/")
1757 gnus-directory
(concat gnus-home-directory
"news/")
1758 message-directory
(concat gnus-home-directory
"mail/")
1759 nndraft-directory
(concat gnus-home-directory
"drafts/")
1760 gnus-save-newsrc-file nil
1761 gnus-read-newsrc-file nil
1762 gnus-interactive-exit nil
1763 gnus-gcc-mark-as-read t
)
1769 (require 'ebdb-gnus
))
1771 ;; (gnus-registry-initialize)
1773 (with-eval-after-load 'recentf
1774 (add-to-list 'recentf-exclude gnus-home-directory
)))
1776 (use-package gnus-art
1779 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
1780 gnus-visible-headers
1781 (concat gnus-visible-headers
"\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
1782 gnus-sorted-header-list
1783 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
1784 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
1785 "^Newsgroups:" "List-Id:" "^Organization:"
1786 "^User-Agent:" "^Date:")
1787 ;; local-lapsed article dates
1788 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1789 gnus-article-date-headers
'(user-defined)
1790 gnus-article-time-format
1792 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
1793 (local (article-make-date-line date
'local
))
1794 (combined-lapsed (article-make-date-line date
1797 (string-match " (.+" combined-lapsed
)
1798 (match-string 0 combined-lapsed
))))
1799 (concat local lapsed
))))
1801 :map gnus-article-mode-map
1802 ("M-L" . org-store-link
)))
1804 (use-package gnus-sum
1805 :bind
(:map gnus-summary-mode-map
1806 :prefix-map b
/gnus-summary-prefix-map
1808 ("r" . gnus-summary-reply
)
1809 ("w" . gnus-summary-wide-reply
)
1810 ("v" . gnus-summary-show-raw-article
))
1813 :map gnus-summary-mode-map
1814 ("M-L" . org-store-link
))
1815 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
))
1817 (use-package gnus-msg
1819 (defvar b
/signature
"Amin Bandali
1820 Free Software Activist | GNU Webmaster & Volunteer
1821 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1822 https://shemshak.org/~amin")
1823 (defvar b
/gnu-signature
"Amin Bandali
1824 Free Software Activist | GNU Webmaster & Volunteer
1825 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1826 https://bandalis.org")
1827 (defvar b
/uw-signature
"Amin Bandali, MMath Student
1828 Cheriton School of Computer Science
1829 University of Waterloo
1830 https://bandalis.org")
1831 (defvar b
/csc-signature
"Amin Bandali
1832 Termcom, Computer Science Club
1833 University of Waterloo
1834 https://bandalis.org")
1835 (setq gnus-posting-styles
1837 (address "amin@shemshak.org")
1839 (signature b
/signature
)
1840 (eval (setq b
/message-cite-say-hi t
)))
1842 (address "bandali@gnu.org")
1843 (signature b
/gnu-signature
)
1844 (eval (set (make-local-variable 'message-user-fqdn
) "fencepost.gnu.org")))
1845 ((header "subject" "ThankCRM")
1846 (to "webmasters-comment@gnu.org")
1848 (eval (setq b
/message-cite-say-hi nil
)))
1850 (address "abandali@uwaterloo.ca")
1851 (signature b
/uw-signature
))
1852 ("nnimap\\+uw:INBOX"
1853 (gcc "\"nnimap+uw:Sent Items\""))
1855 (address "abandali@csclub.uwaterloo.ca")
1856 (signature b
/csc-signature
)
1857 (gcc "nnimap+csc:Sent")))))
1859 (use-package gnus-topic
1860 :hook
(gnus-group-mode . gnus-topic-mode
)
1861 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
1863 (use-package gnus-agent
1865 (setq gnus-agent-synchronize-flags
'ask
)
1866 :hook
(gnus-group-mode . gnus-agent-mode
))
1868 (use-package gnus-group
1870 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
1873 ;; problematic with ebdb's popup, *EBDB-Gnus*
1874 (use-package gnus-win
1876 (setq gnus-use-full-window nil
)))
1878 (use-package gnus-dired
1879 :commands gnus-dired-mode
1881 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
1883 (use-package mm-decode
1885 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
1886 mm-decrypt-option
'known
1887 mm-verify-option
'known
))
1889 (use-package sendmail
1891 (setq sendmail-program
(executable-find "msmtp")
1892 ;; message-sendmail-extra-arguments '("-v" "-d")
1893 mail-specify-envelope-from t
1894 mail-envelope-from
'header
))
1896 (use-package message
1898 ;; redefine for a simplified In-Reply-To header
1899 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
1900 (defun message-make-in-reply-to ()
1901 "Return the In-Reply-To header for this message."
1902 (when message-reply-headers
1903 (let ((from (mail-header-from message-reply-headers
))
1904 (msg-id (mail-header-id message-reply-headers
)))
1908 (defconst b
/message-cite-style-format
"On %Y-%m-%d %l:%M %p, %N wrote:")
1909 (defconst message-cite-style-bandali
1910 '((message-cite-function 'message-cite-original
)
1911 (message-citation-line-function 'message-insert-formatted-citation-line
)
1912 (message-cite-reply-position 'traditional
)
1913 (message-yank-prefix "> ")
1914 (message-yank-cited-prefix ">")
1915 (message-yank-empty-prefix ">")
1916 (message-citation-line-format
1917 (if b
/message-cite-say-hi
1918 (concat "Hi %F,\n\n" b
/message-cite-style-format
)
1919 b
/message-cite-style-format
)))
1920 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
1921 (setq ;; message-cite-style 'message-cite-style-bandali
1922 message-kill-buffer-on-exit t
1923 message-send-mail-function
'message-send-mail-with-sendmail
1924 message-sendmail-envelope-from
'header
1925 message-subscribed-address-functions
1926 '(gnus-find-subscribed-addresses)
1927 message-dont-reply-to-names
1928 "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(amin@bndl\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
1931 (require 'company-ebdb
))
1932 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
1933 (message-mode . flyspell-mode
)
1934 (message-mode .
(lambda ()
1935 ;; (setq fill-column 65
1936 ;; message-fill-column 65)
1937 (make-local-variable 'company-idle-delay
)
1938 (setq company-idle-delay
0.2))))
1940 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
1941 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
1942 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
1948 (use-package mml-sec
1950 (mml-secure-openpgp-encrypt-to-self t
)
1951 (mml-secure-openpgp-sign-with-sender t
))
1953 (use-package footnote
1956 ;; (setq footnote-start-tag ""
1957 ;; footnote-end-tag ""
1958 ;; footnote-style 'unicode)
1960 (:map message-mode-map
1961 :prefix-map b
/footnote-prefix-map
1963 ("a" . footnote-add-footnote
)
1964 ("b" . footnote-back-to-message
)
1965 ("c" . footnote-cycle-style
)
1966 ("d" . footnote-delete-footnote
)
1967 ("g" . footnote-goto-footnote
)
1968 ("r" . footnote-renumber-footnotes
)
1969 ("s" . footnote-set-style
)))
1974 :straight
(:host github
:repo
"girzel/ebdb")
1976 :bind
(:map gnus-group-mode-map
("e" . ebdb
))
1978 (setq ebdb-sources
(b/var
"ebdb"))
1979 (with-eval-after-load 'swiper
1980 (add-to-list 'swiper-font-lock-exclude
'ebdb-mode t
)))
1982 (use-package ebdb-com
1985 ;; (use-package ebdb-complete
1988 ;; (ebdb-complete-enable))
1990 (use-package company-ebdb
1992 (defun company-ebdb--post-complete (_) nil
))
1994 (use-package ebdb-gnus
1997 (ebdb-gnus-window-configuration
2000 (summary 0.25 point
)
2003 (ebdb-gnus 0.3))))))
2005 (use-package ebdb-mua
2007 ;; :custom (ebdb-mua-pop-up nil)
2010 ;; (use-package ebdb-message
2014 ;; (use-package ebdb-vcard
2020 (use-package message-x
))
2023 (use-package message-x
2025 (message-x-completion-alist
2027 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
2030 (quote message-newgroups-header-regexp
))
2031 message-newgroups-header-regexp message-newsgroups-header-regexp
)
2032 . message-expand-group
))))))
2035 (use-package gnus-harvest
2036 :commands gnus-harvest-install
2039 (if (featurep 'message-x
)
2040 (gnus-harvest-install 'message-x
)
2041 (gnus-harvest-install))))
2044 ;;; IRC (with ERC and ZNC)
2047 :bind
(("C-c a e b" . erc-switch-to-buffer
)
2049 ("M-a" . erc-track-switch-buffer
))
2051 (erc-join-buffer 'bury
)
2052 (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
2053 (erc-nick "bandali")
2055 (erc-rename-buffers t
)
2056 (erc-server-reconnect-attempts 5)
2057 (erc-server-reconnect-timeout 3)
2059 (with-eval-after-load 'ivy
2060 ;; ignore channel buffer names
2061 (add-to-list 'ivy-ignore-buffers
"^#"))
2062 (defun erc-cmd-OPME ()
2063 "Request chanserv to op me."
2064 (erc-message "PRIVMSG"
2065 (format "chanserv op %s %s"
2066 (erc-default-target)
2067 (erc-current-nick)) nil
))
2068 (defun erc-cmd-DEOPME ()
2069 "Deop myself from current channel."
2070 (erc-cmd-DEOP (format "%s" (erc-current-nick))))
2071 (add-to-list 'erc-modules
'keep-place
)
2072 (add-to-list 'erc-modules
'notifications
)
2073 (add-to-list 'erc-modules
'spelling
)
2076 (add-to-list 'erc-modules
'scrolltoplace
))
2077 (erc-update-modules))
2079 (use-package erc-fill
2082 (erc-fill-column 77)
2083 (erc-fill-function 'erc-fill-static
)
2084 (erc-fill-static-center 18))
2086 (use-package erc-pcomplete
2089 (erc-pcomplete-nick-postfix ","))
2091 (use-package erc-track
2094 (erc-track-enable-keybindings nil
)
2095 (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
2096 "324" "329" "332" "333" "353" "477"))
2097 (erc-track-priority-faces-only 'all
)
2098 (erc-track-shorten-function nil
))
2100 (use-package erc-hl-nicks
2105 (use-package erc-scrolltoplace
2109 :load-path
"lisp/znc.el/"
2110 :bind
(("C-c a e e" . znc-erc
)
2111 ("C-c a e a" . znc-all
))
2113 (let ((pwd (let ((auth (auth-source-search :host
"znca")))
2115 ((null auth
) (error "Couldn't find znca's authinfo"))
2116 (t (funcall (plist-get (car auth
) :secret
)))))))
2118 `(("znc.shemshak.org" 1337 t
2119 ((freenode "amin/freenode" ,pwd
)))
2120 ("znc.shemshak.org" 1337 t
2121 ((moznet "amin/moznet" ,pwd
)))
2122 ("znc.shemshak.org" 1337 t
2123 ((oftc "amin/oftc" ,pwd
)))))))
2126 ;;; Post initialization
2128 (message "Loading %s...done (%.3fs)" user-init-file
2129 (float-time (time-subtract (current-time)
2130 b
/before-user-init-time
)))
2132 ;;; init.el ends here