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 ("s-p" . beginning-of-buffer
)
439 ("s-n" . end-of-buffer
)
441 ("M-O" . facemenu-keymap
)
443 :map emacs-lisp-mode-map
444 ("<C-return>" . b
/add-elisp-section
))
446 (when (display-graphic-p)
447 (unbind-key "C-z" global-map
))
450 ;; for back and forward mouse keys
451 ("<mouse-8>" . previous-buffer
)
452 ("<drag-mouse-8>" . previous-buffer
)
453 ("<mouse-9>" . next-buffer
)
454 ("<drag-mouse-9>" . next-buffer
)
455 ("<drag-mouse-2>" . kill-this-buffer
)
456 ("<drag-mouse-3>" . ivy-switch-buffer
))
459 ;;; Essential packages
464 (setq org-src-tab-acts-natively t
465 org-src-preserve-indentation nil
466 org-edit-src-content-indentation
0
467 org-link-email-description-format
"Email %c: %s" ; %.30s
468 org-highlight-latex-and-related
'(entities)
469 org-use-speed-commands t
470 org-startup-folded
'content
471 org-catch-invisible-edits
'show-and-error
473 (add-to-list 'org-structure-template-alist
'("L" .
"src emacs-lisp") t
)
474 (add-to-list 'org-modules
'org-habit
)
476 (("C-c a o a" . org-agenda
)
478 ("M-L" . org-insert-last-stored-link
)
479 ("M-O" . org-toggle-link-display
)
481 :hook
((org-mode . org-indent-mode
)
482 (org-mode . auto-fill-mode
)
483 (org-mode . flyspell-mode
))
485 (org-agenda-files '("~/usr/org/todos/personal.org"
486 "~/usr/org/todos/habits.org"
487 "~/usr/org/todos/masters.org"))
488 (org-agenda-start-on-weekday 0)
489 (org-agenda-time-leading-zero t
)
490 (org-habit-graph-column 44)
491 (org-latex-packages-alist '(("" "listings") ("" "color")))
493 '(org-block-begin-line ((t (:foreground
"#5a5b5a" :background
"#1d1f21"))))
494 '(org-block ((t (:background
"#1d1f21"))))
495 '(org-latex-and-related ((t (:foreground
"#b294bb")))))
497 (use-package ox-latex
500 (setq org-latex-listings
'listings
501 ;; org-latex-prefer-user-labels t
503 (add-to-list 'org-latex-classes
504 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
505 ("\\section{%s}" .
"\\section*{%s}")
506 ("\\subsection{%s}" .
"\\subsection*{%s}")
507 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
508 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
509 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
511 (require 'ox-beamer
))
513 (use-package ox-extra
515 (ox-extras-activate '(latex-header-blocks ignore-headlines
)))
517 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
518 ;; org file. closely inspired by
519 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
520 (with-eval-after-load 'org
521 (defvar b
/show-async-tangle-results nil
522 "Keep *emacs* async buffers around for later inspection.")
524 (defvar b
/show-async-tangle-time nil
525 "Show the time spent tangling the file.")
527 (defun b/async-babel-tangle
()
528 "Tangle org file asynchronously."
530 (let* ((file-tangle-start-time (current-time))
531 (file (buffer-file-name))
532 (file-nodir (file-name-nondirectory file
))
533 ;; (async-quiet-switch "-q")
534 (file-noext (file-name-sans-extension file
)))
538 (org-babel-tangle-file ,file
))
539 (unless b
/show-async-tangle-results
542 (message "Tangled %s%s"
544 (if b
/show-async-tangle-time
546 (float-time (time-subtract (current-time)
547 ',file-tangle-start-time
)))
549 (message "Tangling %s failed" ,file-nodir
))))))))
552 'safe-local-variable-values
553 '(eval add-hook
'after-save-hook
#'b
/async-babel-tangle
'append
'local
))
555 ;; *the* right way to do git
558 :bind
(("C-x g" . magit-status
)
559 ("s-g s" . magit-status
)
560 ("s-g l" . magit-log-buffer-file
))
562 (magit-add-section-hook 'magit-status-sections-hook
563 'magit-insert-modules
564 'magit-insert-stashes
566 (setq magit-repository-directories
'(("~/" .
0)
568 (nconc magit-section-initial-visibility-alist
569 '(([unpulled status
] . show
)
570 ([unpushed status
] . show
)))
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)
590 (:map ivy-minibuffer-map
591 ([escape] . keyboard-escape-quit)
592 ([S-up] . ivy-previous-history-element)
593 ([S-down] . ivy-next-history-element)
594 ("DEL" . ivy-backward-delete-char))
598 ivy-use-virtual-buffers t
599 ivy-virtual-abbreviate 'abbreviate
600 ivy-count-format "%d/%d ")
603 ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
604 ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold))))
605 ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold))))
610 :bind (("C-s" . swiper-isearch)
612 ("C-S-s" . isearch-forward)))
617 :bind (([remap execute-extended-command] . counsel-M-x)
618 ([remap find-file] . counsel-find-file)
619 ("C-c x" . counsel-M-x)
620 ("C-c f ." . counsel-find-file)
621 ("C-c f l" . counsel-find-library)
622 ("C-c f r" . counsel-recentf)
623 ("s-." . counsel-find-file)
624 ("s-r" . ivy-switch-buffer)
625 :map minibuffer-local-map
626 ("C-r" . counsel-minibuffer-history))
629 (defalias 'locate #'counsel-locate))
633 :commands (helm-M-x helm-mini helm-resume)
634 :bind (("M-x" . helm-M-x)
635 ("M-y" . helm-show-kill-ring)
636 ("C-x b" . helm-mini)
637 ("C-x C-b" . helm-buffers-list)
638 ("C-x C-f" . helm-find-files)
639 ("C-h r" . helm-info-emacs)
640 ("s-r" . helm-recentf)
641 ("C-s-r" . helm-resume)
643 ("<tab>" . helm-execute-persistent-action)
644 ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals
645 ("C-z" . helm-select-action)) ; List actions
646 :config (helm-mode 1)))
651 :bind ("C-c a s e" . eshell)
653 (eval-when-compile (defvar eshell-prompt-regexp))
654 (defun b/eshell-quit-or-delete-char (arg)
656 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
657 (eshell-life-is-too-much)
660 (defun b/eshell-clear ()
662 (let ((inhibit-read-only t))
666 (defun b/eshell-setup ()
667 (make-local-variable 'company-idle-delay)
668 (defvar company-idle-delay)
669 (setq company-idle-delay nil)
670 (bind-keys :map eshell-mode-map
671 ("C-d" . b/eshell-quit-or-delete-char)
672 ("C-S-l" . b/eshell-clear)
673 ("M-r" . counsel-esh-history)
674 ([tab] . company-complete)))
676 :hook (eshell-mode . b/eshell-setup)
678 (eshell-directory-name (b/var "eshell/"))
679 (eshell-hist-ignoredups t)
680 (eshell-input-filter 'eshell-input-filter-initial-space))
684 (("C-x C-b" . ibuffer-other-window)
685 :map ibuffer-mode-map
686 ("P" . ibuffer-backward-filter-group)
687 ("N" . ibuffer-forward-filter-group)
688 ("M-p" . ibuffer-do-print)
689 ("M-n" . ibuffer-do-shell-command-pipe-replace))
691 ;; Use human readable Size column instead of original one
692 (define-ibuffer-column size-h
693 (:name "Size" :inline t)
695 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
696 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
697 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
698 (t (format "%8d" (buffer-size)))))
700 (ibuffer-saved-filter-groups
702 ("dired" (mode . dired-mode))
703 ("org" (mode . org-mode))
706 (mode . gnus-group-mode)
707 (mode . gnus-summary-mode)
708 (mode . gnus-article-mode)
709 ;; not really, but...
710 (mode . message-mode)))
728 (mode . emacs-lisp-mode)
730 (mode . haskell-mode)
733 (mode . alloy-mode)))
737 (mode . latex-mode)))
740 (name . "^\\*scratch\\*$")
741 (name . "^\\*Messages\\*$")))
742 ("erc" (mode . erc-mode)))))
744 '((mark modified read-only locked " "
745 (name 18 18 :left :elide)
749 (mode 16 16 :left :elide)
750 " " filename-and-process)
754 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
757 :hook (prog-mode . outline-minor-mode)
758 :delight (outline-minor-mode " outl")
761 outline-minor-mode-map
762 ("<s-tab>" . outline-toggle-children)
763 ("M-p" . outline-previous-visible-heading)
764 ("M-n" . outline-next-visible-heading)
765 :prefix-map b/outline-prefix-map
767 ("TAB" . outline-toggle-children)
768 ("a" . outline-hide-body)
769 ("H" . outline-hide-body)
770 ("S" . outline-show-all)
771 ("h" . outline-hide-subtree)
772 ("s" . outline-show-subtree)))
775 :custom (ls-lisp-dirs-first t))
779 (setq dired-listing-switches "-alh"
780 ls-lisp-use-insert-directory-program nil)
782 ;; easily diff 2 marked files
783 ;; https://oremacs.com/2017/03/18/dired-ediff/
784 (defun dired-ediff-files ()
787 (defvar ediff-after-quit-hook-internal)
788 (let ((files (dired-get-marked-files))
789 (wnd (current-window-configuration)))
790 (if (<= (length files) 2)
791 (let ((file1 (car files))
792 (file2 (if (cdr files)
796 (dired-dwim-target-directory)))))
797 (if (file-newer-than-file-p file1 file2)
798 (ediff-files file2 file1)
799 (ediff-files file1 file2))
800 (add-hook 'ediff-after-quit-hook-internal
802 (setq ediff-after-quit-hook-internal nil)
803 (set-window-configuration wnd))))
804 (error "no more than 2 files should be marked"))))
807 (setq dired-guess-shell-alist-user
808 '(("\\.pdf\\'" "evince" "zathura" "okular")
809 ("\\.doc\\'" "libreoffice")
810 ("\\.docx\\'" "libreoffice")
811 ("\\.ppt\\'" "libreoffice")
812 ("\\.pptx\\'" "libreoffice")
813 ("\\.xls\\'" "libreoffice")
814 ("\\.xlsx\\'" "libreoffice")
815 ("\\.flac\\'" "mpv")))
816 :bind (:map dired-mode-map
817 ("b" . dired-up-directory)
818 ("e" . dired-ediff-files)
819 ("E" . dired-toggle-read-only)
820 ("\\" . dired-hide-details-mode)
823 (b/dired-start-process "zathura"))))
824 :hook (dired-mode . dired-hide-details-mode))
828 (temp-buffer-resize-mode)
829 (setq help-window-select t))
833 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
834 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
835 (add-to-list 'tramp-default-proxies-alist
836 (list (regexp-quote (system-name)) nil nil)))
839 :config (dash-enable-font-lock))
841 (use-package doc-view
842 :bind (:map doc-view-mode-map
843 ("M-RET" . image-previous-line)))
848 ;; highlight uncommitted changes in the left fringe
852 (setq diff-hl-draw-borders nil)
853 (global-diff-hl-mode)
854 :hook (magit-post-refresh . diff-hl-magit-post-refresh))
856 ;; display Lisp objects at point in the echo area
858 :when (version< "25" emacs-version)
860 :config (global-eldoc-mode))
862 ;; highlight matching parens
865 :config (show-paren-mode))
867 (use-package elec-pair
869 :config (electric-pair-mode))
872 :delight (auto-fill-function " fill")
873 :config (column-number-mode))
875 ;; save minibuffer history
876 (use-package savehist
880 (savehist-file (b/var "savehist.el")))
882 ;; automatically save place in files
883 (use-package saveplace
884 :when (version< "25" emacs-version)
885 :config (save-place-mode)
887 (save-place-file (b/var "save-place.el")))
889 (use-package prog-mode
890 :config (global-prettify-symbols-mode)
891 (defun indicate-buffer-boundaries-left ()
892 (setq indicate-buffer-boundaries 'left))
893 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
895 (use-package text-mode
896 :hook (text-mode . indicate-buffer-boundaries-left))
898 (use-package conf-mode
908 (:map company-active-map
909 ([tab] . company-complete-common-or-cycle)
910 ([escape] . company-abort
))
912 (company-minimum-prefix-length 1)
913 (company-selection-wrap-around t
)
914 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
915 (company-dabbrev-downcase nil
)
916 (company-dabbrev-ignore-case nil
)
918 (global-company-mode t
))
920 (use-package flycheck
922 :hook
(prog-mode . flycheck-mode
)
924 (:map flycheck-mode-map
925 ("M-P" . flycheck-previous-error
)
926 ("M-N" . flycheck-next-error
))
928 ;; Use the load-path from running Emacs when checking elisp files
929 (setq flycheck-emacs-lisp-load-path
'inherit
)
931 ;; Only flycheck when I actually save the buffer
932 (setq flycheck-check-syntax-automatically
'(mode-enabled save
))
933 :custom
(flycheck-mode-line-prefix "flyc"))
935 (use-package flyspell
938 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
942 ;; ’ can be part of a word
943 (setq ispell-local-dictionary-alist
944 `((nil "[[:alpha:]]" "[^[:alpha:]]"
945 "['\x2019]" nil
("-B") nil utf-8
))
946 ispell-program-name
(executable-find "hunspell"))
947 ;; don't send ’ to the subprocess
948 (defun endless/replace-apostrophe
(args)
949 (cons (replace-regexp-in-string
952 (advice-add #'ispell-send-string
:filter-args
953 #'endless
/replace-apostrophe
)
955 ;; convert ' back to ’ from the subprocess
956 (defun endless/replace-quote
(args)
957 (if (not (derived-mode-p 'org-mode
))
959 (cons (replace-regexp-in-string
962 (advice-add #'ispell-parse-output
:filter-args
963 #'endless
/replace-quote
))
967 :hook
(text-mode . abbrev-mode
)
969 (abbrev-file-name (b/var
"abbrev.el")))
972 ;;; Programming modes
974 (use-package lisp-mode
976 (defun indent-spaces-mode ()
977 (setq indent-tabs-mode nil
))
978 (add-hook 'lisp-interaction-mode-hook
#'indent-spaces-mode
))
981 :delight
(reveal-mode " reveal")
982 :hook
(emacs-lisp-mode . reveal-mode
))
984 (use-package elisp-mode
985 :delight
(emacs-lisp-mode "Elisp" :major
))
989 (use-package alloy-mode
990 :straight
(:host github
:repo
"dwwmmn/alloy-mode")
992 :config
(setq alloy-basic-offset
2))
994 (use-package proof-site
; for Coq
995 :straight proof-general
)
997 (eval-when-compile (defvar lean-mode-map
))
998 (use-package lean-mode
1000 :bind
(:map lean-mode-map
1001 ("S-SPC" . company-complete
))
1003 (require 'lean-input
)
1004 (setq default-input-method
"Lean"
1005 lean-input-tweak-all
'(lean-input-compose
1006 (lean-input-prepend "/")
1007 (lean-input-nonempty))
1008 lean-input-user-translations
'(("/" "/")))
1011 (use-package haskell-mode
1013 (setq haskell-indentation-layout-offset
4
1014 haskell-indentation-left-offset
4
1015 flycheck-checker
'haskell-hlint
1016 flycheck-disabled-checkers
'(haskell-stack-ghc haskell-ghc
)))
1020 :commands dante-mode
1021 :hook
(haskell-mode . dante-mode
))
1023 (use-package hlint-refactor
1025 :bind
(:map hlint-refactor-mode-map
1026 ("C-c l b" . hlint-refactor-refactor-buffer
)
1027 ("C-c l r" . hlint-refactor-refactor-at-point
))
1028 :hook
(haskell-mode . hlint-refactor-mode
))
1030 (use-package flycheck-haskell
1031 :after haskell-mode
)
1032 ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el
1035 (use-package sgml-mode
1037 (setq sgml-basic-offset
2))
1039 (use-package css-mode
1041 (setq css-indent-offset
2))
1043 (use-package web-mode
1047 web-mode-code-indent-offset
1048 web-mode-css-indent-offset
1049 web-mode-markup-indent-offset
))
1051 (use-package emmet-mode
1052 :after
(:any web-mode css-mode sgml-mode
)
1053 :bind
* (("C-)" . emmet-next-edit-point
)
1054 ("C-(" . emmet-prev-edit-point
))
1056 (unbind-key "C-j" emmet-mode-keymap
)
1057 (setq emmet-move-cursor-between-quotes t
)
1058 :hook
(web-mode css-mode html-mode sgml-mode
))
1061 (use-package meghanada
1063 (:map meghanada-mode-map
1064 (("C-M-o" . meghanada-optimize-import
)
1065 ("C-M-t" . meghanada-import-all
)))
1066 :hook
(java-mode . meghanada-mode
)))
1069 (use-package treemacs
1070 :config
(setq treemacs-never-persist t
))
1072 (use-package yasnippet
1074 ;; (yas-global-mode)
1077 (use-package lsp-mode
1078 :init
(setq lsp-eldoc-render-all nil
1079 lsp-highlight-symbol-at-point nil
)
1084 (use-package company-lsp
1087 (setq company-lsp-cache-candidates t
1088 company-lsp-async t
))
1092 (setq lsp-ui-sideline-update-mode
'point
))
1094 (use-package lsp-java
1096 (add-hook 'java-mode-hook
1098 (setq-local company-backends
(list 'company-lsp
))))
1100 (add-hook 'java-mode-hook
'lsp-java-enable
)
1101 (add-hook 'java-mode-hook
'flycheck-mode
)
1102 (add-hook 'java-mode-hook
'company-mode
)
1103 (add-hook 'java-mode-hook
'lsp-ui-mode
))
1105 (use-package dap-mode
1111 (use-package dap-java
1114 (use-package lsp-java-treemacs
1119 :bind
(:map eclim-mode-map
("S-SPC" . company-complete
))
1120 :hook
((java-mode . eclim-mode
)
1121 (eclim-mode .
(lambda ()
1122 (make-local-variable 'company-idle-delay
)
1123 (defvar company-idle-delay
)
1124 ;; (setq company-idle-delay 0.7)
1125 (setq company-idle-delay nil
))))
1127 (eclim-auto-save nil
)
1128 ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp")
1129 (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim")
1130 (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse"))))
1132 (use-package geiser
)
1134 (use-package geiser-guile
1136 (setq geiser-guile-load-path
"~/src/git/guix"))
1143 (font-latex-fontify-sectioning 'color
)))
1145 (use-package go-mode
)
1147 (use-package po-mode
1149 (po-mode .
(lambda () (run-with-timer 0.1 nil
'View-exit
))))
1154 (add-to-list 'custom-theme-load-path
1156 (convert-standard-filename "lisp") user-emacs-directory
))
1157 (load-theme 'tangomod t
)
1159 (use-package smart-mode-line
1160 :commands
(sml/apply-theme
)
1164 (smart-mode-line-enable))
1168 (use-package doom-themes
))
1170 (defvar b
/org-mode-font-lock-keywords
1171 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
1172 (1 '(:foreground
"#5a5b5a" :background
"#292b2b") t
) ; directive
1173 (3 '(:foreground
"#81a2be" :background
"#292b2b") t
) ; kind
1174 (4 '(:foreground
"#c5c8c6") t
)))) ; title
1176 (defun b/lights-on
()
1177 "Enable my favourite light theme."
1179 (mapc #'disable-theme custom-enabled-themes
)
1180 (load-theme 'tangomod t
)
1181 (sml/apply-theme
'automatic
)
1182 (font-lock-remove-keywords
1183 'org-mode b
/org-mode-font-lock-keywords
))
1185 (defun b/lights-off
()
1188 (mapc #'disable-theme custom-enabled-themes
)
1189 ;; (load-theme 'doom-tomorrow-night t)
1190 (sml/apply-theme
'automatic
)
1191 (font-lock-add-keywords
1192 'org-mode b
/org-mode-font-lock-keywords t
))
1195 ("s-t d" . b
/lights-off
)
1196 ("s-t l" . b
/lights-on
))
1199 ;;; Emacs enhancements & auxiliary packages
1202 :config
(setq Man-width
80))
1204 (use-package which-key
1208 (which-key-add-key-based-replacements
1209 ;; prefixes for global prefixes and minor modes
1213 "C-c 8 -" "typo/dashes"
1214 "C-c 8 <" "typo/left-brackets"
1215 "C-c 8 >" "typo/right-brackets"
1217 "C-x a" "abbrev/expand"
1218 "C-x r" "rectangle/register/bookmark"
1219 "C-x v" "version control"
1220 ;; prefixes for my personal bindings
1221 "C-c a" "applications"
1225 "C-c p" "package-management"
1226 ;; "C-c p e" "package-management/epkg"
1227 "C-c p s" "straight.el"
1230 "C-c c" "compile-and-comments"
1235 "C-c m" "multiple-cursors"
1236 "C-c P" "projectile"
1237 "C-c P s" "projectile/search"
1238 "C-c P x" "projectile/execute"
1239 "C-c P 4" "projectile/other-window"
1245 ;; prefixes for major modes
1246 (which-key-add-major-mode-key-based-replacements 'message-mode
1248 (which-key-add-major-mode-key-based-replacements 'org-mode
1249 "C-c C-v" "org-babel")
1250 (which-key-add-major-mode-key-based-replacements 'web-mode
1251 "C-c C-a" "web/attributes"
1252 "C-c C-b" "web/blocks"
1254 "C-c C-e" "web/element"
1255 "C-c C-t" "web/tags")
1259 (which-key-add-column-padding 5)
1260 (which-key-max-description-length 32))
1262 (use-package crux
; results in Waiting for git... [2 times]
1264 :bind
(("C-c b k" . crux-kill-other-buffers
)
1265 ("C-c d" . crux-duplicate-current-line-or-region
)
1266 ("C-c D" . crux-duplicate-and-comment-current-line-or-region
)
1267 ("C-c f c" . crux-copy-file-preserve-attributes
)
1268 ("C-c f d" . crux-delete-file-and-buffer
)
1269 ("C-c f r" . crux-rename-file-and-buffer
)
1270 ("C-c j" . crux-top-join-line
)
1271 ("C-S-j" . crux-top-join-line
)))
1276 :bind
(("C-a" . mwim-beginning-of-code-or-line
)
1277 ("C-e" . mwim-end-of-code-or-line
)
1278 ("<home>" . mwim-beginning-of-line-or-code
)
1279 ("<end>" . mwim-end-of-line-or-code
))))
1281 (use-package projectile
1283 :bind-keymap
("C-c P" . projectile-command-map
)
1287 (defun b/projectile-mode-line-fun
()
1288 "Report project name and type in the modeline."
1289 (let ((project-name (projectile-project-name))
1290 (project-type (projectile-project-type)))
1292 projectile-mode-line-prefix
1294 (format ":%s" project-type
)
1296 (setq projectile-mode-line-function
'b
/projectile-mode-line-fun
)
1298 (defun my-projectile-invalidate-cache (&rest _args
)
1299 ;; ignore the args to `magit-checkout'
1300 (projectile-invalidate-cache nil
))
1302 (eval-after-load 'magit-branch
1304 (advice-add 'magit-checkout
1305 :after
#'my-projectile-invalidate-cache
)
1306 (advice-add 'magit-branch-and-checkout
1307 :after
#'my-projectile-invalidate-cache
)))
1309 (projectile-completion-system 'ivy
)
1310 (projectile-mode-line-prefix " proj"))
1312 (use-package helpful
1315 (("C-S-h c" . helpful-command
)
1316 ("C-S-h f" . helpful-callable
) ; helpful-function
1317 ("C-S-h v" . helpful-variable
)
1318 ("C-S-h k" . helpful-key
)
1319 ("C-S-h p" . helpful-at-point
)))
1323 (use-package unkillable-scratch
1326 (unkillable-scratch 1)
1328 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))))
1333 ;; | make pretty boxed quotes like this
1335 (use-package boxquote
1338 (:prefix-map b
/boxquote-prefix-map
1340 ("b" . boxquote-buffer
)
1341 ("B" . boxquote-insert-buffer
)
1342 ("d" . boxquote-defun
)
1343 ("F" . boxquote-insert-file
)
1344 ("hf" . boxquote-describe-function
)
1345 ("hk" . boxquote-describe-key
)
1346 ("hv" . boxquote-describe-variable
)
1347 ("hw" . boxquote-where-is
)
1348 ("k" . boxquote-kill
)
1349 ("p" . boxquote-paragraph
)
1350 ("q" . boxquote-boxquote
)
1351 ("r" . boxquote-region
)
1352 ("s" . boxquote-shell-command
)
1353 ("t" . boxquote-text
)
1354 ("T" . boxquote-title
)
1355 ("u" . boxquote-unbox
)
1356 ("U" . boxquote-unbox-region
)
1357 ("y" . boxquote-yank
)
1358 ("M-q" . boxquote-fill-paragraph
)
1359 ("M-w" . boxquote-kill-ring-save
))))
1361 (use-package orgalist
1362 ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
1365 :hook
(message-mode . orgalist-mode
))
1367 ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹›
1372 (typo-global-mode 1)
1373 :hook
((text-mode erc-mode
) . typo-mode
))
1375 ;; highlight TODOs in buffers
1376 (use-package hl-todo
1379 (global-hl-todo-mode))
1383 (use-package shrink-path
1387 (defvar user-
@-host
(concat (user-login-name) "@" (system-name) " "))
1388 (defun +eshell
/prompt
()
1389 (let ((base/dir
(shrink-path-prompt default-directory
)))
1390 (concat (propertize user-
@-host
'face
'default
)
1391 (propertize (car base
/dir
)
1392 'face
'font-lock-comment-face
)
1393 (propertize (cdr base
/dir
)
1394 'face
'font-lock-constant-face
)
1395 (propertize "> " 'face
'default
))))
1396 (setq eshell-prompt-regexp
(concat user-
@-host
".*> ")
1397 eshell-prompt-function
#'+eshell
/prompt
)))
1399 (use-package eshell-up
1401 :commands eshell-up
)
1403 (use-package multi-term
1405 :bind
(("C-c a s m m" . multi-term
)
1406 ("C-c a s m d" . multi-term-dedicated-toggle
)
1407 ("C-c a s m p" . multi-term-prev
)
1408 ("C-c a s m n" . multi-term-next
)
1410 ("C-c C-j" . term-char-mode
))
1412 (setq multi-term-program
"screen"
1413 multi-term-program-switches
(concat "-c"
1414 (getenv "XDG_CONFIG_HOME")
1416 ;; TODO: add separate bindings for connecting to existing
1417 ;; session vs. always creating a new one
1418 multi-term-dedicated-select-after-open-p t
1419 multi-term-dedicated-window-height
20
1420 multi-term-dedicated-max-window-height
30
1422 '(("C-c C-c" . term-interrupt-subjob
)
1423 ("C-c C-e" . term-send-esc
)
1424 ("C-c C-j" . term-line-mode
)
1426 ;; ("C-y" . term-paste)
1427 ("C-y" . term-send-raw
)
1428 ("M-f" . term-send-forward-word
)
1429 ("M-b" . term-send-backward-word
)
1430 ("M-p" . term-send-up
)
1431 ("M-n" . term-send-down
)
1432 ("M-j" . term-send-raw-meta
)
1433 ("M-y" . term-send-raw-meta
)
1434 ("M-/" . term-send-raw-meta
)
1435 ("M-0" . term-send-raw-meta
)
1436 ("M-1" . term-send-raw-meta
)
1437 ("M-2" . term-send-raw-meta
)
1438 ("M-3" . term-send-raw-meta
)
1439 ("M-4" . term-send-raw-meta
)
1440 ("M-5" . term-send-raw-meta
)
1441 ("M-6" . term-send-raw-meta
)
1442 ("M-7" . term-send-raw-meta
)
1443 ("M-8" . term-send-raw-meta
)
1444 ("M-9" . term-send-raw-meta
)
1445 ("<C-backspace>" . term-send-backward-kill-word
)
1446 ("<M-DEL>" . term-send-backward-kill-word
)
1447 ("M-d" . term-send-delete-word
)
1448 ("M-," . term-send-raw
)
1449 ("M-." . comint-dynamic-complete
))
1450 term-unbind-key-alist
1451 '("C-z" "C-x" "C-c" "C-h"
1455 (use-package page-break-lines
1459 (page-break-lines-max-width fill-column
)
1461 (global-page-break-lines-mode))
1463 (use-package expand-region
1464 :bind
("C-=" . er
/expand-region
))
1466 (use-package multiple-cursors
1468 (("C-S-<mouse-1>" . mc
/add-cursor-on-click
)
1469 (:prefix-map b
/mc-prefix-map
1471 ("c" . mc
/edit-lines
)
1472 ("n" . mc
/mark-next-like-this
)
1473 ("p" . mc
/mark-previous-like-this
)
1474 ("a" . mc
/mark-all-like-this
))))
1482 (use-package yasnippet
1485 (defconst yas-verbosity-cur yas-verbosity
)
1486 (setq yas-verbosity
2)
1487 (add-to-list 'yas-snippet-dirs
"~/src/git/guix/etc/snippets" t
)
1489 (setq yas-verbosity yas-verbosity-cur
)
1492 (use-package debbugs
)
1494 (use-package org-ref
1496 (b/setq-every
'("~/usr/org/references.bib")
1497 reftex-default-bibliography
1498 org-ref-default-bibliography
)
1500 org-ref-bibliography-notes
"~/usr/org/notes.org"
1501 org-ref-pdf-directory
"~/usr/org/bibtex-pdfs/"))
1505 :init
(setq alert-default-style
'notifications
))
1507 ;; (use-package fill-column-indicator)
1509 (use-package emojify
1510 :hook
(erc-mode . emojify-mode
))
1514 (("s-o" . other-window
)
1515 ("M-o" . other-window
)
1516 ("s-/ ." . split-window-right
)
1517 ("s-/ ," . split-window-below
)
1518 ("s-/ 0" . delete-window
)
1519 ("s-q" . delete-window
)))
1521 (use-package windmove
1524 (("s-h" . windmove-left
)
1525 ("s-j" . windmove-down
)
1526 ("s-k" . windmove-up
)
1527 ("s-l" . windmove-right
)
1528 ("s-H" . windmove-swap-states-left
)
1529 ("s-J" . windmove-swap-states-down
)
1530 ("s-K" . windmove-swap-states-up
)
1531 ("s-L" . windmove-swap-states-right
)))
1535 :bind
("C-c a p" . pass
)
1536 :hook
(pass-mode . View-exit
))
1539 ;;; Email (with Gnus)
1541 (defvar b
/maildir
(expand-file-name "~/mail/"))
1542 (with-eval-after-load 'recentf
1543 (add-to-list 'recentf-exclude b
/maildir
))
1546 b
/gnus-init-file
(b/etc
"gnus")
1547 mail-user-agent
'gnus-user-agent
1548 read-mail-command
'gnus
)
1551 :bind
(("s-m" . gnus
)
1552 ("s-M" . gnus-unplugged
))
1555 gnus-select-method
'(nnnil "")
1556 gnus-secondary-select-methods
1557 '((nnimap "shemshak"
1558 (nnimap-stream plain
)
1559 (nnimap-address "127.0.0.1")
1560 (nnimap-server-port 143)
1561 (nnimap-authenticator plain
)
1562 (nnimap-user "amin@shemshak.local"))
1564 (nnimap-stream plain
)
1565 (nnimap-address "127.0.0.1")
1566 (nnimap-server-port 143)
1567 (nnimap-authenticator plain
)
1568 (nnimap-user "bandali@gnu.local")
1569 (nnimap-inbox "INBOX")
1570 (nnimap-split-methods 'nnimap-split-fancy
)
1571 (nnimap-split-fancy (|
1572 ;; (: gnus-registry-split-fancy-with-parent)
1573 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
1575 (list ".*emacs-devel.gnu.org" "l.gnu.emacs.devel")
1576 (list ".*help-gnu-emacs.gnu.org" "l.gnu.emacs.help")
1577 (list ".*info-gnu-emacs.gnu.org" "l.gnu.emacs.info")
1578 (list ".*emacs-orgmode.gnu.org" "l.gnu.emacs.orgmode")
1579 (list ".*emacs-tangents.gnu.org" "l.gnu.emacs.tangents")
1580 (list ".*emacsconf-discuss.gnu.org" "l.gnu.emacsconf.discuss")
1581 (list ".*emacsconf-register.gnu.org" "l.gnu.emacsconf.register")
1582 (list ".*emacsconf-submit.gnu.org" "l.gnu.emacsconf.submit")
1583 (list ".*fencepost-users.gnu.org" "l.gnu.fencepost.users")
1584 (list ".*gnunet-developers.gnu.org" "l.gnu.gnunet.developers")
1585 (list ".*help-gnunet.gnu.org" "l.gnu.gnunet.help")
1586 (list ".*bug-gnuzilla.gnu.org" "l.gnu.gnuzilla.bug")
1587 (list ".*gnuzilla-dev.gnu.org" "l.gnu.gnuzilla.dev")
1588 (list ".*guile-devel.gnu.org" "l.gnu.guile.devel")
1589 (list ".*guile-user.gnu.org" "l.gnu.guile.user")
1590 (list ".*guix-devel.gnu.org" "l.gnu.guix.devel")
1591 (list ".*help-guix.gnu.org" "l.gnu.guix.help")
1592 (list ".*info-guix.gnu.org" "l.gnu.guix.info")
1593 (list ".*savannah-hackers-public.gnu.org" "l.gnu.savannah.hackers.public")
1594 (list ".*savannah-users.gnu.org" "l.gnu.savannah.users")
1595 (list ".*www-commits.gnu.org" "l.gnu.www.commits")
1596 (list ".*www-discuss.gnu.org" "l.gnu.www.discuss")
1598 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
1600 (list ".*haskell-art.we.lurk.org" "l.haskell.art")
1601 (list ".*haskell-cafe.haskell.org" "l.haskell.cafe")
1603 (list ".*atreus.freelists.org" "l.atreus")
1604 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
1605 (list ".*notmuch.notmuchmail.org" "l.notmuch")
1606 (list ".*dev.lists.parabola.nu" "l.parabola.dev")
1608 (list ".*~bandali/public-inbox@lists.sr.ht" "l.~bandali.public-inbox")
1609 (list ".*~sircmpwn/free-writers-club@lists.sr.ht" "l.~sircmpwn.free-writers-club")
1610 (list ".*~sircmpwn/sr.ht-admins@lists.sr.ht" "l.~sircmpwn.srht.admins")
1611 (list ".*~sircmpwn/sr.ht-announce@lists.sr.ht" "l.~sircmpwn.srht.announce")
1612 (list ".*~sircmpwn/sr.ht-dev@lists.sr.ht" "l.~sircmpwn.srht.dev")
1613 (list ".*~sircmpwn/sr.ht-discuss@lists.sr.ht" "l.~sircmpwn.srht.discuss")
1616 (nnimap-stream plain
)
1617 (nnimap-address "127.0.0.1")
1618 (nnimap-server-port 143)
1619 (nnimap-authenticator plain
)
1620 (nnimap-user "abandali@uw.local")
1621 (nnimap-inbox "INBOX")
1622 (nnimap-split-methods 'nnimap-split-fancy
)
1623 (nnimap-split-fancy (|
1624 ;; (: gnus-registry-split-fancy-with-parent)
1626 ("subject" "\\(SE\\s-?463\\|Deliverable\\)" "course.se463-s19")
1627 (from "\\(SE\\s-?463\\|Gema\\|Hemant\\|Davood\\|Camilo\\|Reza\\|Michael\\|Sandy\\)" "course.se463-s19")
1631 (nnimap-stream plain
)
1632 (nnimap-address "127.0.0.1")
1633 (nnimap-server-port 143)
1634 (nnimap-authenticator plain
)
1635 (nnimap-user "abandali@csc.uw.local")))
1636 gnus-message-archive-group
"nnimap+shemshak:Sent"
1639 (to-address .
"atreus@freelists.org")
1640 (to-list .
"atreus@freelists.org"))
1642 (to-address .
"deepspec@lists.cs.princeton.edu")
1643 (to-list .
"deepspec@lists.cs.princeton.edu")
1644 (list-identifier .
"\\[deepspec\\]"))
1645 ("l\\.gnu\\.emacs\\.devel"
1646 (to-address .
"emacs-devel@gnu.org")
1647 (to-list .
"emacs-devel@gnu.org"))
1648 ("l\\.gnu\\.emacs\\.help"
1649 (to-address .
"help-gnu-emacs@gnu.org")
1650 (to-list .
"help-gnu-emacs@gnu.org"))
1651 ("l\\.gnu\\.emacs\\.info"
1652 (to-address .
"info-gnu-emacs@gnu.org")
1653 (to-list .
"info-gnu-emacs@gnu.org"))
1654 ("l\\.gnu\\.emacs\\.orgmode"
1655 (to-address .
"emacs-orgmode@gnu.org")
1656 (to-list .
"emacs-orgmode@gnu.org")
1657 (list-identifier .
"\\[O\\]"))
1658 ("l\\.gnu\\.emacs\\.tangents"
1659 (to-address .
"emacs-tangents@gnu.org")
1660 (to-list .
"emacs-tangents@gnu.org"))
1661 ("l\\.gnu\\.emacsconf\\.discuss"
1662 (to-address .
"emacsconf-discuss@gnu.org")
1663 (to-list .
"emacsconf-discuss@gnu.org"))
1664 ("l\\.gnu\\.emacsconf\\.register"
1665 (to-address .
"emacsconf-register@gnu.org")
1666 (to-list .
"emacsconf-register@gnu.org"))
1667 ("l\\.gnu\\.emacsconf\\.submit"
1668 (to-address .
"emacsconf-submit@gnu.org")
1669 (to-list .
"emacsconf-submit@gnu.org"))
1670 ("l\\.gnu\\.fencepost\\.users"
1671 (to-address .
"fencepost-users@gnu.org")
1672 (to-list .
"fencepost-users@gnu.org")
1673 (list-identifier .
"\\[Fencepost-users\\]"))
1674 ("l\\.gnu\\.gnunet\\.developers"
1675 (to-address .
"gnunet-developers@gnu.org")
1676 (to-list .
"gnunet-developers@gnu.org")
1677 (list-identifier .
"\\[GNUnet-developers\\]"))
1678 ("l\\.gnu\\.gnunet\\.help"
1679 (to-address .
"help-gnunet@gnu.org")
1680 (to-list .
"help-gnunet@gnu.org")
1681 (list-identifier .
"\\[Help-gnunet\\]"))
1682 ("l\\.gnu\\.gnuzilla\\.bug"
1683 (to-address .
"bug-gnuzilla@gnu.org")
1684 (to-list .
"bug-gnuzilla@gnu.org")
1685 (list-identifier .
"\\[Bug-gnuzilla\\]"))
1686 ("l\\.gnu\\.gnuzilla\\.dev"
1687 (to-address .
"gnuzilla-dev@gnu.org")
1688 (to-list .
"gnuzilla-dev@gnu.org")
1689 (list-identifier .
"\\[Gnuzilla-dev\\]"))
1690 ("l\\.gnu\\.guile\\.devel"
1691 (to-address .
"guile-devel@gnu.org")
1692 (to-list .
"guile-devel@gnu.org"))
1693 ("l\\.gnu\\.guile\\.user"
1694 (to-address .
"guile-user@gnu.org")
1695 (to-list .
"guile-user@gnu.org"))
1696 ("l\\.gnu\\.guix\\.devel"
1697 (to-address .
"guix-devel@gnu.org")
1698 (to-list .
"guix-devel@gnu.org"))
1699 ("l\\.gnu\\.guix\\.help"
1700 (to-address .
"help-guix@gnu.org")
1701 (to-list .
"help-guix@gnu.org"))
1702 ("l\\.gnu\\.guix\\.info"
1703 (to-address .
"info-guix@gnu.org")
1704 (to-list .
"info-guix@gnu.org"))
1705 ("l\\.gnu\\.savannah\\.hackers\\.public"
1706 (to-address .
"savannah-hackers-public@gnu.org")
1707 (to-list .
"savannah-hackers-public@gnu.org"))
1708 ("l\\.gnu\\.savannah\\.users"
1709 (to-address .
"savannah-users@gnu.org")
1710 (to-list .
"savannah-users@gnu.org"))
1711 ("l\\.gnu\\.www\\.commits"
1712 (to-address .
"www-commits@gnu.org")
1713 (to-list .
"www-commits@gnu.org"))
1714 ("l\\.gnu\\.www\\.discuss"
1715 (to-address .
"www-discuss@gnu.org")
1716 (to-list .
"www-discuss@gnu.org"))
1717 ("l\\.haskell\\.art"
1718 (to-address .
"haskell-art@we.lurk.org")
1719 (to-list .
"haskell-art@we.lurk.org")
1720 (list-identifier .
"\\[haskell-art\\]"))
1721 ("l\\.haskell\\.cafe"
1722 (to-address .
"haskell-cafe@haskell.org")
1723 (to-list .
"haskell-cafe@haskell.org")
1724 (list-identifier .
"\\[Haskell-cafe\\]"))
1726 (to-address .
"notmuch@notmuchmail.org")
1727 (to-list .
"notmuch@notmuchmail.org"))
1728 ("l\\.parabola\\.dev"
1729 (to-address .
"dev@lists.parabola.nu")
1730 (to-list .
"dev@lists.parabola.nu")
1731 (list-identifier .
"\\[Dev\\]"))
1732 ("l\\.~bandali\\.public-inbox"
1733 (to-address .
"~bandali/public-inbox@lists.sr.ht")
1734 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
1735 ("l\\.~sircmpwn\\.free-writers-club"
1736 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
1737 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
1738 ("l\\.~sircmpwn\\.srht\\.admins"
1739 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
1740 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
1741 ("l\\.~sircmpwn\\.srht\\.announce"
1742 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
1743 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
1744 ("l\\.~sircmpwn\\.srht\\.dev"
1745 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
1746 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
1747 ("l\\.~sircmpwn\\.srht\\.discuss"
1748 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
1749 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
1751 (to-address .
"webmasters@gnu.org")
1752 (to-list .
"webmasters@gnu.org"))
1759 gnus-large-newsgroup
50
1760 gnus-home-directory
(b/var
"gnus/")
1761 gnus-directory
(concat gnus-home-directory
"news/")
1762 message-directory
(concat gnus-home-directory
"mail/")
1763 nndraft-directory
(concat gnus-home-directory
"drafts/")
1764 gnus-save-newsrc-file nil
1765 gnus-read-newsrc-file nil
1766 gnus-interactive-exit nil
1767 gnus-gcc-mark-as-read t
)
1773 (require 'ebdb-gnus
))
1775 ;; (gnus-registry-initialize)
1777 (with-eval-after-load 'recentf
1778 (add-to-list 'recentf-exclude gnus-home-directory
)))
1780 (use-package gnus-art
1783 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
1784 gnus-visible-headers
1785 (concat gnus-visible-headers
"\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
1786 gnus-sorted-header-list
1787 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
1788 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
1789 "^Newsgroups:" "List-Id:" "^Organization:"
1790 "^User-Agent:" "^Date:")
1791 ;; local-lapsed article dates
1792 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1793 gnus-article-date-headers
'(user-defined)
1794 gnus-article-time-format
1796 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
1797 (local (article-make-date-line date
'local
))
1798 (combined-lapsed (article-make-date-line date
1801 (string-match " (.+" combined-lapsed
)
1802 (match-string 0 combined-lapsed
))))
1803 (concat local lapsed
))))
1805 :map gnus-article-mode-map
1806 ("M-L" . org-store-link
)))
1808 (use-package gnus-sum
1809 :bind
(:map gnus-summary-mode-map
1810 :prefix-map b
/gnus-summary-prefix-map
1812 ("r" . gnus-summary-reply
)
1813 ("w" . gnus-summary-wide-reply
)
1814 ("v" . gnus-summary-show-raw-article
))
1817 :map gnus-summary-mode-map
1818 ("M-L" . org-store-link
))
1819 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
))
1821 (use-package gnus-msg
1823 (defvar b
/signature
"Amin Bandali
1824 Free Software Activist | GNU Webmaster & Volunteer
1825 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1826 https://shemshak.org/~amin")
1827 (defvar b
/gnu-signature
"Amin Bandali
1828 Free Software Activist | GNU Webmaster & Volunteer
1829 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1830 https://bandalis.org")
1831 (defvar b
/uw-signature
"Amin Bandali, MMath Student
1832 Cheriton School of Computer Science
1833 University of Waterloo
1834 https://bandalis.org")
1835 (defvar b
/csc-signature
"Amin Bandali
1836 Termcom, Computer Science Club
1837 University of Waterloo
1838 https://bandalis.org")
1839 (setq gnus-posting-styles
1841 (address "amin@shemshak.org")
1843 (signature b
/signature
)
1844 (eval (setq b
/message-cite-say-hi t
)))
1846 (address "bandali@gnu.org")
1847 (signature b
/gnu-signature
)
1848 (eval (set (make-local-variable 'message-user-fqdn
) "fencepost.gnu.org")))
1849 ((header "subject" "ThankCRM")
1850 (to "webmasters-comment@gnu.org")
1852 (eval (setq b
/message-cite-say-hi nil
)))
1854 (address "abandali@uwaterloo.ca")
1855 (signature b
/uw-signature
))
1856 ("nnimap\\+uw:INBOX"
1857 (gcc "\"nnimap+uw:Sent Items\""))
1859 (address "abandali@csclub.uwaterloo.ca")
1860 (signature b
/csc-signature
)
1861 (gcc "nnimap+csc:Sent")))))
1863 (use-package gnus-topic
1864 :hook
(gnus-group-mode . gnus-topic-mode
)
1865 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
1867 (use-package gnus-agent
1869 (setq gnus-agent-synchronize-flags
'ask
)
1870 :hook
(gnus-group-mode . gnus-agent-mode
))
1872 (use-package gnus-group
1874 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
1877 ;; problematic with ebdb's popup, *EBDB-Gnus*
1878 (use-package gnus-win
1880 (setq gnus-use-full-window nil
)))
1882 (use-package gnus-dired
1883 :commands gnus-dired-mode
1885 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
1887 (use-package mm-decode
1889 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
1890 mm-decrypt-option
'known
1891 mm-verify-option
'known
))
1893 (use-package sendmail
1895 (setq sendmail-program
(executable-find "msmtp")
1896 ;; message-sendmail-extra-arguments '("-v" "-d")
1897 mail-specify-envelope-from t
1898 mail-envelope-from
'header
))
1900 (use-package message
1902 ;; redefine for a simplified In-Reply-To header
1903 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
1904 (defun message-make-in-reply-to ()
1905 "Return the In-Reply-To header for this message."
1906 (when message-reply-headers
1907 (let ((from (mail-header-from message-reply-headers
))
1908 (msg-id (mail-header-id message-reply-headers
)))
1912 (defconst b
/message-cite-style-format
"On %Y-%m-%d %l:%M %p, %N wrote:")
1913 (defconst message-cite-style-bandali
1914 '((message-cite-function 'message-cite-original
)
1915 (message-citation-line-function 'message-insert-formatted-citation-line
)
1916 (message-cite-reply-position 'traditional
)
1917 (message-yank-prefix "> ")
1918 (message-yank-cited-prefix ">")
1919 (message-yank-empty-prefix ">")
1920 (message-citation-line-format
1921 (if b
/message-cite-say-hi
1922 (concat "Hi %F,\n\n" b
/message-cite-style-format
)
1923 b
/message-cite-style-format
)))
1924 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
1925 (setq ;; message-cite-style 'message-cite-style-bandali
1926 message-kill-buffer-on-exit t
1927 message-send-mail-function
'message-send-mail-with-sendmail
1928 message-sendmail-envelope-from
'header
1929 message-subscribed-address-functions
1930 '(gnus-find-subscribed-addresses)
1931 message-dont-reply-to-names
1932 "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(amin@bndl\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
1935 (require 'company-ebdb
))
1936 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
1937 (message-mode . flyspell-mode
)
1938 (message-mode .
(lambda ()
1939 ;; (setq fill-column 65
1940 ;; message-fill-column 65)
1941 (make-local-variable 'company-idle-delay
)
1942 (setq company-idle-delay
0.2))))
1944 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
1945 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
1946 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
1952 (use-package mml-sec
1954 (mml-secure-openpgp-encrypt-to-self t
)
1955 (mml-secure-openpgp-sign-with-sender t
))
1957 (use-package footnote
1960 ;; (setq footnote-start-tag ""
1961 ;; footnote-end-tag ""
1962 ;; footnote-style 'unicode)
1964 (:map message-mode-map
1965 :prefix-map b
/footnote-prefix-map
1967 ("a" . footnote-add-footnote
)
1968 ("b" . footnote-back-to-message
)
1969 ("c" . footnote-cycle-style
)
1970 ("d" . footnote-delete-footnote
)
1971 ("g" . footnote-goto-footnote
)
1972 ("r" . footnote-renumber-footnotes
)
1973 ("s" . footnote-set-style
)))
1978 :straight
(:host github
:repo
"girzel/ebdb")
1980 :bind
(:map gnus-group-mode-map
("e" . ebdb
))
1982 (setq ebdb-sources
(b/var
"ebdb"))
1983 (with-eval-after-load 'swiper
1984 (add-to-list 'swiper-font-lock-exclude
'ebdb-mode t
)))
1986 (use-package ebdb-com
1989 ;; (use-package ebdb-complete
1992 ;; (ebdb-complete-enable))
1994 (use-package company-ebdb
1996 (defun company-ebdb--post-complete (_) nil
))
1998 (use-package ebdb-gnus
2001 (ebdb-gnus-window-configuration
2004 (summary 0.25 point
)
2007 (ebdb-gnus 0.3))))))
2009 (use-package ebdb-mua
2011 ;; :custom (ebdb-mua-pop-up nil)
2014 ;; (use-package ebdb-message
2018 ;; (use-package ebdb-vcard
2024 (use-package message-x
))
2027 (use-package message-x
2029 (message-x-completion-alist
2031 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
2034 (quote message-newgroups-header-regexp
))
2035 message-newgroups-header-regexp message-newsgroups-header-regexp
)
2036 . message-expand-group
))))))
2039 (use-package gnus-harvest
2040 :commands gnus-harvest-install
2043 (if (featurep 'message-x
)
2044 (gnus-harvest-install 'message-x
)
2045 (gnus-harvest-install))))
2048 ;;; IRC (with ERC and ZNC)
2051 :bind
(("C-c a e b" . erc-switch-to-buffer
)
2053 ("M-a" . erc-track-switch-buffer
))
2055 (erc-join-buffer 'bury
)
2056 (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
2057 (erc-nick "bandali")
2059 (erc-rename-buffers t
)
2060 (erc-server-reconnect-attempts 5)
2061 (erc-server-reconnect-timeout 3)
2063 (with-eval-after-load 'ivy
2064 ;; ignore channel buffer names
2065 (add-to-list 'ivy-ignore-buffers
"^#"))
2066 (defun erc-cmd-OPME ()
2067 "Request chanserv to op me."
2068 (erc-message "PRIVMSG"
2069 (format "chanserv op %s %s"
2070 (erc-default-target)
2071 (erc-current-nick)) nil
))
2072 (defun erc-cmd-DEOPME ()
2073 "Deop myself from current channel."
2074 (erc-cmd-DEOP (format "%s" (erc-current-nick))))
2075 (add-to-list 'erc-modules
'keep-place
)
2076 (add-to-list 'erc-modules
'notifications
)
2077 (add-to-list 'erc-modules
'spelling
)
2080 (add-to-list 'erc-modules
'scrolltoplace
))
2081 (erc-update-modules))
2083 (use-package erc-fill
2086 (erc-fill-function 'erc-fill-static
)
2087 (erc-fill-static-center 18))
2089 (use-package erc-pcomplete
2092 (erc-pcomplete-nick-postfix ","))
2094 (use-package erc-track
2097 (erc-track-enable-keybindings nil
)
2098 (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
2099 "324" "329" "332" "333" "353" "477"))
2100 (erc-track-priority-faces-only 'all
)
2101 (erc-track-shorten-function nil
))
2103 (use-package erc-hl-nicks
2108 (use-package erc-scrolltoplace
2112 :load-path
"lisp/znc.el/"
2113 :bind
(("C-c a e e" . znc-erc
)
2114 ("C-c a e a" . znc-all
))
2116 (let ((pwd (let ((auth (auth-source-search :host
"znca")))
2118 ((null auth
) (error "Couldn't find znca's authinfo"))
2119 (t (funcall (plist-get (car auth
) :secret
)))))))
2121 `(("znc.shemshak.org" 1337 t
2122 ((freenode "amin/freenode" ,pwd
)))
2123 ("znc.shemshak.org" 1337 t
2124 ((moznet "amin/moznet" ,pwd
)))
2125 ("znc.shemshak.org" 1337 t
2126 ((oftc "amin/oftc" ,pwd
)))))))
2129 ;;; Post initialization
2131 (message "Loading %s...done (%.3fs)" user-init-file
2132 (float-time (time-subtract (current-time)
2133 b
/before-user-init-time
)))
2135 ;;; init.el ends here