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
))
129 auto-save-list-file-prefix
(b/var
"auto-save/sessions/")
130 nsm-settings-file
(b/var
"nsm-settings.el"))
132 ;; separate custom file (don't want it mixing with init.el)
136 (setq custom-file
(b/etc
"custom.el"))
137 (when (file-exists-p custom-file
)
139 ;; while at it, treat themes as safe
140 (setf custom-safe-themes t
))
142 ;; load the secrets file if it exists, otherwise show a warning
145 (load (b/etc
"secrets"))))
147 ;; better $PATH (and other environment variable) handling
148 (use-package exec-path-from-shell
151 (setq exec-path-from-shell-arguments nil
152 exec-path-from-shell-check-startup-files nil
)
154 (exec-path-from-shell-initialize)
155 ;; while we're at it, let's fix access to our running ssh-agent
156 (exec-path-from-shell-copy-env "SSH_AGENT_PID")
157 (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
159 ;; only one custom theme at a time
161 (defadvice load-theme
(before clear-previous-themes activate
)
162 "Clear existing theme settings instead of layering them"
163 (mapc #'disable-theme custom-enabled-themes
)))
165 ;; start up emacs server. see
166 ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server
169 :config
(or (server-running-p) (server-mode)))
173 (dolist (ft (fontset-list))
177 (font-spec :name
"Source Code Pro" :size
14))
181 (font-spec :name
"DejaVu Sans Mono")
188 ;; :name "Symbola monospacified for DejaVu Sans Mono")
194 ;; (font-spec :name "DejaVu Sans Mono")
200 (font-spec :name
"DejaVu Sans Mono" :size
14)
204 ;; gentler font resizing
205 (setq text-scale-mode-step
1.05)
207 ;; focus follows mouse
208 (setq mouse-autoselect-window t
)
210 (defun b/no-mouse-autoselect-window
()
211 "Conveniently disable `focus-follows-mouse'.
212 For disabling the behaviour for certain buffers and/or modes."
213 (make-local-variable 'mouse-autoselect-window
)
214 (setq mouse-autoselect-window nil
))
217 (setq ;; scroll-margin 1
218 ;; scroll-conservatively 10000
220 scroll-conservatively
10
221 scroll-preserve-screen-position
1)
226 (setq mouse-wheel-scroll-amount
'(1 ((shift) .
1)) ; one line at a time
227 mouse-wheel-progressive-speed nil
; don't accelerate scrolling
228 mouse-wheel-follow-mouse t
)) ; scroll window under mouse
230 (use-package pixel-scroll
232 :config
(pixel-scroll-mode 1))
234 ;; ask for GPG passphrase in minibuffer
237 ; this will fail if gpg>=2.1 is not available
238 (epa-pinentry-mode 'loopback
))
240 (use-package epg-config
243 ((epg-gpg-program (executable-find "gpg"))
244 (epg-pinentry-mode 'loopback
)))
249 (use-package pinentry
251 :after
(epa epg server
)
253 (setq pinentry--socket-dir server-socket-dir
)
263 (defmacro b
/setq-every
(value &rest vars
)
264 "Set all the variables from VARS to value VALUE."
265 (declare (indent defun
) (debug t
))
266 `(progn ,@(mapcar (lambda (x) (list 'setq x value
)) vars
)))
268 (defun b/start-process
(program &rest args
)
269 "Same as `start-process', but doesn't bother about name and buffer."
270 (let ((process-name (concat program
"_process"))
271 (buffer-name (generate-new-buffer-name
272 (concat program
"_output"))))
273 (apply #'start-process
274 process-name buffer-name program args
)))
276 (defun b/dired-start-process
(program &optional args
)
277 "Open current file with a PROGRAM."
278 ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can
279 ;; be nil, so remove it).
280 (apply #'b
/start-process
282 (remove nil
(list args
(dired-get-file-for-visit)))))
284 (defun b/add-elisp-section
()
288 (insert "\n\f\n;;; "))
293 ;; time and battery in mode-line
297 (setq display-time-default-load-average nil
)
303 (display-battery-mode)))
306 ;; (fringe-mode '(3 . 1))
309 ;; disable disabled commands
310 (setq disabled-command-function nil
)
312 ;; Save what I copy into clipboard from other applications into Emacs'
313 ;; kill-ring, which would allow me to still be able to easily access
314 ;; it in case I kill (cut or copy) something else inside Emacs before
315 ;; yanking (pasting) what I'd originally intended to.
316 (setq save-interprogram-paste-before-kill t
)
319 (setq enable-recursive-minibuffers t
320 resize-mini-windows t
)
322 ;; lazy-person-friendly yes/no prompts
323 (defalias 'yes-or-no-p
#'y-or-n-p
)
325 ;; i want *scratch* as my startup buffer
326 (setq initial-buffer-choice t
)
328 ;; i don't need the default hint
329 (setq initial-scratch-message nil
)
331 ;; use customizable text-mode as major mode for *scratch*
332 (setq initial-major-mode
'text-mode
)
334 ;; inhibit buffer list when more than 2 files are loaded
335 (setq inhibit-startup-buffer-menu t
)
337 ;; don't need to see the startup screen or the echo area message
338 (advice-add #'display-startup-echo-area-message
:override
#'ignore
)
339 (setq inhibit-startup-screen t
340 inhibit-startup-echo-area-message user-login-name
)
342 ;; more useful frame titles
343 (setq frame-title-format
344 '("" invocation-name
" - "
345 (:eval
(if (buffer-file-name)
346 (abbreviate-file-name (buffer-file-name))
349 ;; backups (C-h v make-backup-files RET)
350 (setq backup-by-copying t
351 backup-directory-alist
(list (cons "." (b/var
"backup/")))
353 delete-old-versions t
)
355 ;; enable automatic reloading of changed buffers and files
356 (global-auto-revert-mode 1)
357 (setq auto-revert-verbose nil
358 global-auto-revert-non-file-buffers nil
)
360 ;; always use space for indentation
363 require-final-newline t
366 ;; enable winner-mode (C-h f winner-mode RET)
369 ;; don't display *compilation* buffer on success. based on
370 ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
371 ;; instead of the now obsolete `flet'.
372 (with-eval-after-load 'compile
373 (defun b/compilation-finish-function
(buffer outstr
)
374 (unless (string-match "finished" outstr
)
375 (switch-to-buffer-other-window buffer
))
378 (setq compilation-finish-functions
#'b
/compilation-finish-function
)
382 (defadvice compilation-start
383 (around inhibit-display
384 (command &optional mode name-function highlight-regexp
))
385 (if (not (string-match "^\\(find\\|grep\\)" command
))
386 (cl-letf (((symbol-function 'display-buffer
) #'ignore
))
387 (save-window-excursion ad-do-it
))
389 (ad-activate 'compilation-start
))
391 ;; search for non-ASCII characters: i’d like non-ASCII characters such
392 ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII
393 ;; counterpart. shoutout to
394 ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html
395 (setq search-default-mode
#'char-fold-to-regexp
)
396 ;; uncomment to extend this behaviour to query-replace
397 ;; (setq replace-char-fold t)
400 (setq-default cursor-type
'bar
)
402 ;; allow scrolling in Isearch
403 (setq isearch-allow-scroll t
)
405 ;; open read-only file buffers in view-mode
406 ;; (enables niceties like `q' for quit)
407 (setq view-read-only t
)
410 :bind
("C-x v C-=" . vc-ediff
))
413 :config
(add-hook 'ediff-after-quit-hook-internal
'winner-undo
)
414 :custom
((ediff-window-setup-function 'ediff-setup-windows-plain
)
415 (ediff-split-window-function 'split-window-horizontally
)))
423 ("C-c e b" . eval-buffer
)
424 ("C-c e r" . eval-region
)
426 ("C-c e i" . emacs-init-time
)
427 ("C-c e u" . emacs-uptime
)
428 ("C-c e v" . emacs-version
)
430 ("C-c F m" . make-frame-command
)
431 ("C-c F d" . delete-frame
)
432 ("C-c F D" . server-edit
)
434 ("C-S-h C" . describe-char
)
435 ("C-S-h F" . describe-face
)
437 ("C-x k" . kill-this-buffer
)
438 ("C-x K" . kill-buffer
)
440 :map emacs-lisp-mode-map
441 ("<C-return>" . b
/add-elisp-section
))
443 (when (display-graphic-p)
444 (unbind-key "C-z" global-map
))
447 ;; for back and forward mouse keys
448 ("<mouse-8>" . previous-buffer
)
449 ("<drag-mouse-8>" . previous-buffer
)
450 ("<mouse-9>" . next-buffer
)
451 ("<drag-mouse-9>" . next-buffer
)
452 ("<drag-mouse-2>" . kill-this-buffer
)
453 ("<drag-mouse-3>" . ivy-switch-buffer
))
456 ;;; Essential packages
461 (setq org-src-tab-acts-natively t
462 org-src-preserve-indentation nil
463 org-edit-src-content-indentation
0
464 org-link-email-description-format
"Email %c: %s" ; %.30s
465 org-highlight-latex-and-related
'(entities)
466 org-use-speed-commands t
467 org-startup-folded
'content
468 org-catch-invisible-edits
'show-and-error
470 (add-to-list 'org-structure-template-alist
'("L" .
"src emacs-lisp") t
)
471 (add-to-list 'org-modules
'org-habit
)
473 (("C-c a o a" . org-agenda
)
475 ("M-L" . org-insert-last-stored-link
)
476 ("M-O" . org-toggle-link-display
)
478 :hook
((org-mode . org-indent-mode
)
479 (org-mode . auto-fill-mode
)
480 (org-mode . flyspell-mode
))
482 (org-agenda-files '("~/usr/org/todos/personal.org"
483 "~/usr/org/todos/habits.org"
484 "~/usr/org/todos/masters.org"))
485 (org-agenda-start-on-weekday 0)
486 (org-agenda-time-leading-zero t
)
487 (org-habit-graph-column 44)
488 (org-latex-packages-alist '(("" "listings") ("" "color")))
490 '(org-block-begin-line ((t (:foreground
"#5a5b5a" :background
"#1d1f21"))))
491 '(org-block ((t (:background
"#1d1f21"))))
492 '(org-latex-and-related ((t (:foreground
"#b294bb")))))
494 (use-package ox-latex
497 (setq org-latex-listings
'listings
498 ;; org-latex-prefer-user-labels t
500 (add-to-list 'org-latex-classes
501 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
502 ("\\section{%s}" .
"\\section*{%s}")
503 ("\\subsection{%s}" .
"\\subsection*{%s}")
504 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
505 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
506 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
508 (require 'ox-beamer
))
510 (use-package ox-extra
512 (ox-extras-activate '(latex-header-blocks ignore-headlines
)))
514 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
515 ;; org file. closely inspired by
516 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
517 (with-eval-after-load 'org
518 (defvar b
/show-async-tangle-results nil
519 "Keep *emacs* async buffers around for later inspection.")
521 (defvar b
/show-async-tangle-time nil
522 "Show the time spent tangling the file.")
524 (defun b/async-babel-tangle
()
525 "Tangle org file asynchronously."
527 (let* ((file-tangle-start-time (current-time))
528 (file (buffer-file-name))
529 (file-nodir (file-name-nondirectory file
))
530 ;; (async-quiet-switch "-q")
531 (file-noext (file-name-sans-extension file
)))
535 (org-babel-tangle-file ,file
))
536 (unless b
/show-async-tangle-results
539 (message "Tangled %s%s"
541 (if b
/show-async-tangle-time
543 (float-time (time-subtract (current-time)
544 ',file-tangle-start-time
)))
546 (message "Tangling %s failed" ,file-nodir
))))))))
549 'safe-local-variable-values
550 '(eval add-hook
'after-save-hook
#'b
/async-babel-tangle
'append
'local
))
552 ;; *the* right way to do git
555 :bind
(("C-x g" . magit-status
)
556 ("s-g s" . magit-status
)
557 ("s-g l" . magit-log-buffer-file
))
559 (magit-add-section-hook 'magit-status-sections-hook
560 'magit-insert-modules
561 'magit-insert-stashes
563 (setq magit-repository-directories
'(("~/" .
0)
565 (nconc magit-section-initial-visibility-alist
566 '(([unpulled status
] . show
)
567 ([unpushed status
] . show
)))
568 (setq transient-history-file
(b/var
"transient/history.el")
569 transient-levels-file
(b/etc
"transient/levels.el")
570 transient-values-file
(b/etc
"transient/values.el"))
571 :custom
(magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1
)
572 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
574 ;; recently opened files
578 ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
580 (recentf-max-saved-items 2000)
581 (recentf-save-file (b/var
"recentf-save.el")))
583 ;; smart M-x enhancement (needed by counsel for history)
586 (setq smex-save-file
(b/var
"smex-save.el")))
592 (:map ivy-minibuffer-map
593 ([escape] . keyboard-escape-quit)
594 ([S-up] . ivy-previous-history-element)
595 ([S-down] . ivy-next-history-element)
596 ("DEL" . ivy-backward-delete-char))
600 ivy-use-virtual-buffers t
601 ivy-virtual-abbreviate 'abbreviate
602 ivy-count-format "%d/%d ")
605 ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
606 ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold))))
607 ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold))))
612 :bind (("C-s" . swiper-isearch)
614 ("C-S-s" . isearch-forward)))
619 :bind (([remap execute-extended-command] . counsel-M-x)
620 ([remap find-file] . counsel-find-file)
621 ("C-c x" . counsel-M-x)
622 ("C-c f ." . counsel-find-file)
623 ("C-c f l" . counsel-find-library)
624 ("C-c f r" . counsel-recentf)
625 ("s-." . counsel-find-file)
626 ("s-r" . ivy-switch-buffer)
627 :map minibuffer-local-map
628 ("C-r" . counsel-minibuffer-history))
631 (defalias 'locate #'counsel-locate))
635 :commands (helm-M-x helm-mini helm-resume)
636 :bind (("M-x" . helm-M-x)
637 ("M-y" . helm-show-kill-ring)
638 ("C-x b" . helm-mini)
639 ("C-x C-b" . helm-buffers-list)
640 ("C-x C-f" . helm-find-files)
641 ("C-h r" . helm-info-emacs)
642 ("s-r" . helm-recentf)
643 ("C-s-r" . helm-resume)
645 ("<tab>" . helm-execute-persistent-action)
646 ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals
647 ("C-z" . helm-select-action)) ; List actions
648 :config (helm-mode 1)))
653 :bind ("C-c a s e" . eshell)
655 (eval-when-compile (defvar eshell-prompt-regexp))
656 (defun b/eshell-quit-or-delete-char (arg)
658 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
659 (eshell-life-is-too-much)
662 (defun b/eshell-clear ()
664 (let ((inhibit-read-only t))
668 (defun b/eshell-setup ()
669 (make-local-variable 'company-idle-delay)
670 (defvar company-idle-delay)
671 (setq company-idle-delay nil)
672 (bind-keys :map eshell-mode-map
673 ("C-d" . b/eshell-quit-or-delete-char)
674 ("C-S-l" . b/eshell-clear)
675 ("M-r" . counsel-esh-history)
676 ([tab] . company-complete)))
678 :hook (eshell-mode . b/eshell-setup)
680 (eshell-directory-name (b/var "eshell/"))
681 (eshell-hist-ignoredups t)
682 (eshell-input-filter 'eshell-input-filter-initial-space))
686 (("C-x C-b" . ibuffer)
687 :map ibuffer-mode-map
688 ("P" . ibuffer-backward-filter-group)
689 ("N" . ibuffer-forward-filter-group)
690 ("M-p" . ibuffer-do-print)
691 ("M-n" . ibuffer-do-shell-command-pipe-replace))
693 ;; Use human readable Size column instead of original one
694 (define-ibuffer-column size-h
695 (:name "Size" :inline t)
697 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
698 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
699 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
700 (t (format "%8d" (buffer-size)))))
702 (ibuffer-saved-filter-groups
704 ("dired" (mode . dired-mode))
705 ("org" (mode . org-mode))
708 (mode . gnus-group-mode)
709 (mode . gnus-summary-mode)
710 (mode . gnus-article-mode)
711 ;; not really, but...
712 (mode . message-mode)))
730 (mode . emacs-lisp-mode)
732 (mode . haskell-mode)
735 (mode . alloy-mode)))
739 (mode . latex-mode)))
742 (name . "^\\*scratch\\*$")
743 (name . "^\\*Messages\\*$")))
744 ("erc" (mode . erc-mode)))))
746 '((mark modified read-only locked " "
747 (name 18 18 :left :elide)
751 (mode 16 16 :left :elide)
752 " " filename-and-process)
756 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
759 :hook (prog-mode . outline-minor-mode)
760 :delight (outline-minor-mode " outl")
763 outline-minor-mode-map
764 ("<s-tab>" . outline-toggle-children)
765 ("M-p" . outline-previous-visible-heading)
766 ("M-n" . outline-next-visible-heading)
767 :prefix-map b/outline-prefix-map
769 ("TAB" . outline-toggle-children)
770 ("a" . outline-hide-body)
771 ("H" . outline-hide-body)
772 ("S" . outline-show-all)
773 ("h" . outline-hide-subtree)
774 ("s" . outline-show-subtree)))
777 :custom (ls-lisp-dirs-first t))
781 (setq dired-listing-switches "-alh"
782 ls-lisp-use-insert-directory-program nil)
784 ;; easily diff 2 marked files
785 ;; https://oremacs.com/2017/03/18/dired-ediff/
786 (defun dired-ediff-files ()
789 (defvar ediff-after-quit-hook-internal)
790 (let ((files (dired-get-marked-files))
791 (wnd (current-window-configuration)))
792 (if (<= (length files) 2)
793 (let ((file1 (car files))
794 (file2 (if (cdr files)
798 (dired-dwim-target-directory)))))
799 (if (file-newer-than-file-p file1 file2)
800 (ediff-files file2 file1)
801 (ediff-files file1 file2))
802 (add-hook 'ediff-after-quit-hook-internal
804 (setq ediff-after-quit-hook-internal nil)
805 (set-window-configuration wnd))))
806 (error "no more than 2 files should be marked"))))
809 (setq dired-guess-shell-alist-user
810 '(("\\.pdf\\'" "evince" "zathura" "okular")
811 ("\\.doc\\'" "libreoffice")
812 ("\\.docx\\'" "libreoffice")
813 ("\\.ppt\\'" "libreoffice")
814 ("\\.pptx\\'" "libreoffice")
815 ("\\.xls\\'" "libreoffice")
816 ("\\.xlsx\\'" "libreoffice")
817 ("\\.flac\\'" "mpv")))
818 :bind (:map dired-mode-map
819 ("b" . dired-up-directory)
820 ("e" . dired-ediff-files)
821 ("E" . dired-toggle-read-only)
822 ("\\" . dired-hide-details-mode)
825 (b/dired-start-process "zathura"))))
826 :hook (dired-mode . dired-hide-details-mode))
830 (temp-buffer-resize-mode)
831 (setq help-window-select t))
835 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
836 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
837 (add-to-list 'tramp-default-proxies-alist
838 (list (regexp-quote (system-name)) nil nil)))
841 :config (dash-enable-font-lock))
843 (use-package doc-view
844 :bind (:map doc-view-mode-map
845 ("M-RET" . image-previous-line)))
850 ;; highlight uncommitted changes in the left fringe
854 (setq diff-hl-draw-borders nil)
855 (global-diff-hl-mode)
856 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
858 ;; display Lisp objects at point in the echo area
860 :when (version< "25" emacs-version)
862 :config (global-eldoc-mode))
864 ;; highlight matching parens
867 :config (show-paren-mode))
869 (use-package elec-pair
871 :config (electric-pair-mode))
874 :delight (auto-fill-function " fill")
875 :config (column-number-mode))
877 ;; save minibuffer history
878 (use-package savehist
882 (savehist-file (b/var "savehist.el")))
884 ;; automatically save place in files
885 (use-package saveplace
886 :when (version< "25" emacs-version)
887 :config (save-place-mode)
889 (save-place-file (b/var "save-place.el")))
891 (use-package prog-mode
892 :config (global-prettify-symbols-mode)
893 (defun indicate-buffer-boundaries-left ()
894 (setq indicate-buffer-boundaries 'left))
895 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
897 (use-package text-mode
898 :hook (text-mode . indicate-buffer-boundaries-left))
900 (use-package conf-mode
910 (:map company-active-map
911 ([tab] . company-complete-common-or-cycle)
912 ([escape] . company-abort
))
914 (company-minimum-prefix-length 1)
915 (company-selection-wrap-around t
)
916 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
917 (company-dabbrev-downcase nil
)
918 (company-dabbrev-ignore-case nil
)
920 (global-company-mode t
))
922 (use-package flycheck
924 :hook
(prog-mode . flycheck-mode
)
926 (:map flycheck-mode-map
927 ("M-P" . flycheck-previous-error
)
928 ("M-N" . flycheck-next-error
))
930 ;; Use the load-path from running Emacs when checking elisp files
931 (setq flycheck-emacs-lisp-load-path
'inherit
)
933 ;; Only flycheck when I actually save the buffer
934 (setq flycheck-check-syntax-automatically
'(mode-enabled save
))
935 :custom
(flycheck-mode-line-prefix "flyc"))
937 (use-package flyspell
940 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
944 ;; ’ can be part of a word
945 (setq ispell-local-dictionary-alist
946 `((nil "[[:alpha:]]" "[^[:alpha:]]"
947 "['\x2019]" nil
("-B") nil utf-8
))
948 ispell-program-name
(executable-find "hunspell"))
949 ;; don't send ’ to the subprocess
950 (defun endless/replace-apostrophe
(args)
951 (cons (replace-regexp-in-string
954 (advice-add #'ispell-send-string
:filter-args
955 #'endless
/replace-apostrophe
)
957 ;; convert ' back to ’ from the subprocess
958 (defun endless/replace-quote
(args)
959 (if (not (derived-mode-p 'org-mode
))
961 (cons (replace-regexp-in-string
964 (advice-add #'ispell-parse-output
:filter-args
965 #'endless
/replace-quote
))
969 :hook
(text-mode . abbrev-mode
)
971 (abbrev-file-name (b/var
"abbrev.el")))
974 ;;; Programming modes
976 (use-package lisp-mode
978 (defun indent-spaces-mode ()
979 (setq indent-tabs-mode nil
))
980 (add-hook 'lisp-interaction-mode-hook
#'indent-spaces-mode
))
983 :delight
(reveal-mode " reveal")
984 :hook
(emacs-lisp-mode . reveal-mode
))
986 (use-package elisp-mode
987 :delight
(emacs-lisp-mode "Elisp" :major
))
991 (use-package alloy-mode
992 :straight
(:host github
:repo
"dwwmmn/alloy-mode")
994 :config
(setq alloy-basic-offset
2))
996 (use-package proof-site
; for Coq
997 :straight proof-general
)
999 (eval-when-compile (defvar lean-mode-map
))
1000 (use-package lean-mode
1002 :bind
(:map lean-mode-map
1003 ("S-SPC" . company-complete
))
1005 (require 'lean-input
)
1006 (setq default-input-method
"Lean"
1007 lean-input-tweak-all
'(lean-input-compose
1008 (lean-input-prepend "/")
1009 (lean-input-nonempty))
1010 lean-input-user-translations
'(("/" "/")))
1013 (use-package haskell-mode
1015 (setq haskell-indentation-layout-offset
4
1016 haskell-indentation-left-offset
4
1017 flycheck-checker
'haskell-hlint
1018 flycheck-disabled-checkers
'(haskell-stack-ghc haskell-ghc
)))
1022 :commands dante-mode
1023 :hook
(haskell-mode . dante-mode
))
1025 (use-package hlint-refactor
1027 :bind
(:map hlint-refactor-mode-map
1028 ("C-c l b" . hlint-refactor-refactor-buffer
)
1029 ("C-c l r" . hlint-refactor-refactor-at-point
))
1030 :hook
(haskell-mode . hlint-refactor-mode
))
1032 (use-package flycheck-haskell
1033 :after haskell-mode
)
1034 ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el
1037 (use-package sgml-mode
1039 (setq sgml-basic-offset
2))
1041 (use-package css-mode
1043 (setq css-indent-offset
2))
1045 (use-package web-mode
1049 web-mode-code-indent-offset
1050 web-mode-css-indent-offset
1051 web-mode-markup-indent-offset
))
1053 (use-package emmet-mode
1054 :after
(:any web-mode css-mode sgml-mode
)
1055 :bind
* (("C-)" . emmet-next-edit-point
)
1056 ("C-(" . emmet-prev-edit-point
))
1058 (unbind-key "C-j" emmet-mode-keymap
)
1059 (setq emmet-move-cursor-between-quotes t
)
1060 :hook
(web-mode css-mode html-mode sgml-mode
))
1063 (use-package meghanada
1065 (:map meghanada-mode-map
1066 (("C-M-o" . meghanada-optimize-import
)
1067 ("C-M-t" . meghanada-import-all
)))
1068 :hook
(java-mode . meghanada-mode
)))
1071 (use-package treemacs
1072 :config
(setq treemacs-never-persist t
))
1074 (use-package yasnippet
1076 ;; (yas-global-mode)
1079 (use-package lsp-mode
1080 :init
(setq lsp-eldoc-render-all nil
1081 lsp-highlight-symbol-at-point nil
)
1086 (use-package company-lsp
1089 (setq company-lsp-cache-candidates t
1090 company-lsp-async t
))
1094 (setq lsp-ui-sideline-update-mode
'point
))
1096 (use-package lsp-java
1098 (add-hook 'java-mode-hook
1100 (setq-local company-backends
(list 'company-lsp
))))
1102 (add-hook 'java-mode-hook
'lsp-java-enable
)
1103 (add-hook 'java-mode-hook
'flycheck-mode
)
1104 (add-hook 'java-mode-hook
'company-mode
)
1105 (add-hook 'java-mode-hook
'lsp-ui-mode
))
1107 (use-package dap-mode
1113 (use-package dap-java
1116 (use-package lsp-java-treemacs
1121 :bind
(:map eclim-mode-map
("S-SPC" . company-complete
))
1122 :hook
((java-mode . eclim-mode
)
1123 (eclim-mode .
(lambda ()
1124 (make-local-variable 'company-idle-delay
)
1125 (defvar company-idle-delay
)
1126 ;; (setq company-idle-delay 0.7)
1127 (setq company-idle-delay nil
))))
1129 (eclim-auto-save nil
)
1130 ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp")
1131 (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim")
1132 (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse"))))
1136 (make-directory (b/var
"geiser/") t
)
1137 (setq geiser-repl-history-filename
(b/var
"geiser/repl-history")))
1139 (use-package geiser-guile
1141 (setq geiser-guile-load-path
"~/src/git/guix"))
1148 (font-latex-fontify-sectioning 'color
)))
1150 (use-package go-mode
)
1152 (use-package po-mode
1154 (po-mode .
(lambda () (run-with-timer 0.1 nil
'View-exit
))))
1159 (add-to-list 'custom-theme-load-path
1161 (convert-standard-filename "lisp") user-emacs-directory
))
1162 (load-theme 'tangomod t
)
1164 (use-package smart-mode-line
1165 :commands
(sml/apply-theme
)
1169 (smart-mode-line-enable))
1173 (use-package doom-themes
))
1175 (defvar b
/org-mode-font-lock-keywords
1176 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1177 (1 '(:foreground
"#5a5b5a" :background
"#292b2b") t
) ; directive
1178 (3 '(:foreground
"#81a2be" :background
"#292b2b") t
) ; kind
1179 (4 '(:foreground
"#c5c8c6") t
)))) ; title
1181 (defun b/lights-on
()
1182 "Enable my favourite light theme."
1184 (mapc #'disable-theme custom-enabled-themes
)
1185 (load-theme 'tangomod t
)
1186 (sml/apply-theme
'automatic
)
1187 (font-lock-remove-keywords
1188 'org-mode b
/org-mode-font-lock-keywords
))
1190 (defun b/lights-off
()
1193 (mapc #'disable-theme custom-enabled-themes
)
1194 ;; (load-theme 'doom-tomorrow-night t)
1195 (sml/apply-theme
'automatic
)
1196 (font-lock-add-keywords
1197 'org-mode b
/org-mode-font-lock-keywords t
))
1200 ("s-t d" . b
/lights-off
)
1201 ("s-t l" . b
/lights-on
))
1204 ;;; Emacs enhancements & auxiliary packages
1207 :config
(setq Man-width
80))
1209 (use-package which-key
1213 (which-key-add-key-based-replacements
1214 ;; prefixes for global prefixes and minor modes
1218 "C-c 8 -" "typo/dashes"
1219 "C-c 8 <" "typo/left-brackets"
1220 "C-c 8 >" "typo/right-brackets"
1222 "C-x a" "abbrev/expand"
1223 "C-x r" "rectangle/register/bookmark"
1224 "C-x v" "version control"
1225 ;; prefixes for my personal bindings
1226 "C-c a" "applications"
1230 "C-c p" "package-management"
1231 ;; "C-c p e" "package-management/epkg"
1232 "C-c p s" "straight.el"
1235 "C-c c" "compile-and-comments"
1240 "C-c m" "multiple-cursors"
1241 "C-c P" "projectile"
1242 "C-c P s" "projectile/search"
1243 "C-c P x" "projectile/execute"
1244 "C-c P 4" "projectile/other-window"
1250 ;; prefixes for major modes
1251 (which-key-add-major-mode-key-based-replacements 'message-mode
1253 (which-key-add-major-mode-key-based-replacements 'org-mode
1254 "C-c C-v" "org-babel")
1255 (which-key-add-major-mode-key-based-replacements 'web-mode
1256 "C-c C-a" "web/attributes"
1257 "C-c C-b" "web/blocks"
1259 "C-c C-e" "web/element"
1260 "C-c C-t" "web/tags")
1264 (which-key-add-column-padding 5)
1265 (which-key-max-description-length 32))
1267 (use-package crux
; results in Waiting for git... [2 times]
1269 :bind
(("C-c b k" . crux-kill-other-buffers
)
1270 ("C-c d" . crux-duplicate-current-line-or-region
)
1271 ("C-c D" . crux-duplicate-and-comment-current-line-or-region
)
1272 ("C-c f c" . crux-copy-file-preserve-attributes
)
1273 ("C-c f d" . crux-delete-file-and-buffer
)
1274 ("C-c f r" . crux-rename-file-and-buffer
)
1275 ("C-c j" . crux-top-join-line
)
1276 ("C-S-j" . crux-top-join-line
)))
1281 :bind
(("C-a" . mwim-beginning-of-code-or-line
)
1282 ("C-e" . mwim-end-of-code-or-line
)
1283 ("<home>" . mwim-beginning-of-line-or-code
)
1284 ("<end>" . mwim-end-of-line-or-code
))))
1286 (use-package projectile
1288 :bind-keymap
("C-c P" . projectile-command-map
)
1290 (make-directory (b/var
"projectile/") t
)
1293 (defun b/projectile-mode-line-fun
()
1294 "Report project name and type in the modeline."
1295 (let ((project-name (projectile-project-name))
1296 (project-type (projectile-project-type)))
1298 projectile-mode-line-prefix
1300 (format ":%s" project-type
)
1302 (setq projectile-mode-line-function
'b
/projectile-mode-line-fun
)
1304 (defun my-projectile-invalidate-cache (&rest _args
)
1305 ;; ignore the args to `magit-checkout'
1306 (projectile-invalidate-cache nil
))
1308 (eval-after-load 'magit-branch
1310 (advice-add 'magit-checkout
1311 :after
#'my-projectile-invalidate-cache
)
1312 (advice-add 'magit-branch-and-checkout
1313 :after
#'my-projectile-invalidate-cache
)))
1315 (projectile-cache-file (b/var
"projectile/cache.el"))
1316 (projectile-completion-system 'ivy
)
1317 (projectile-known-projects-file (b/var
"projectile/known-projects.el"))
1318 (projectile-mode-line-prefix " proj"))
1320 (use-package helpful
1323 (("C-S-h c" . helpful-command
)
1324 ("C-S-h f" . helpful-callable
) ; helpful-function
1325 ("C-S-h v" . helpful-variable
)
1326 ("C-S-h k" . helpful-key
)
1327 ("C-S-h p" . helpful-at-point
)))
1331 (use-package unkillable-scratch
1334 (unkillable-scratch 1)
1336 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))))
1341 ;; | make pretty boxed quotes like this
1343 (use-package boxquote
1346 (:prefix-map b
/boxquote-prefix-map
1348 ("b" . boxquote-buffer
)
1349 ("B" . boxquote-insert-buffer
)
1350 ("d" . boxquote-defun
)
1351 ("F" . boxquote-insert-file
)
1352 ("hf" . boxquote-describe-function
)
1353 ("hk" . boxquote-describe-key
)
1354 ("hv" . boxquote-describe-variable
)
1355 ("hw" . boxquote-where-is
)
1356 ("k" . boxquote-kill
)
1357 ("p" . boxquote-paragraph
)
1358 ("q" . boxquote-boxquote
)
1359 ("r" . boxquote-region
)
1360 ("s" . boxquote-shell-command
)
1361 ("t" . boxquote-text
)
1362 ("T" . boxquote-title
)
1363 ("u" . boxquote-unbox
)
1364 ("U" . boxquote-unbox-region
)
1365 ("y" . boxquote-yank
)
1366 ("M-q" . boxquote-fill-paragraph
)
1367 ("M-w" . boxquote-kill-ring-save
))))
1369 (use-package orgalist
1370 ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
1373 :hook
(message-mode . orgalist-mode
))
1375 ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹›
1380 (typo-global-mode 1)
1381 :hook
((text-mode erc-mode
) . typo-mode
))
1383 ;; highlight TODOs in buffers
1384 (use-package hl-todo
1387 (global-hl-todo-mode))
1391 (use-package shrink-path
1395 (defvar user-
@-host
(concat (user-login-name) "@" (system-name) " "))
1396 (defun +eshell
/prompt
()
1397 (let ((base/dir
(shrink-path-prompt default-directory
)))
1398 (concat (propertize user-
@-host
'face
'default
)
1399 (propertize (car base
/dir
)
1400 'face
'font-lock-comment-face
)
1401 (propertize (cdr base
/dir
)
1402 'face
'font-lock-constant-face
)
1403 (propertize "> " 'face
'default
))))
1404 (setq eshell-prompt-regexp
(concat user-
@-host
".*> ")
1405 eshell-prompt-function
#'+eshell
/prompt
)))
1407 (use-package eshell-up
1409 :commands eshell-up
)
1411 (use-package multi-term
1413 :bind
(("C-c a s m m" . multi-term
)
1414 ("C-c a s m d" . multi-term-dedicated-toggle
)
1415 ("C-c a s m p" . multi-term-prev
)
1416 ("C-c a s m n" . multi-term-next
)
1418 ("C-c C-j" . term-char-mode
))
1420 (setq multi-term-program
"screen"
1421 multi-term-program-switches
(concat "-c"
1422 (getenv "XDG_CONFIG_HOME")
1424 ;; TODO: add separate bindings for connecting to existing
1425 ;; session vs. always creating a new one
1426 multi-term-dedicated-select-after-open-p t
1427 multi-term-dedicated-window-height
20
1428 multi-term-dedicated-max-window-height
30
1430 '(("C-c C-c" . term-interrupt-subjob
)
1431 ("C-c C-e" . term-send-esc
)
1432 ("C-c C-j" . term-line-mode
)
1434 ;; ("C-y" . term-paste)
1435 ("C-y" . term-send-raw
)
1436 ("M-f" . term-send-forward-word
)
1437 ("M-b" . term-send-backward-word
)
1438 ("M-p" . term-send-up
)
1439 ("M-n" . term-send-down
)
1440 ("M-j" . term-send-raw-meta
)
1441 ("M-y" . term-send-raw-meta
)
1442 ("M-/" . term-send-raw-meta
)
1443 ("M-0" . term-send-raw-meta
)
1444 ("M-1" . term-send-raw-meta
)
1445 ("M-2" . term-send-raw-meta
)
1446 ("M-3" . term-send-raw-meta
)
1447 ("M-4" . term-send-raw-meta
)
1448 ("M-5" . term-send-raw-meta
)
1449 ("M-6" . term-send-raw-meta
)
1450 ("M-7" . term-send-raw-meta
)
1451 ("M-8" . term-send-raw-meta
)
1452 ("M-9" . term-send-raw-meta
)
1453 ("<C-backspace>" . term-send-backward-kill-word
)
1454 ("<M-DEL>" . term-send-backward-kill-word
)
1455 ("M-d" . term-send-delete-word
)
1456 ("M-," . term-send-raw
)
1457 ("M-." . comint-dynamic-complete
))
1458 term-unbind-key-alist
1459 '("C-z" "C-x" "C-c" "C-h"
1463 (use-package page-break-lines
1467 (page-break-lines-max-width fill-column
)
1469 (global-page-break-lines-mode))
1471 (use-package expand-region
1472 :bind
("C-=" . er
/expand-region
))
1474 (use-package multiple-cursors
1476 (("C-S-<mouse-1>" . mc
/add-cursor-on-click
)
1477 (:prefix-map b
/mc-prefix-map
1479 ("c" . mc
/edit-lines
)
1480 ("n" . mc
/mark-next-like-this
)
1481 ("p" . mc
/mark-previous-like-this
)
1482 ("a" . mc
/mark-all-like-this
)))
1484 (setq mc
/list-file
(b/var
"mc-list.el")))
1492 (use-package yasnippet
1495 (defconst yas-verbosity-cur yas-verbosity
)
1496 (setq yas-verbosity
2)
1497 (setq yas-snippet-dirs
(list (b/etc
"yasnippet/snippets/")))
1498 (add-to-list 'yas-snippet-dirs
"~/src/git/guix/etc/snippets" t
)
1500 (setq yas-verbosity yas-verbosity-cur
)
1503 (use-package debbugs
)
1505 (use-package org-ref
1507 (b/setq-every
'("~/usr/org/references.bib")
1508 reftex-default-bibliography
1509 org-ref-default-bibliography
)
1511 org-ref-bibliography-notes
"~/usr/org/notes.org"
1512 org-ref-pdf-directory
"~/usr/org/bibtex-pdfs/"))
1516 :init
(setq alert-default-style
'notifications
))
1518 ;; (use-package fill-column-indicator)
1520 (use-package emojify
1522 (make-directory (b/var
"emojify/") t
)
1523 (setq emojify-emojis-dir
(b/var
"emojify/"))
1524 :hook
(erc-mode . emojify-mode
))
1528 (("s-o" . other-window
)
1529 ("s-/ ." . split-window-right
)
1530 ("s-/ ," . split-window-below
)
1531 ("s-/ 0" . delete-window
)
1532 ("s-q" . delete-window
))
1534 (split-width-threshold 150))
1536 (use-package windmove
1539 (("s-h" . windmove-left
)
1540 ("s-j" . windmove-down
)
1541 ("s-k" . windmove-up
)
1542 ("s-l" . windmove-right
)
1543 ("s-H" . windmove-swap-states-left
)
1544 ("s-J" . windmove-swap-states-down
)
1545 ("s-K" . windmove-swap-states-up
)
1546 ("s-L" . windmove-swap-states-right
)))
1550 :bind
("C-c a p" . pass
)
1551 :hook
(pass-mode . View-exit
))
1554 ;;; Email (with Gnus)
1556 (defvar b
/maildir
(expand-file-name "~/mail/"))
1557 (with-eval-after-load 'recentf
1558 (add-to-list 'recentf-exclude b
/maildir
))
1561 b
/gnus-init-file
(b/etc
"gnus")
1562 mail-user-agent
'gnus-user-agent
1563 read-mail-command
'gnus
)
1566 :bind
(("s-m" . gnus
)
1567 ("s-M" . gnus-unplugged
))
1570 gnus-select-method
'(nnnil "")
1571 gnus-secondary-select-methods
1572 '((nnimap "shemshak"
1573 (nnimap-stream plain
)
1574 (nnimap-address "127.0.0.1")
1575 (nnimap-server-port 143)
1576 (nnimap-authenticator plain
)
1577 (nnimap-user "amin@shemshak.local"))
1579 (nnimap-stream plain
)
1580 (nnimap-address "127.0.0.1")
1581 (nnimap-server-port 143)
1582 (nnimap-authenticator plain
)
1583 (nnimap-user "bandali@gnu.local")
1584 (nnimap-inbox "INBOX")
1585 (nnimap-split-methods 'nnimap-split-fancy
)
1586 (nnimap-split-fancy (|
1587 ;; (: gnus-registry-split-fancy-with-parent)
1588 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1590 (list ".*emacs-devel.gnu.org" "l.gnu.emacs.devel")
1591 (list ".*help-gnu-emacs.gnu.org" "l.gnu.emacs.help")
1592 (list ".*info-gnu-emacs.gnu.org" "l.gnu.emacs.info")
1593 (list ".*emacs-orgmode.gnu.org" "l.gnu.emacs.orgmode")
1594 (list ".*emacs-tangents.gnu.org" "l.gnu.emacs.tangents")
1595 (list ".*emacsconf-discuss.gnu.org" "l.gnu.emacsconf.discuss")
1596 (list ".*emacsconf-register.gnu.org" "l.gnu.emacsconf.register")
1597 (list ".*emacsconf-submit.gnu.org" "l.gnu.emacsconf.submit")
1598 (list ".*fencepost-users.gnu.org" "l.gnu.fencepost.users")
1599 (list ".*gnunet-developers.gnu.org" "l.gnu.gnunet.developers")
1600 (list ".*help-gnunet.gnu.org" "l.gnu.gnunet.help")
1601 (list ".*bug-gnuzilla.gnu.org" "l.gnu.gnuzilla.bug")
1602 (list ".*gnuzilla-dev.gnu.org" "l.gnu.gnuzilla.dev")
1603 (list ".*guile-devel.gnu.org" "l.gnu.guile.devel")
1604 (list ".*guile-user.gnu.org" "l.gnu.guile.user")
1605 (list ".*guix-devel.gnu.org" "l.gnu.guix.devel")
1606 (list ".*help-guix.gnu.org" "l.gnu.guix.help")
1607 (list ".*info-guix.gnu.org" "l.gnu.guix.info")
1608 (list ".*savannah-hackers-public.gnu.org" "l.gnu.savannah.hackers.public")
1609 (list ".*savannah-users.gnu.org" "l.gnu.savannah.users")
1610 (list ".*www-commits.gnu.org" "l.gnu.www.commits")
1611 (list ".*www-discuss.gnu.org" "l.gnu.www.discuss")
1613 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1615 (list ".*haskell-art.we.lurk.org" "l.haskell.art")
1616 (list ".*haskell-cafe.haskell.org" "l.haskell.cafe")
1618 (list ".*atreus.freelists.org" "l.atreus")
1619 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1620 (list ".*notmuch.notmuchmail.org" "l.notmuch")
1621 (list ".*dev.lists.parabola.nu" "l.parabola.dev")
1623 (list ".*~bandali/public-inbox@lists.sr.ht" "l.~bandali.public-inbox")
1624 (list ".*~sircmpwn/free-writers-club@lists.sr.ht" "l.~sircmpwn.free-writers-club")
1625 (list ".*~sircmpwn/sr.ht-admins@lists.sr.ht" "l.~sircmpwn.srht.admins")
1626 (list ".*~sircmpwn/sr.ht-announce@lists.sr.ht" "l.~sircmpwn.srht.announce")
1627 (list ".*~sircmpwn/sr.ht-dev@lists.sr.ht" "l.~sircmpwn.srht.dev")
1628 (list ".*~sircmpwn/sr.ht-discuss@lists.sr.ht" "l.~sircmpwn.srht.discuss")
1631 (nnimap-stream plain
)
1632 (nnimap-address "127.0.0.1")
1633 (nnimap-server-port 143)
1634 (nnimap-authenticator plain
)
1635 (nnimap-user "abandali@uw.local")
1636 (nnimap-inbox "INBOX")
1637 (nnimap-split-methods 'nnimap-split-fancy
)
1638 (nnimap-split-fancy (|
1639 ;; (: gnus-registry-split-fancy-with-parent)
1641 ("subject" "\\(SE\\s-?463\\|Deliverable\\)" "course.se463-s19")
1642 (from "\\(SE\\s-?463\\|Gema\\|Hemant\\|Davood\\|Camilo\\|Reza\\|Michael\\|Sandy\\)" "course.se463-s19")
1646 (nnimap-stream plain
)
1647 (nnimap-address "127.0.0.1")
1648 (nnimap-server-port 143)
1649 (nnimap-authenticator plain
)
1650 (nnimap-user "abandali@csc.uw.local")))
1651 gnus-message-archive-group
"nnimap+shemshak:Sent"
1654 (to-address .
"atreus@freelists.org")
1655 (to-list .
"atreus@freelists.org"))
1657 (to-address .
"deepspec@lists.cs.princeton.edu")
1658 (to-list .
"deepspec@lists.cs.princeton.edu")
1659 (list-identifier .
"\\[deepspec\\]"))
1660 ("l\\.gnu\\.emacs\\.devel"
1661 (to-address .
"emacs-devel@gnu.org")
1662 (to-list .
"emacs-devel@gnu.org"))
1663 ("l\\.gnu\\.emacs\\.help"
1664 (to-address .
"help-gnu-emacs@gnu.org")
1665 (to-list .
"help-gnu-emacs@gnu.org"))
1666 ("l\\.gnu\\.emacs\\.info"
1667 (to-address .
"info-gnu-emacs@gnu.org")
1668 (to-list .
"info-gnu-emacs@gnu.org"))
1669 ("l\\.gnu\\.emacs\\.orgmode"
1670 (to-address .
"emacs-orgmode@gnu.org")
1671 (to-list .
"emacs-orgmode@gnu.org")
1672 (list-identifier .
"\\[O\\]"))
1673 ("l\\.gnu\\.emacs\\.tangents"
1674 (to-address .
"emacs-tangents@gnu.org")
1675 (to-list .
"emacs-tangents@gnu.org"))
1676 ("l\\.gnu\\.emacsconf\\.discuss"
1677 (to-address .
"emacsconf-discuss@gnu.org")
1678 (to-list .
"emacsconf-discuss@gnu.org"))
1679 ("l\\.gnu\\.emacsconf\\.register"
1680 (to-address .
"emacsconf-register@gnu.org")
1681 (to-list .
"emacsconf-register@gnu.org"))
1682 ("l\\.gnu\\.emacsconf\\.submit"
1683 (to-address .
"emacsconf-submit@gnu.org")
1684 (to-list .
"emacsconf-submit@gnu.org"))
1685 ("l\\.gnu\\.fencepost\\.users"
1686 (to-address .
"fencepost-users@gnu.org")
1687 (to-list .
"fencepost-users@gnu.org")
1688 (list-identifier .
"\\[Fencepost-users\\]"))
1689 ("l\\.gnu\\.gnunet\\.developers"
1690 (to-address .
"gnunet-developers@gnu.org")
1691 (to-list .
"gnunet-developers@gnu.org")
1692 (list-identifier .
"\\[GNUnet-developers\\]"))
1693 ("l\\.gnu\\.gnunet\\.help"
1694 (to-address .
"help-gnunet@gnu.org")
1695 (to-list .
"help-gnunet@gnu.org")
1696 (list-identifier .
"\\[Help-gnunet\\]"))
1697 ("l\\.gnu\\.gnuzilla\\.bug"
1698 (to-address .
"bug-gnuzilla@gnu.org")
1699 (to-list .
"bug-gnuzilla@gnu.org")
1700 (list-identifier .
"\\[Bug-gnuzilla\\]"))
1701 ("l\\.gnu\\.gnuzilla\\.dev"
1702 (to-address .
"gnuzilla-dev@gnu.org")
1703 (to-list .
"gnuzilla-dev@gnu.org")
1704 (list-identifier .
"\\[Gnuzilla-dev\\]"))
1705 ("l\\.gnu\\.guile\\.devel"
1706 (to-address .
"guile-devel@gnu.org")
1707 (to-list .
"guile-devel@gnu.org"))
1708 ("l\\.gnu\\.guile\\.user"
1709 (to-address .
"guile-user@gnu.org")
1710 (to-list .
"guile-user@gnu.org"))
1711 ("l\\.gnu\\.guix\\.devel"
1712 (to-address .
"guix-devel@gnu.org")
1713 (to-list .
"guix-devel@gnu.org"))
1714 ("l\\.gnu\\.guix\\.help"
1715 (to-address .
"help-guix@gnu.org")
1716 (to-list .
"help-guix@gnu.org"))
1717 ("l\\.gnu\\.guix\\.info"
1718 (to-address .
"info-guix@gnu.org")
1719 (to-list .
"info-guix@gnu.org"))
1720 ("l\\.gnu\\.savannah\\.hackers\\.public"
1721 (to-address .
"savannah-hackers-public@gnu.org")
1722 (to-list .
"savannah-hackers-public@gnu.org"))
1723 ("l\\.gnu\\.savannah\\.users"
1724 (to-address .
"savannah-users@gnu.org")
1725 (to-list .
"savannah-users@gnu.org"))
1726 ("l\\.gnu\\.www\\.commits"
1727 (to-address .
"www-commits@gnu.org")
1728 (to-list .
"www-commits@gnu.org"))
1729 ("l\\.gnu\\.www\\.discuss"
1730 (to-address .
"www-discuss@gnu.org")
1731 (to-list .
"www-discuss@gnu.org"))
1732 ("l\\.haskell\\.art"
1733 (to-address .
"haskell-art@we.lurk.org")
1734 (to-list .
"haskell-art@we.lurk.org")
1735 (list-identifier .
"\\[haskell-art\\]"))
1736 ("l\\.haskell\\.cafe"
1737 (to-address .
"haskell-cafe@haskell.org")
1738 (to-list .
"haskell-cafe@haskell.org")
1739 (list-identifier .
"\\[Haskell-cafe\\]"))
1741 (to-address .
"notmuch@notmuchmail.org")
1742 (to-list .
"notmuch@notmuchmail.org"))
1743 ("l\\.parabola\\.dev"
1744 (to-address .
"dev@lists.parabola.nu")
1745 (to-list .
"dev@lists.parabola.nu")
1746 (list-identifier .
"\\[Dev\\]"))
1747 ("l\\.~bandali\\.public-inbox"
1748 (to-address .
"~bandali/public-inbox@lists.sr.ht")
1749 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
1750 ("l\\.~sircmpwn\\.free-writers-club"
1751 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
1752 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
1753 ("l\\.~sircmpwn\\.srht\\.admins"
1754 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
1755 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
1756 ("l\\.~sircmpwn\\.srht\\.announce"
1757 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
1758 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
1759 ("l\\.~sircmpwn\\.srht\\.dev"
1760 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
1761 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
1762 ("l\\.~sircmpwn\\.srht\\.discuss"
1763 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
1764 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
1766 (to-address .
"webmasters@gnu.org")
1767 (to-list .
"webmasters@gnu.org"))
1774 gnus-large-newsgroup
50
1775 gnus-home-directory
(b/var
"gnus/")
1776 gnus-directory
(concat gnus-home-directory
"news/")
1777 message-directory
(concat gnus-home-directory
"mail/")
1778 nndraft-directory
(concat gnus-home-directory
"drafts/")
1779 gnus-save-newsrc-file nil
1780 gnus-read-newsrc-file nil
1781 gnus-interactive-exit nil
1782 gnus-gcc-mark-as-read t
)
1788 (require 'ebdb-gnus
))
1790 ;; (gnus-registry-initialize)
1792 (with-eval-after-load 'recentf
1793 (add-to-list 'recentf-exclude gnus-home-directory
)))
1795 (use-package gnus-art
1798 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
1799 gnus-visible-headers
1800 (concat gnus-visible-headers
"\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
1801 gnus-sorted-header-list
1802 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
1803 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
1804 "^Newsgroups:" "List-Id:" "^Organization:"
1805 "^User-Agent:" "^Date:")
1806 ;; local-lapsed article dates
1807 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1808 gnus-article-date-headers
'(user-defined)
1809 gnus-article-time-format
1811 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
1812 (local (article-make-date-line date
'local
))
1813 (combined-lapsed (article-make-date-line date
1816 (string-match " (.+" combined-lapsed
)
1817 (match-string 0 combined-lapsed
))))
1818 (concat local lapsed
))))
1820 :map gnus-article-mode-map
1821 ("M-L" . org-store-link
)))
1823 (use-package gnus-sum
1824 :bind
(:map gnus-summary-mode-map
1825 :prefix-map b
/gnus-summary-prefix-map
1827 ("r" . gnus-summary-reply
)
1828 ("w" . gnus-summary-wide-reply
)
1829 ("v" . gnus-summary-show-raw-article
))
1832 :map gnus-summary-mode-map
1833 ("M-L" . org-store-link
))
1834 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
))
1836 (use-package gnus-msg
1838 (defvar b
/signature
"Amin Bandali
1839 Free Software Activist | GNU Webmaster & Volunteer
1840 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1841 https://shemshak.org/~amin")
1842 (defvar b
/gnu-signature
"Amin Bandali
1843 Free Software Activist | GNU Webmaster & Volunteer
1844 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1845 https://bandalis.org")
1846 (defvar b
/uw-signature
"Amin Bandali, MMath Student
1847 Cheriton School of Computer Science
1848 University of Waterloo
1849 https://bandalis.org")
1850 (defvar b
/csc-signature
"Amin Bandali
1851 Termcom, Computer Science Club
1852 University of Waterloo
1853 https://bandalis.org")
1854 (setq gnus-posting-styles
1856 (address "amin@shemshak.org")
1858 (signature b
/signature
)
1859 (eval (setq b
/message-cite-say-hi t
)))
1861 (address "bandali@gnu.org")
1862 (signature b
/gnu-signature
)
1863 (eval (set (make-local-variable 'message-user-fqdn
) "fencepost.gnu.org")))
1864 ((header "subject" "ThankCRM")
1865 (to "webmasters-comment@gnu.org")
1867 (eval (setq b
/message-cite-say-hi nil
)))
1869 (address "abandali@uwaterloo.ca")
1870 (signature b
/uw-signature
))
1871 ("nnimap\\+uw:INBOX"
1872 (gcc "\"nnimap+uw:Sent Items\""))
1874 (address "abandali@csclub.uwaterloo.ca")
1875 (signature b
/csc-signature
)
1876 (gcc "nnimap+csc:Sent")))))
1878 (use-package gnus-topic
1879 :hook
(gnus-group-mode . gnus-topic-mode
)
1880 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
1882 (use-package gnus-agent
1884 (setq gnus-agent-synchronize-flags
'ask
)
1885 :hook
(gnus-group-mode . gnus-agent-mode
))
1887 (use-package gnus-group
1889 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
1892 ;; problematic with ebdb's popup, *EBDB-Gnus*
1893 (use-package gnus-win
1895 (setq gnus-use-full-window nil
)))
1897 (use-package gnus-dired
1898 :commands gnus-dired-mode
1900 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
1902 (use-package mm-decode
1904 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
1905 mm-decrypt-option
'known
1906 mm-verify-option
'known
))
1908 (use-package sendmail
1910 (setq sendmail-program
(executable-find "msmtp")
1911 ;; message-sendmail-extra-arguments '("-v" "-d")
1912 mail-specify-envelope-from t
1913 mail-envelope-from
'header
))
1915 (use-package message
1917 ;; redefine for a simplified In-Reply-To header
1918 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
1919 (defun message-make-in-reply-to ()
1920 "Return the In-Reply-To header for this message."
1921 (when message-reply-headers
1922 (let ((from (mail-header-from message-reply-headers
))
1923 (msg-id (mail-header-id message-reply-headers
)))
1927 (defconst b
/message-cite-style-format
"On %Y-%m-%d %l:%M %p, %N wrote:")
1928 (defconst message-cite-style-bandali
1929 '((message-cite-function 'message-cite-original
)
1930 (message-citation-line-function 'message-insert-formatted-citation-line
)
1931 (message-cite-reply-position 'traditional
)
1932 (message-yank-prefix "> ")
1933 (message-yank-cited-prefix ">")
1934 (message-yank-empty-prefix ">")
1935 (message-citation-line-format
1936 (if b
/message-cite-say-hi
1937 (concat "Hi %F,\n\n" b
/message-cite-style-format
)
1938 b
/message-cite-style-format
)))
1939 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
1940 (setq ;; message-cite-style 'message-cite-style-bandali
1941 message-kill-buffer-on-exit t
1942 message-send-mail-function
'message-send-mail-with-sendmail
1943 message-sendmail-envelope-from
'header
1944 message-subscribed-address-functions
1945 '(gnus-find-subscribed-addresses)
1946 message-dont-reply-to-names
1947 "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(amin@bndl\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
1950 (require 'company-ebdb
))
1951 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
1952 (message-mode . flyspell-mode
)
1953 (message-mode .
(lambda ()
1954 ;; (setq fill-column 65
1955 ;; message-fill-column 65)
1956 (make-local-variable 'company-idle-delay
)
1957 (setq company-idle-delay
0.2))))
1959 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
1960 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
1961 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
1967 (use-package mml-sec
1969 (mml-secure-openpgp-encrypt-to-self t
)
1970 (mml-secure-openpgp-sign-with-sender t
))
1972 (use-package footnote
1975 ;; (setq footnote-start-tag ""
1976 ;; footnote-end-tag ""
1977 ;; footnote-style 'unicode)
1979 (:map message-mode-map
1980 :prefix-map b
/footnote-prefix-map
1982 ("a" . footnote-add-footnote
)
1983 ("b" . footnote-back-to-message
)
1984 ("c" . footnote-cycle-style
)
1985 ("d" . footnote-delete-footnote
)
1986 ("g" . footnote-goto-footnote
)
1987 ("r" . footnote-renumber-footnotes
)
1988 ("s" . footnote-set-style
)))
1993 :straight
(:host github
:repo
"girzel/ebdb")
1995 :bind
(:map gnus-group-mode-map
("e" . ebdb
))
1997 (setq ebdb-sources
(b/var
"ebdb"))
1998 (with-eval-after-load 'swiper
1999 (add-to-list 'swiper-font-lock-exclude
'ebdb-mode t
)))
2001 (use-package ebdb-com
2004 ;; (use-package ebdb-complete
2007 ;; (ebdb-complete-enable))
2009 (use-package company-ebdb
2011 (defun company-ebdb--post-complete (_) nil
))
2013 (use-package ebdb-gnus
2016 (ebdb-gnus-window-configuration
2019 (summary 0.25 point
)
2022 (ebdb-gnus 0.3))))))
2024 (use-package ebdb-mua
2026 ;; :custom (ebdb-mua-pop-up nil)
2029 ;; (use-package ebdb-message
2033 ;; (use-package ebdb-vcard
2039 (use-package message-x
))
2042 (use-package message-x
2044 (message-x-completion-alist
2046 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
2049 (quote message-newgroups-header-regexp
))
2050 message-newgroups-header-regexp message-newsgroups-header-regexp
)
2051 . message-expand-group
))))))
2054 (use-package gnus-harvest
2055 :commands gnus-harvest-install
2058 (if (featurep 'message-x
)
2059 (gnus-harvest-install 'message-x
)
2060 (gnus-harvest-install))))
2063 ;;; IRC (with ERC and ZNC)
2066 :bind
(("C-c a e b" . erc-switch-to-buffer
)
2068 ("M-a" . erc-track-switch-buffer
))
2070 (erc-join-buffer 'bury
)
2071 (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
2072 (erc-nick "bandali")
2074 (erc-rename-buffers t
)
2075 (erc-server-reconnect-attempts 5)
2076 (erc-server-reconnect-timeout 3)
2078 (with-eval-after-load 'ivy
2079 ;; ignore channel buffer names
2080 (add-to-list 'ivy-ignore-buffers
"^#"))
2081 (defun erc-cmd-OPME ()
2082 "Request chanserv to op me."
2083 (erc-message "PRIVMSG"
2084 (format "chanserv op %s %s"
2085 (erc-default-target)
2086 (erc-current-nick)) nil
))
2087 (defun erc-cmd-DEOPME ()
2088 "Deop myself from current channel."
2089 (erc-cmd-DEOP (format "%s" (erc-current-nick))))
2090 (add-to-list 'erc-modules
'keep-place
)
2091 (add-to-list 'erc-modules
'notifications
)
2092 (add-to-list 'erc-modules
'spelling
)
2095 (add-to-list 'erc-modules
'scrolltoplace
))
2096 (erc-update-modules))
2098 (use-package erc-fill
2101 (erc-fill-column 77)
2102 (erc-fill-function 'erc-fill-static
)
2103 (erc-fill-static-center 18))
2105 (use-package erc-pcomplete
2108 (erc-pcomplete-nick-postfix ","))
2110 (use-package erc-track
2113 (erc-track-enable-keybindings nil
)
2114 (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
2115 "324" "329" "332" "333" "353" "477"))
2116 (erc-track-priority-faces-only 'all
)
2117 (erc-track-shorten-function nil
))
2119 (use-package erc-hl-nicks
2124 (use-package erc-scrolltoplace
2128 :load-path
"lisp/znc.el/"
2129 :bind
(("C-c a e e" . znc-erc
)
2130 ("C-c a e a" . znc-all
))
2132 (let ((pwd (let ((auth (auth-source-search :host
"znca")))
2134 ((null auth
) (error "Couldn't find znca's authinfo"))
2135 (t (funcall (plist-get (car auth
) :secret
)))))))
2137 `(("znc.shemshak.org" 1337 t
2138 ((freenode "amin/freenode" ,pwd
)))
2139 ("znc.shemshak.org" 1337 t
2140 ((moznet "amin/moznet" ,pwd
)))
2141 ("znc.shemshak.org" 1337 t
2142 ((oftc "amin/oftc" ,pwd
)))))))
2145 ;;; Post initialization
2147 (message "Loading %s...done (%.3fs)" user-init-file
2148 (float-time (time-subtract (current-time)
2149 b
/before-user-init-time
)))
2151 ;;; init.el ends here