| 1 | ;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t -*- |
| 2 | |
| 3 | ;; Copyright (C) 2018-2019 Amin Bandali <bandali@gnu.org> |
| 4 | |
| 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. |
| 9 | |
| 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. |
| 14 | |
| 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/>. |
| 17 | |
| 18 | ;;; Commentary: |
| 19 | |
| 20 | ;; Emacs configuration of Amin Bandali, computer scientist, functional |
| 21 | ;; programmer, and free software advocate. Uses straight.el for |
| 22 | ;; purely functional and fully reproducible package management. |
| 23 | |
| 24 | ;; Over the years, I've taken inspiration from configurations of many |
| 25 | ;; great people. Some that I can remember off the top of my head are: |
| 26 | ;; |
| 27 | ;; - https://github.com/dieggsy/dotfiles |
| 28 | ;; - https://github.com/dakra/dmacs |
| 29 | ;; - http://pages.sachachua.com/.emacs.d/Sacha.html |
| 30 | ;; - https://github.com/dakrone/eos |
| 31 | ;; - http://doc.rix.si/cce/cce.html |
| 32 | ;; - https://github.com/jwiegley/dot-emacs |
| 33 | ;; - https://github.com/wasamasa/dotemacs |
| 34 | ;; - https://github.com/hlissner/doom-emacs |
| 35 | |
| 36 | ;;; Code: |
| 37 | |
| 38 | ;;; Emacs initialization |
| 39 | |
| 40 | (defvar a/before-user-init-time (current-time) |
| 41 | "Value of `current-time' when Emacs begins loading `user-init-file'.") |
| 42 | (message "Loading Emacs...done (%.3fs)" |
| 43 | (float-time (time-subtract a/before-user-init-time |
| 44 | before-init-time))) |
| 45 | |
| 46 | ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' |
| 47 | ;; during startup to reduce garbage collection frequency. clearing |
| 48 | ;; `file-name-handler-alist' seems to help reduce startup time too. |
| 49 | (defvar a/gc-cons-threshold gc-cons-threshold) |
| 50 | (defvar a/gc-cons-percentage gc-cons-percentage) |
| 51 | (defvar a/file-name-handler-alist file-name-handler-alist) |
| 52 | (setq gc-cons-threshold (* 400 1024 1024) ; 400 MiB |
| 53 | gc-cons-percentage 0.6 |
| 54 | file-name-handler-alist nil |
| 55 | ;; sidesteps a bug when profiling with esup |
| 56 | esup-child-profile-require-level 0) |
| 57 | |
| 58 | ;; set them back to their defaults once we're done initializing |
| 59 | (defun a/post-init () |
| 60 | (setq gc-cons-threshold a/gc-cons-threshold |
| 61 | gc-cons-percentage a/gc-cons-percentage |
| 62 | file-name-handler-alist a/file-name-handler-alist)) |
| 63 | (add-hook 'after-init-hook #'a/post-init) |
| 64 | |
| 65 | ;; increase number of lines kept in *Messages* log |
| 66 | (setq message-log-max 20000) |
| 67 | |
| 68 | ;; optionally, uncomment to supress some byte-compiler warnings |
| 69 | ;; (see C-h v byte-compile-warnings RET for more info) |
| 70 | ;; (setq byte-compile-warnings |
| 71 | ;; '(not free-vars unresolved noruntime lexical make-local)) |
| 72 | |
| 73 | \f |
| 74 | ;;; whoami |
| 75 | |
| 76 | (setq user-full-name "Amin Bandali" |
| 77 | user-mail-address "amin@shemshak.org") |
| 78 | |
| 79 | \f |
| 80 | ;;; comment macro |
| 81 | |
| 82 | ;; useful for commenting out multiple sexps at a time |
| 83 | (defmacro comment (&rest _) |
| 84 | "Comment out one or more s-expressions." |
| 85 | (declare (indent defun)) |
| 86 | nil) |
| 87 | |
| 88 | \f |
| 89 | ;;; Package management |
| 90 | |
| 91 | ;; No package.el (for emacs 26 and before, uncomment the following) |
| 92 | ;; Not necessary when using straight.el |
| 93 | ;; (C-h v straight-package-neutering-mode RET) |
| 94 | |
| 95 | (when (and |
| 96 | (not (featurep 'straight)) |
| 97 | (version< emacs-version "27")) |
| 98 | (setq package-enable-at-startup nil) |
| 99 | ;; (package-initialize) |
| 100 | ) |
| 101 | |
| 102 | ;; for emacs 27 and later, we use early-init.el. see |
| 103 | ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b |
| 104 | |
| 105 | ;; straight.el |
| 106 | |
| 107 | ;; Main engine start... |
| 108 | |
| 109 | (setq straight-repository-branch "develop" |
| 110 | straight-check-for-modifications '(check-on-save find-when-checking)) |
| 111 | |
| 112 | (defun a/bootstrap-straight () |
| 113 | (defvar bootstrap-version) |
| 114 | (let ((bootstrap-file |
| 115 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) |
| 116 | (bootstrap-version 5)) |
| 117 | (unless (file-exists-p bootstrap-file) |
| 118 | (with-current-buffer |
| 119 | (url-retrieve-synchronously |
| 120 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" |
| 121 | 'silent 'inhibit-cookies) |
| 122 | (goto-char (point-max)) |
| 123 | (eval-print-last-sexp))) |
| 124 | (load bootstrap-file nil 'nomessage))) |
| 125 | |
| 126 | ;; Solid rocket booster ignition... |
| 127 | |
| 128 | (a/bootstrap-straight) |
| 129 | |
| 130 | ;; We have lift off! |
| 131 | |
| 132 | (setq straight-use-package-by-default t) |
| 133 | |
| 134 | (defmacro use-feature (name &rest args) |
| 135 | "Like `use-package', but with `straight-use-package-by-default' disabled." |
| 136 | (declare (indent defun)) |
| 137 | `(use-package ,name |
| 138 | :straight nil |
| 139 | ,@args)) |
| 140 | |
| 141 | (with-eval-after-load 'recentf |
| 142 | (add-to-list 'recentf-exclude |
| 143 | (expand-file-name "~/.emacs.d/straight/build/"))) |
| 144 | |
| 145 | (defun a/reload-init () |
| 146 | "Reload init.el." |
| 147 | (interactive) |
| 148 | (setq a/file-name-handler-alist file-name-handler-alist) |
| 149 | (load user-init-file nil 'nomessage) |
| 150 | (a/post-init)) |
| 151 | |
| 152 | ;; use-package |
| 153 | (straight-use-package 'use-package) |
| 154 | (if nil ; set to t when need to debug init |
| 155 | (progn |
| 156 | (setq use-package-verbose t |
| 157 | use-package-expand-minimally nil |
| 158 | use-package-compute-statistics t |
| 159 | debug-on-error t) |
| 160 | (require 'use-package)) |
| 161 | (setq use-package-verbose nil |
| 162 | use-package-expand-minimally t)) |
| 163 | |
| 164 | (setq use-package-always-defer t) |
| 165 | (require 'bind-key) |
| 166 | |
| 167 | (use-package delight) |
| 168 | |
| 169 | ;; for browsing the Emacsmirror package database |
| 170 | (comment |
| 171 | (use-package epkg |
| 172 | :commands (epkg-list-packages epkg-describe-package) |
| 173 | :bind |
| 174 | (("C-c p e d" . epkg-describe-package) |
| 175 | ("C-c p e p" . epkg-list-packages)) |
| 176 | :config |
| 177 | (setq epkg-repository "~/.emacs.d/straight/repos/epkgs/") |
| 178 | (eval-when-compile (defvar ivy-initial-inputs-alist)) |
| 179 | (with-eval-after-load 'ivy |
| 180 | (add-to-list |
| 181 | 'ivy-initial-inputs-alist '(epkg-describe-package . "^") t)))) |
| 182 | |
| 183 | \f |
| 184 | ;;; Initial setup |
| 185 | |
| 186 | ;; keep ~/.emacs.d clean |
| 187 | (use-package no-littering |
| 188 | :demand t |
| 189 | :config |
| 190 | (savehist-mode 1) |
| 191 | (add-to-list 'savehist-additional-variables 'kill-ring) |
| 192 | (save-place-mode 1) |
| 193 | (setq auto-save-file-name-transforms |
| 194 | `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))) |
| 195 | |
| 196 | ;; separate custom file (don't want it mixing with init.el) |
| 197 | (use-feature custom |
| 198 | :no-require t |
| 199 | :config |
| 200 | (setq custom-file (no-littering-expand-etc-file-name "custom.el")) |
| 201 | (when (file-exists-p custom-file) |
| 202 | (load custom-file)) |
| 203 | ;; while at it, treat themes as safe |
| 204 | (setf custom-safe-themes t)) |
| 205 | |
| 206 | ;; load the secrets file if it exists, otherwise show a warning |
| 207 | (with-demoted-errors |
| 208 | (load (no-littering-expand-etc-file-name "secrets"))) |
| 209 | |
| 210 | ;; better $PATH (and other environment variable) handling |
| 211 | (use-package exec-path-from-shell |
| 212 | :defer 0.4 |
| 213 | :init |
| 214 | (setq exec-path-from-shell-arguments nil |
| 215 | exec-path-from-shell-check-startup-files nil) |
| 216 | :config |
| 217 | (exec-path-from-shell-initialize) |
| 218 | ;; while we're at it, let's fix access to our running ssh-agent |
| 219 | (exec-path-from-shell-copy-env "SSH_AGENT_PID") |
| 220 | (exec-path-from-shell-copy-env "SSH_AUTH_SOCK")) |
| 221 | |
| 222 | ;; only one custom theme at a time |
| 223 | (comment |
| 224 | (defadvice load-theme (before clear-previous-themes activate) |
| 225 | "Clear existing theme settings instead of layering them" |
| 226 | (mapc #'disable-theme custom-enabled-themes))) |
| 227 | |
| 228 | ;; start up emacs server. see |
| 229 | ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server |
| 230 | (use-feature server |
| 231 | :defer 0.4 |
| 232 | :config (or (server-running-p) (server-mode))) |
| 233 | |
| 234 | ;; unicode support |
| 235 | (comment |
| 236 | (dolist (ft (fontset-list)) |
| 237 | (set-fontset-font |
| 238 | ft |
| 239 | 'unicode |
| 240 | (font-spec :name "Source Code Pro" :size 14)) |
| 241 | (set-fontset-font |
| 242 | ft |
| 243 | 'unicode |
| 244 | (font-spec :name "DejaVu Sans Mono") |
| 245 | nil |
| 246 | 'append) |
| 247 | ;; (set-fontset-font |
| 248 | ;; ft |
| 249 | ;; 'unicode |
| 250 | ;; (font-spec |
| 251 | ;; :name "Symbola monospacified for DejaVu Sans Mono") |
| 252 | ;; nil |
| 253 | ;; 'append) |
| 254 | ;; (set-fontset-font |
| 255 | ;; ft |
| 256 | ;; #x2115 ; ℕ |
| 257 | ;; (font-spec :name "DejaVu Sans Mono") |
| 258 | ;; nil |
| 259 | ;; 'append) |
| 260 | (set-fontset-font |
| 261 | ft |
| 262 | (cons ?Α ?ω) |
| 263 | (font-spec :name "DejaVu Sans Mono" :size 14) |
| 264 | nil |
| 265 | 'prepend))) |
| 266 | |
| 267 | ;; gentler font resizing |
| 268 | (setq text-scale-mode-step 1.05) |
| 269 | |
| 270 | ;; focus follows mouse |
| 271 | (setq mouse-autoselect-window t) |
| 272 | |
| 273 | (defun a/no-mouse-autoselect-window () |
| 274 | "Conveniently disable `focus-follows-mouse'. |
| 275 | For disabling the behaviour for certain buffers and/or modes." |
| 276 | (make-local-variable 'mouse-autoselect-window) |
| 277 | (setq mouse-autoselect-window nil)) |
| 278 | |
| 279 | ;; better scrolling |
| 280 | (setq ;; scroll-margin 1 |
| 281 | ;; scroll-conservatively 10000 |
| 282 | scroll-step 1 |
| 283 | scroll-conservatively 10 |
| 284 | scroll-preserve-screen-position 1) |
| 285 | |
| 286 | (use-feature mwheel |
| 287 | :defer 0.4 |
| 288 | :config |
| 289 | (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)) ; one line at a time |
| 290 | mouse-wheel-progressive-speed nil ; don't accelerate scrolling |
| 291 | mouse-wheel-follow-mouse t)) ; scroll window under mouse |
| 292 | |
| 293 | (use-feature pixel-scroll |
| 294 | :defer 0.4 |
| 295 | :config (pixel-scroll-mode 1)) |
| 296 | |
| 297 | ;; ask for GPG passphrase in minibuffer |
| 298 | (setq epg-pinentry-mode 'loopback) |
| 299 | |
| 300 | ;; useful libraries |
| 301 | (require 'cl-lib) |
| 302 | (require 'subr-x) |
| 303 | |
| 304 | \f |
| 305 | ;;; Useful utilities |
| 306 | |
| 307 | (defmacro a/setq-every (value &rest vars) |
| 308 | "Set all the variables from VARS to value VALUE." |
| 309 | (declare (indent defun) (debug t)) |
| 310 | `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))) |
| 311 | |
| 312 | (defun a/start-process (program &rest args) |
| 313 | "Same as `start-process', but doesn't bother about name and buffer." |
| 314 | (let ((process-name (concat program "_process")) |
| 315 | (buffer-name (generate-new-buffer-name |
| 316 | (concat program "_output")))) |
| 317 | (apply #'start-process |
| 318 | process-name buffer-name program args))) |
| 319 | |
| 320 | (defun a/dired-start-process (program &optional args) |
| 321 | "Open current file with a PROGRAM." |
| 322 | ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can |
| 323 | ;; be nil, so remove it). |
| 324 | (apply #'a/start-process |
| 325 | program |
| 326 | (remove nil (list args (dired-get-file-for-visit))))) |
| 327 | |
| 328 | (defun a/add-elisp-section () |
| 329 | (interactive) |
| 330 | (insert "\n") |
| 331 | (previous-line) |
| 332 | (insert "\n\f\n;;; ")) |
| 333 | |
| 334 | \f |
| 335 | ;;; Defaults |
| 336 | |
| 337 | ;; time and battery in mode-line |
| 338 | (comment |
| 339 | (use-package time |
| 340 | :init |
| 341 | (setq display-time-default-load-average nil) |
| 342 | :config |
| 343 | (display-time-mode)) |
| 344 | |
| 345 | (use-package battery |
| 346 | :config |
| 347 | (display-battery-mode))) |
| 348 | |
| 349 | ;; smaller fringe |
| 350 | ;; (fringe-mode '(3 . 1)) |
| 351 | (fringe-mode nil) |
| 352 | |
| 353 | ;; disable disabled commands |
| 354 | (setq disabled-command-function nil) |
| 355 | |
| 356 | ;; Save what I copy into clipboard from other applications into Emacs' |
| 357 | ;; kill-ring, which would allow me to still be able to easily access |
| 358 | ;; it in case I kill (cut or copy) something else inside Emacs before |
| 359 | ;; yanking (pasting) what I'd originally intended to. |
| 360 | (setq save-interprogram-paste-before-kill t) |
| 361 | |
| 362 | ;; minibuffer |
| 363 | (setq enable-recursive-minibuffers t |
| 364 | resize-mini-windows t) |
| 365 | |
| 366 | ;; lazy-person-friendly yes/no prompts |
| 367 | (defalias 'yes-or-no-p #'y-or-n-p) |
| 368 | |
| 369 | ;; i want *scratch* as my startup buffer |
| 370 | (setq initial-buffer-choice t) |
| 371 | |
| 372 | ;; i don't need the default hint |
| 373 | (setq initial-scratch-message nil) |
| 374 | |
| 375 | ;; use customizable text-mode as major mode for *scratch* |
| 376 | (setq initial-major-mode 'text-mode) |
| 377 | |
| 378 | ;; inhibit buffer list when more than 2 files are loaded |
| 379 | (setq inhibit-startup-buffer-menu t) |
| 380 | |
| 381 | ;; don't need to see the startup screen or the echo area message |
| 382 | (advice-add #'display-startup-echo-area-message :override #'ignore) |
| 383 | (setq inhibit-startup-screen t |
| 384 | inhibit-startup-echo-area-message user-login-name) |
| 385 | |
| 386 | ;; more useful frame titles |
| 387 | (setq frame-title-format |
| 388 | '("" invocation-name " - " |
| 389 | (:eval (if (buffer-file-name) |
| 390 | (abbreviate-file-name (buffer-file-name)) |
| 391 | "%b")))) |
| 392 | |
| 393 | ;; backups (C-h v make-backup-files RET) |
| 394 | (setq backup-by-copying t |
| 395 | version-control t |
| 396 | delete-old-versions t) |
| 397 | |
| 398 | ;; enable automatic reloading of changed buffers and files |
| 399 | (global-auto-revert-mode 1) |
| 400 | (setq auto-revert-verbose nil |
| 401 | global-auto-revert-non-file-buffers nil) |
| 402 | |
| 403 | ;; always use space for indentation |
| 404 | (setq-default |
| 405 | indent-tabs-mode nil |
| 406 | require-final-newline t |
| 407 | tab-width 4) |
| 408 | |
| 409 | ;; enable winner-mode (C-h f winner-mode RET) |
| 410 | (winner-mode 1) |
| 411 | |
| 412 | ;; don't display *compilation* buffer on success. based on |
| 413 | ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf' |
| 414 | ;; instead of the now obsolete `flet'. |
| 415 | (with-eval-after-load 'compile |
| 416 | (defun a/compilation-finish-function (buffer outstr) |
| 417 | (unless (string-match "finished" outstr) |
| 418 | (switch-to-buffer-other-window buffer)) |
| 419 | t) |
| 420 | |
| 421 | (setq compilation-finish-functions #'a/compilation-finish-function) |
| 422 | |
| 423 | (require 'cl-macs) |
| 424 | |
| 425 | (defadvice compilation-start |
| 426 | (around inhibit-display |
| 427 | (command &optional mode name-function highlight-regexp)) |
| 428 | (if (not (string-match "^\\(find\\|grep\\)" command)) |
| 429 | (cl-letf (((symbol-function 'display-buffer) #'ignore)) |
| 430 | (save-window-excursion ad-do-it)) |
| 431 | ad-do-it)) |
| 432 | (ad-activate 'compilation-start)) |
| 433 | |
| 434 | ;; search for non-ASCII characters: i’d like non-ASCII characters such |
| 435 | ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII |
| 436 | ;; counterpart. shoutout to |
| 437 | ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html |
| 438 | (setq search-default-mode #'char-fold-to-regexp) |
| 439 | ;; uncomment to extend this behaviour to query-replace |
| 440 | ;; (setq replace-char-fold t) |
| 441 | |
| 442 | ;; cursor shape |
| 443 | (setq-default cursor-type 'bar) |
| 444 | |
| 445 | ;; allow scrolling in Isearch |
| 446 | (setq isearch-allow-scroll t) |
| 447 | |
| 448 | ;; open read-only file buffers in view-mode |
| 449 | ;; (enables niceties like `q' for quit) |
| 450 | (setq view-read-only t) |
| 451 | |
| 452 | (use-feature vc |
| 453 | :bind ("C-x v C-=" . vc-ediff)) |
| 454 | |
| 455 | (use-feature ediff |
| 456 | :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) |
| 457 | :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) |
| 458 | (ediff-split-window-function 'split-window-horizontally))) |
| 459 | |
| 460 | \f |
| 461 | ;;; General bindings |
| 462 | |
| 463 | (bind-keys |
| 464 | ("C-c a i" . ielm) |
| 465 | |
| 466 | ("C-c e b" . eval-buffer) |
| 467 | ("C-c e r" . eval-region) |
| 468 | |
| 469 | ("C-c e i" . emacs-init-time) |
| 470 | ("C-c e u" . emacs-uptime) |
| 471 | |
| 472 | ("C-c F m" . make-frame-command) |
| 473 | ("C-c F d" . delete-frame) |
| 474 | ("C-c F D" . server-edit) |
| 475 | |
| 476 | ("C-S-h C" . describe-char) |
| 477 | ("C-S-h F" . describe-face) |
| 478 | |
| 479 | ("C-x k" . kill-this-buffer) |
| 480 | ("C-x K" . kill-buffer) |
| 481 | |
| 482 | ("s-p" . beginning-of-buffer) |
| 483 | ("s-n" . end-of-buffer) |
| 484 | |
| 485 | ("M-o" . other-window) |
| 486 | ("M-O" . facemenu-keymap) |
| 487 | |
| 488 | :map emacs-lisp-mode-map |
| 489 | ("<C-return>" . a/add-elisp-section)) |
| 490 | |
| 491 | (when (display-graphic-p) |
| 492 | (unbind-key "C-z" global-map)) |
| 493 | |
| 494 | (bind-keys |
| 495 | ;; for back and forward mouse keys |
| 496 | ("<mouse-8>" . previous-buffer) |
| 497 | ("<drag-mouse-8>" . previous-buffer) |
| 498 | ("<mouse-9>" . next-buffer) |
| 499 | ("<drag-mouse-9>" . next-buffer) |
| 500 | ("<drag-mouse-2>" . kill-this-buffer) |
| 501 | ("<drag-mouse-3>" . ivy-switch-buffer)) |
| 502 | |
| 503 | (bind-keys |
| 504 | :prefix-map a/straight-prefix-map |
| 505 | :prefix "C-c p s" |
| 506 | ("u" . straight-use-package) |
| 507 | ("f" . straight-freeze-versions) |
| 508 | ("t" . straight-thaw-versions) |
| 509 | ("P" . straight-prune-build) |
| 510 | ("g" . straight-get-recipe) |
| 511 | ("r" . a/reload-init) |
| 512 | ;; M-x ^straight-.*-all$ |
| 513 | ("a c" . straight-check-all) |
| 514 | ("a f" . straight-fetch-all) |
| 515 | ("a m" . straight-merge-all) |
| 516 | ("a n" . straight-normalize-all) |
| 517 | ("a F" . straight-pull-all) |
| 518 | ("a P" . straight-push-all) |
| 519 | ("a r" . straight-rebuild-all) |
| 520 | ;; M-x ^straight-.*-package$ |
| 521 | ("p c" . straight-check-package) |
| 522 | ("p f" . straight-fetch-package) |
| 523 | ("p m" . straight-merge-package) |
| 524 | ("p n" . straight-normalize-package) |
| 525 | ("p F" . straight-pull-package) |
| 526 | ("p P" . straight-push-package) |
| 527 | ("p r" . straight-rebuild-package)) |
| 528 | |
| 529 | \f |
| 530 | ;;; Essential packages |
| 531 | |
| 532 | (use-package auto-compile |
| 533 | :demand t |
| 534 | :config |
| 535 | (auto-compile-on-load-mode) |
| 536 | (auto-compile-on-save-mode) |
| 537 | (setq auto-compile-display-buffer nil |
| 538 | auto-compile-mode-line-counter t |
| 539 | auto-compile-source-recreate-deletes-dest t |
| 540 | auto-compile-toggle-deletes-nonlib-dest t |
| 541 | auto-compile-update-autoloads t) |
| 542 | (add-hook 'auto-compile-inhibit-compile-hook |
| 543 | 'auto-compile-inhibit-compile-detached-git-head)) |
| 544 | |
| 545 | ;; use the org-plus-contrib package to get the whole deal |
| 546 | (straight-use-package 'org-plus-contrib) |
| 547 | |
| 548 | (use-feature org |
| 549 | :defer 0.5 |
| 550 | :config |
| 551 | (setq org-src-tab-acts-natively t |
| 552 | org-src-preserve-indentation nil |
| 553 | org-edit-src-content-indentation 0 |
| 554 | org-link-email-description-format "Email %c: %s" ; %.30s |
| 555 | org-highlight-latex-and-related '(entities) |
| 556 | org-use-speed-commands t |
| 557 | org-startup-folded 'content |
| 558 | org-catch-invisible-edits 'show-and-error |
| 559 | org-log-done 'time) |
| 560 | (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) |
| 561 | :bind |
| 562 | (("C-c a o a" . org-agenda) |
| 563 | :map org-mode-map |
| 564 | ("M-L" . org-insert-last-stored-link) |
| 565 | ("M-O" . org-toggle-link-display) |
| 566 | ("s-T" . org-todo)) |
| 567 | :hook ((org-mode . org-indent-mode) |
| 568 | (org-mode . auto-fill-mode) |
| 569 | (org-mode . flyspell-mode)) |
| 570 | :custom |
| 571 | (org-agenda-files '("~/usr/org/todos/personal.org" |
| 572 | "~/usr/org/todos/masters.org")) |
| 573 | (org-agenda-start-on-weekday 0) |
| 574 | (org-latex-packages-alist '(("" "listings") ("" "color"))) |
| 575 | :custom-face |
| 576 | '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21")))) |
| 577 | '(org-block ((t (:background "#1d1f21")))) |
| 578 | '(org-latex-and-related ((t (:foreground "#b294bb"))))) |
| 579 | |
| 580 | (use-feature ox-latex |
| 581 | :after ox |
| 582 | :config |
| 583 | (setq org-latex-listings 'listings |
| 584 | ;; org-latex-prefer-user-labels t |
| 585 | ) |
| 586 | (add-to-list 'org-latex-classes |
| 587 | '("IEEEtran" "\\documentclass[11pt]{IEEEtran}" |
| 588 | ("\\section{%s}" . "\\section*{%s}") |
| 589 | ("\\subsection{%s}" . "\\subsection*{%s}") |
| 590 | ("\\subsubsection{%s}" . "\\subsubsection*{%s}") |
| 591 | ("\\paragraph{%s}" . "\\paragraph*{%s}") |
| 592 | ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) |
| 593 | t) |
| 594 | (require 'ox-beamer)) |
| 595 | |
| 596 | (use-feature ox-extra |
| 597 | :config |
| 598 | (ox-extras-activate '(latex-header-blocks ignore-headlines))) |
| 599 | |
| 600 | ;; asynchronous tangle, using emacs-async to asynchronously tangle an |
| 601 | ;; org file. closely inspired by |
| 602 | ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles |
| 603 | (with-eval-after-load 'org |
| 604 | (defvar a/show-async-tangle-results nil |
| 605 | "Keep *emacs* async buffers around for later inspection.") |
| 606 | |
| 607 | (defvar a/show-async-tangle-time nil |
| 608 | "Show the time spent tangling the file.") |
| 609 | |
| 610 | (defun a/async-babel-tangle () |
| 611 | "Tangle org file asynchronously." |
| 612 | (interactive) |
| 613 | (let* ((file-tangle-start-time (current-time)) |
| 614 | (file (buffer-file-name)) |
| 615 | (file-nodir (file-name-nondirectory file)) |
| 616 | ;; (async-quiet-switch "-q") |
| 617 | (file-noext (file-name-sans-extension file))) |
| 618 | (async-start |
| 619 | `(lambda () |
| 620 | (require 'org) |
| 621 | (org-babel-tangle-file ,file)) |
| 622 | (unless a/show-async-tangle-results |
| 623 | `(lambda (result) |
| 624 | (if result |
| 625 | (message "Tangled %s%s" |
| 626 | ,file-nodir |
| 627 | (if a/show-async-tangle-time |
| 628 | (format " (%.3fs)" |
| 629 | (float-time (time-subtract (current-time) |
| 630 | ',file-tangle-start-time))) |
| 631 | "")) |
| 632 | (message "Tangling %s failed" ,file-nodir)))))))) |
| 633 | |
| 634 | (add-to-list |
| 635 | 'safe-local-variable-values |
| 636 | '(eval add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local)) |
| 637 | |
| 638 | ;; *the* right way to do git |
| 639 | (use-package magit |
| 640 | :defer 0.5 |
| 641 | :bind (("C-x g" . magit-status) |
| 642 | ("s-g s" . magit-status) |
| 643 | ("s-g l" . magit-log-buffer-file)) |
| 644 | :config |
| 645 | (magit-add-section-hook 'magit-status-sections-hook |
| 646 | 'magit-insert-modules |
| 647 | 'magit-insert-stashes |
| 648 | 'append) |
| 649 | (setq magit-repository-directories '(("~/" . 0) |
| 650 | ("~/src/git/" . 1))) |
| 651 | (nconc magit-section-initial-visibility-alist |
| 652 | '(([unpulled status] . show) |
| 653 | ([unpushed status] . show))) |
| 654 | :custom (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) |
| 655 | :custom-face (magit-diff-file-heading ((t (:weight normal))))) |
| 656 | |
| 657 | ;; recently opened files |
| 658 | (use-feature recentf |
| 659 | :defer 0.2 |
| 660 | :config |
| 661 | ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") |
| 662 | (setq recentf-max-saved-items 2000)) |
| 663 | |
| 664 | ;; smart M-x enhancement (needed by counsel for history) |
| 665 | (use-package smex) |
| 666 | |
| 667 | (use-package ivy |
| 668 | :defer 0.3 |
| 669 | :delight ;; " 🙒" |
| 670 | :bind |
| 671 | (:map ivy-minibuffer-map |
| 672 | ([escape] . keyboard-escape-quit) |
| 673 | ([S-up] . ivy-previous-history-element) |
| 674 | ([S-down] . ivy-next-history-element) |
| 675 | ("DEL" . ivy-backward-delete-char)) |
| 676 | :config |
| 677 | (setq ivy-wrap t |
| 678 | ivy-height 14 |
| 679 | ivy-use-virtual-buffers t |
| 680 | ivy-virtual-abbreviate 'abbreviate |
| 681 | ivy-count-format "%d/%d ") |
| 682 | (ivy-mode 1) |
| 683 | ;; :custom-face |
| 684 | ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold)))) |
| 685 | ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold)))) |
| 686 | ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold)))) |
| 687 | ) |
| 688 | |
| 689 | (use-package swiper |
| 690 | :after ivy |
| 691 | :bind (("C-s" . swiper-isearch) |
| 692 | ("C-r" . swiper) |
| 693 | ("C-S-s" . isearch-forward))) |
| 694 | |
| 695 | (use-package counsel |
| 696 | :after ivy |
| 697 | :delight |
| 698 | :bind (([remap execute-extended-command] . counsel-M-x) |
| 699 | ([remap find-file] . counsel-find-file) |
| 700 | ("C-c x" . counsel-M-x) |
| 701 | ("C-c f ." . counsel-find-file) |
| 702 | ("C-c f l" . counsel-find-library) |
| 703 | ("C-c f r" . counsel-recentf) |
| 704 | ("s-." . counsel-find-file) |
| 705 | ("s-r" . ivy-switch-buffer) |
| 706 | :map minibuffer-local-map |
| 707 | ("C-r" . counsel-minibuffer-history)) |
| 708 | :config |
| 709 | (counsel-mode 1) |
| 710 | (defalias 'locate #'counsel-locate)) |
| 711 | |
| 712 | (comment |
| 713 | (use-package helm |
| 714 | :commands (helm-M-x helm-mini helm-resume) |
| 715 | :bind (("M-x" . helm-M-x) |
| 716 | ("M-y" . helm-show-kill-ring) |
| 717 | ("C-x b" . helm-mini) |
| 718 | ("C-x C-b" . helm-buffers-list) |
| 719 | ("C-x C-f" . helm-find-files) |
| 720 | ("C-h r" . helm-info-emacs) |
| 721 | ("s-r" . helm-recentf) |
| 722 | ("C-s-r" . helm-resume) |
| 723 | :map helm-map |
| 724 | ("<tab>" . helm-execute-persistent-action) |
| 725 | ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals |
| 726 | ("C-z" . helm-select-action)) ; List actions |
| 727 | :config (helm-mode 1))) |
| 728 | |
| 729 | (use-feature eshell |
| 730 | :defer 0.5 |
| 731 | :commands eshell |
| 732 | :bind ("C-c a s e" . eshell) |
| 733 | :config |
| 734 | (eval-when-compile (defvar eshell-prompt-regexp)) |
| 735 | (defun a/eshell-quit-or-delete-char (arg) |
| 736 | (interactive "p") |
| 737 | (if (and (eolp) (looking-back eshell-prompt-regexp nil)) |
| 738 | (eshell-life-is-too-much) |
| 739 | (delete-char arg))) |
| 740 | |
| 741 | (defun a/eshell-clear () |
| 742 | (interactive) |
| 743 | (let ((inhibit-read-only t)) |
| 744 | (erase-buffer)) |
| 745 | (eshell-send-input)) |
| 746 | |
| 747 | (defun a/eshell-setup () |
| 748 | (make-local-variable 'company-idle-delay) |
| 749 | (defvar company-idle-delay) |
| 750 | (setq company-idle-delay nil) |
| 751 | (bind-keys :map eshell-mode-map |
| 752 | ("C-d" . a/eshell-quit-or-delete-char) |
| 753 | ("C-S-l" . a/eshell-clear) |
| 754 | ("M-r" . counsel-esh-history) |
| 755 | ([tab] . company-complete))) |
| 756 | |
| 757 | :hook (eshell-mode . a/eshell-setup) |
| 758 | :custom |
| 759 | (eshell-hist-ignoredups t) |
| 760 | (eshell-input-filter 'eshell-input-filter-initial-space)) |
| 761 | |
| 762 | (use-feature ibuffer |
| 763 | :bind |
| 764 | (("C-x C-b" . ibuffer-other-window) |
| 765 | :map ibuffer-mode-map |
| 766 | ("P" . ibuffer-backward-filter-group) |
| 767 | ("N" . ibuffer-forward-filter-group) |
| 768 | ("M-p" . ibuffer-do-print) |
| 769 | ("M-n" . ibuffer-do-shell-command-pipe-replace)) |
| 770 | :config |
| 771 | ;; Use human readable Size column instead of original one |
| 772 | (define-ibuffer-column size-h |
| 773 | (:name "Size" :inline t) |
| 774 | (cond |
| 775 | ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) |
| 776 | ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0))) |
| 777 | ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) |
| 778 | (t (format "%8d" (buffer-size))))) |
| 779 | :custom |
| 780 | (ibuffer-saved-filter-groups |
| 781 | '(("default" |
| 782 | ("dired" (mode . dired-mode)) |
| 783 | ("org" (mode . org-mode)) |
| 784 | ("gnus" |
| 785 | (or |
| 786 | (mode . gnus-group-mode) |
| 787 | (mode . gnus-summary-mode) |
| 788 | (mode . gnus-article-mode) |
| 789 | ;; not really, but... |
| 790 | (mode . message-mode))) |
| 791 | ("web" |
| 792 | (or |
| 793 | (mode . web-mode) |
| 794 | (mode . css-mode) |
| 795 | (mode . scss-mode) |
| 796 | (mode . js2-mode))) |
| 797 | ("shell" |
| 798 | (or |
| 799 | (mode . eshell-mode) |
| 800 | (mode . shell-mode) |
| 801 | (mode . term-mode))) |
| 802 | ("programming" |
| 803 | (or |
| 804 | (mode . python-mode) |
| 805 | (mode . c-mode) |
| 806 | (mode . c++-mode) |
| 807 | (mode . java-mode) |
| 808 | (mode . emacs-lisp-mode) |
| 809 | (mode . scheme-mode) |
| 810 | (mode . haskell-mode) |
| 811 | (mode . lean-mode) |
| 812 | (mode . go-mode) |
| 813 | (mode . alloy-mode))) |
| 814 | ("tex" |
| 815 | (or |
| 816 | (mode . bibtex-mode) |
| 817 | (mode . latex-mode))) |
| 818 | ("emacs" |
| 819 | (or |
| 820 | (name . "^\\*scratch\\*$") |
| 821 | (name . "^\\*Messages\\*$"))) |
| 822 | ("erc" (mode . erc-mode))))) |
| 823 | (ibuffer-formats |
| 824 | '((mark modified read-only locked " " |
| 825 | (name 18 18 :left :elide) |
| 826 | " " |
| 827 | (size-h 9 -1 :right) |
| 828 | " " |
| 829 | (mode 16 16 :left :elide) |
| 830 | " " filename-and-process) |
| 831 | (mark " " |
| 832 | (name 16 -1) |
| 833 | " " filename))) |
| 834 | :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default")))) |
| 835 | |
| 836 | (use-feature outline |
| 837 | :hook (prog-mode . outline-minor-mode) |
| 838 | :delight (outline-minor-mode " outl") |
| 839 | :bind |
| 840 | (:map |
| 841 | outline-minor-mode-map |
| 842 | ("<s-tab>" . outline-toggle-children) |
| 843 | ("M-p" . outline-previous-visible-heading) |
| 844 | ("M-n" . outline-next-visible-heading) |
| 845 | :prefix-map a/outline-prefix-map |
| 846 | :prefix "s-o" |
| 847 | ("TAB" . outline-toggle-children) |
| 848 | ("a" . outline-hide-body) |
| 849 | ("H" . outline-hide-body) |
| 850 | ("S" . outline-show-all) |
| 851 | ("h" . outline-hide-subtree) |
| 852 | ("s" . outline-show-subtree))) |
| 853 | |
| 854 | (use-feature ls-lisp |
| 855 | :custom (ls-lisp-dirs-first t)) |
| 856 | |
| 857 | (use-feature dired |
| 858 | :config |
| 859 | (setq dired-listing-switches "-alh" |
| 860 | ls-lisp-use-insert-directory-program nil) |
| 861 | |
| 862 | ;; easily diff 2 marked files |
| 863 | ;; https://oremacs.com/2017/03/18/dired-ediff/ |
| 864 | (defun dired-ediff-files () |
| 865 | (interactive) |
| 866 | (require 'dired-aux) |
| 867 | (defvar ediff-after-quit-hook-internal) |
| 868 | (let ((files (dired-get-marked-files)) |
| 869 | (wnd (current-window-configuration))) |
| 870 | (if (<= (length files) 2) |
| 871 | (let ((file1 (car files)) |
| 872 | (file2 (if (cdr files) |
| 873 | (cadr files) |
| 874 | (read-file-name |
| 875 | "file: " |
| 876 | (dired-dwim-target-directory))))) |
| 877 | (if (file-newer-than-file-p file1 file2) |
| 878 | (ediff-files file2 file1) |
| 879 | (ediff-files file1 file2)) |
| 880 | (add-hook 'ediff-after-quit-hook-internal |
| 881 | (lambda () |
| 882 | (setq ediff-after-quit-hook-internal nil) |
| 883 | (set-window-configuration wnd)))) |
| 884 | (error "no more than 2 files should be marked")))) |
| 885 | |
| 886 | (require 'dired-x) |
| 887 | (setq dired-guess-shell-alist-user |
| 888 | '(("\\.pdf\\'" "evince" "zathura" "okular") |
| 889 | ("\\.doc\\'" "libreoffice") |
| 890 | ("\\.docx\\'" "libreoffice") |
| 891 | ("\\.ppt\\'" "libreoffice") |
| 892 | ("\\.pptx\\'" "libreoffice") |
| 893 | ("\\.xls\\'" "libreoffice") |
| 894 | ("\\.xlsx\\'" "libreoffice") |
| 895 | ("\\.flac\\'" "mpv"))) |
| 896 | :bind (:map dired-mode-map |
| 897 | ("b" . dired-up-directory) |
| 898 | ("e" . dired-ediff-files) |
| 899 | ("E" . dired-toggle-read-only) |
| 900 | ("\\" . dired-hide-details-mode) |
| 901 | ("z" . (lambda () |
| 902 | (interactive) |
| 903 | (a/dired-start-process "zathura")))) |
| 904 | :hook (dired-mode . dired-hide-details-mode)) |
| 905 | |
| 906 | (use-feature help |
| 907 | :config |
| 908 | (temp-buffer-resize-mode) |
| 909 | (setq help-window-select t)) |
| 910 | |
| 911 | (use-feature tramp |
| 912 | :config |
| 913 | (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) |
| 914 | (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) |
| 915 | (add-to-list 'tramp-default-proxies-alist |
| 916 | (list (regexp-quote (system-name)) nil nil))) |
| 917 | |
| 918 | (use-package dash |
| 919 | :config (dash-enable-font-lock)) |
| 920 | |
| 921 | (use-package doc-view |
| 922 | :bind (:map doc-view-mode-map |
| 923 | ("M-RET" . image-previous-line))) |
| 924 | |
| 925 | \f |
| 926 | ;;; Editing |
| 927 | |
| 928 | ;; highlight uncommitted changes in the left fringe |
| 929 | (use-package diff-hl |
| 930 | :defer 0.6 |
| 931 | :config |
| 932 | (setq diff-hl-draw-borders nil) |
| 933 | (global-diff-hl-mode) |
| 934 | :hook (magit-post-refresh . diff-hl-magit-post-refresh)) |
| 935 | |
| 936 | ;; display Lisp objects at point in the echo area |
| 937 | (use-feature eldoc |
| 938 | :when (version< "25" emacs-version) |
| 939 | :delight " eldoc" |
| 940 | :config (global-eldoc-mode)) |
| 941 | |
| 942 | ;; highlight matching parens |
| 943 | (use-feature paren |
| 944 | :demand |
| 945 | :config (show-paren-mode)) |
| 946 | |
| 947 | (use-feature elec-pair |
| 948 | :demand |
| 949 | :config (electric-pair-mode)) |
| 950 | |
| 951 | (use-feature simple |
| 952 | :delight (auto-fill-function " fill") |
| 953 | :config (column-number-mode)) |
| 954 | |
| 955 | ;; save minibuffer history |
| 956 | (use-feature savehist |
| 957 | :config (savehist-mode)) |
| 958 | |
| 959 | ;; automatically save place in files |
| 960 | (use-feature saveplace |
| 961 | :when (version< "25" emacs-version) |
| 962 | :config (save-place-mode)) |
| 963 | |
| 964 | (use-feature prog-mode |
| 965 | :config (global-prettify-symbols-mode) |
| 966 | (defun indicate-buffer-boundaries-left () |
| 967 | (setq indicate-buffer-boundaries 'left)) |
| 968 | (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left)) |
| 969 | |
| 970 | (use-feature text-mode |
| 971 | :hook (text-mode . indicate-buffer-boundaries-left)) |
| 972 | |
| 973 | (use-feature conf-mode |
| 974 | :mode "\\.*rc$") |
| 975 | |
| 976 | (use-feature sh-mode |
| 977 | :mode "\\.bashrc$") |
| 978 | |
| 979 | (use-package company |
| 980 | :defer 0.6 |
| 981 | :delight " comp" |
| 982 | :bind |
| 983 | (:map company-active-map |
| 984 | ([tab] . company-complete-common-or-cycle) |
| 985 | ([escape] . company-abort)) |
| 986 | :custom |
| 987 | (company-minimum-prefix-length 1) |
| 988 | (company-selection-wrap-around t) |
| 989 | (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]") |
| 990 | (company-dabbrev-downcase nil) |
| 991 | (company-dabbrev-ignore-case nil) |
| 992 | :config |
| 993 | (global-company-mode t)) |
| 994 | |
| 995 | (use-package flycheck |
| 996 | :defer 0.6 |
| 997 | :hook (prog-mode . flycheck-mode) |
| 998 | :bind |
| 999 | (:map flycheck-mode-map |
| 1000 | ("M-P" . flycheck-previous-error) |
| 1001 | ("M-N" . flycheck-next-error)) |
| 1002 | :config |
| 1003 | ;; Use the load-path from running Emacs when checking elisp files |
| 1004 | (setq flycheck-emacs-lisp-load-path 'inherit) |
| 1005 | |
| 1006 | ;; Only flycheck when I actually save the buffer |
| 1007 | (setq flycheck-check-syntax-automatically '(mode-enabled save)) |
| 1008 | :custom (flycheck-mode-line-prefix "flyc")) |
| 1009 | |
| 1010 | (use-feature flyspell |
| 1011 | :delight " flysp") |
| 1012 | |
| 1013 | ;; http://endlessparentheses.com/ispell-and-apostrophes.html |
| 1014 | (use-package ispell |
| 1015 | :defer 0.6 |
| 1016 | :config |
| 1017 | ;; ’ can be part of a word |
| 1018 | (setq ispell-local-dictionary-alist |
| 1019 | `((nil "[[:alpha:]]" "[^[:alpha:]]" |
| 1020 | "['\x2019]" nil ("-B") nil utf-8))) |
| 1021 | ;; don't send ’ to the subprocess |
| 1022 | (defun endless/replace-apostrophe (args) |
| 1023 | (cons (replace-regexp-in-string |
| 1024 | "’" "'" (car args)) |
| 1025 | (cdr args))) |
| 1026 | (advice-add #'ispell-send-string :filter-args |
| 1027 | #'endless/replace-apostrophe) |
| 1028 | |
| 1029 | ;; convert ' back to ’ from the subprocess |
| 1030 | (defun endless/replace-quote (args) |
| 1031 | (if (not (derived-mode-p 'org-mode)) |
| 1032 | args |
| 1033 | (cons (replace-regexp-in-string |
| 1034 | "'" "’" (car args)) |
| 1035 | (cdr args)))) |
| 1036 | (advice-add #'ispell-parse-output :filter-args |
| 1037 | #'endless/replace-quote)) |
| 1038 | |
| 1039 | (use-feature abbrev |
| 1040 | :delight " abbr" |
| 1041 | :hook (text-mode . abbrev-mode)) |
| 1042 | |
| 1043 | \f |
| 1044 | ;;; Programming modes |
| 1045 | |
| 1046 | (use-feature lisp-mode |
| 1047 | :config |
| 1048 | (defun indent-spaces-mode () |
| 1049 | (setq indent-tabs-mode nil)) |
| 1050 | (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) |
| 1051 | |
| 1052 | (use-feature reveal |
| 1053 | :delight (reveal-mode " reveal") |
| 1054 | :hook (emacs-lisp-mode . reveal-mode)) |
| 1055 | |
| 1056 | (use-feature elisp-mode |
| 1057 | :delight (emacs-lisp-mode "Elisp" :major)) |
| 1058 | |
| 1059 | (use-package alloy-mode |
| 1060 | :straight (:host github :repo "dwwmmn/alloy-mode") |
| 1061 | :mode "\\.als\\'" |
| 1062 | :config (setq alloy-basic-offset 2)) |
| 1063 | |
| 1064 | (use-package proof-site ; for Coq |
| 1065 | :straight proof-general) |
| 1066 | |
| 1067 | (eval-when-compile (defvar lean-mode-map)) |
| 1068 | (use-package lean-mode |
| 1069 | :defer 0.4 |
| 1070 | :bind (:map lean-mode-map |
| 1071 | ("S-SPC" . company-complete)) |
| 1072 | :config |
| 1073 | (require 'lean-input) |
| 1074 | (setq default-input-method "Lean" |
| 1075 | lean-input-tweak-all '(lean-input-compose |
| 1076 | (lean-input-prepend "/") |
| 1077 | (lean-input-nonempty)) |
| 1078 | lean-input-user-translations '(("/" "/"))) |
| 1079 | (lean-input-setup)) |
| 1080 | |
| 1081 | (use-package haskell-mode |
| 1082 | :config |
| 1083 | (setq haskell-indentation-layout-offset 4 |
| 1084 | haskell-indentation-left-offset 4 |
| 1085 | flycheck-checker 'haskell-hlint |
| 1086 | flycheck-disabled-checkers '(haskell-stack-ghc haskell-ghc))) |
| 1087 | |
| 1088 | (use-package dante |
| 1089 | :after haskell-mode |
| 1090 | :commands dante-mode |
| 1091 | :hook (haskell-mode . dante-mode)) |
| 1092 | |
| 1093 | (use-package hlint-refactor |
| 1094 | :after haskell-mode |
| 1095 | :bind (:map hlint-refactor-mode-map |
| 1096 | ("C-c l b" . hlint-refactor-refactor-buffer) |
| 1097 | ("C-c l r" . hlint-refactor-refactor-at-point)) |
| 1098 | :hook (haskell-mode . hlint-refactor-mode)) |
| 1099 | |
| 1100 | (use-package flycheck-haskell |
| 1101 | :after haskell-mode) |
| 1102 | ;; alternative: hs-lint https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el |
| 1103 | |
| 1104 | (use-package sgml-mode |
| 1105 | :config |
| 1106 | (setq sgml-basic-offset 2)) |
| 1107 | |
| 1108 | (use-package css-mode |
| 1109 | :config |
| 1110 | (setq css-indent-offset 2)) |
| 1111 | |
| 1112 | (use-package web-mode |
| 1113 | :mode "\\.html\\'" |
| 1114 | :config |
| 1115 | (a/setq-every 2 |
| 1116 | web-mode-code-indent-offset |
| 1117 | web-mode-css-indent-offset |
| 1118 | web-mode-markup-indent-offset)) |
| 1119 | |
| 1120 | (use-package emmet-mode |
| 1121 | :after (:any web-mode css-mode sgml-mode) |
| 1122 | :bind* (("C-)" . emmet-next-edit-point) |
| 1123 | ("C-(" . emmet-prev-edit-point)) |
| 1124 | :config |
| 1125 | (unbind-key "C-j" emmet-mode-keymap) |
| 1126 | (setq emmet-move-cursor-between-quotes t) |
| 1127 | :hook (web-mode css-mode html-mode sgml-mode)) |
| 1128 | |
| 1129 | (comment |
| 1130 | (use-package meghanada |
| 1131 | :bind |
| 1132 | (:map meghanada-mode-map |
| 1133 | (("C-M-o" . meghanada-optimize-import) |
| 1134 | ("C-M-t" . meghanada-import-all))) |
| 1135 | :hook (java-mode . meghanada-mode))) |
| 1136 | |
| 1137 | (comment |
| 1138 | (use-package treemacs |
| 1139 | :config (setq treemacs-never-persist t)) |
| 1140 | |
| 1141 | (use-package yasnippet |
| 1142 | :config |
| 1143 | ;; (yas-global-mode) |
| 1144 | ) |
| 1145 | |
| 1146 | (use-package lsp-mode |
| 1147 | :init (setq lsp-eldoc-render-all nil |
| 1148 | lsp-highlight-symbol-at-point nil) |
| 1149 | ) |
| 1150 | |
| 1151 | (use-package hydra) |
| 1152 | |
| 1153 | (use-package company-lsp |
| 1154 | :after company |
| 1155 | :config |
| 1156 | (setq company-lsp-cache-candidates t |
| 1157 | company-lsp-async t)) |
| 1158 | |
| 1159 | (use-package lsp-ui |
| 1160 | :config |
| 1161 | (setq lsp-ui-sideline-update-mode 'point)) |
| 1162 | |
| 1163 | (use-package lsp-java |
| 1164 | :config |
| 1165 | (add-hook 'java-mode-hook |
| 1166 | (lambda () |
| 1167 | (setq-local company-backends (list 'company-lsp)))) |
| 1168 | |
| 1169 | (add-hook 'java-mode-hook 'lsp-java-enable) |
| 1170 | (add-hook 'java-mode-hook 'flycheck-mode) |
| 1171 | (add-hook 'java-mode-hook 'company-mode) |
| 1172 | (add-hook 'java-mode-hook 'lsp-ui-mode)) |
| 1173 | |
| 1174 | (use-package dap-mode |
| 1175 | :after lsp-mode |
| 1176 | :config |
| 1177 | (dap-mode t) |
| 1178 | (dap-ui-mode t)) |
| 1179 | |
| 1180 | (use-package dap-java |
| 1181 | :after (lsp-java)) |
| 1182 | |
| 1183 | (use-package lsp-java-treemacs |
| 1184 | :after (treemacs))) |
| 1185 | |
| 1186 | (comment |
| 1187 | (use-package eclim |
| 1188 | :bind (:map eclim-mode-map ("S-SPC" . company-complete)) |
| 1189 | :hook ((java-mode . eclim-mode) |
| 1190 | (eclim-mode . (lambda () |
| 1191 | (make-local-variable 'company-idle-delay) |
| 1192 | (defvar company-idle-delay) |
| 1193 | ;; (setq company-idle-delay 0.7) |
| 1194 | (setq company-idle-delay nil)))) |
| 1195 | :custom |
| 1196 | (eclim-auto-save nil) |
| 1197 | ;; (eclimd-default-workspace "~/src/eclipse-workspace-exp") |
| 1198 | (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim") |
| 1199 | (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse")))) |
| 1200 | |
| 1201 | (use-package geiser) |
| 1202 | |
| 1203 | (use-feature geiser-guile |
| 1204 | :config |
| 1205 | (setq geiser-guile-load-path "~/src/git/guix")) |
| 1206 | |
| 1207 | (use-package guix) |
| 1208 | |
| 1209 | (comment |
| 1210 | (use-package auctex |
| 1211 | :custom |
| 1212 | (font-latex-fontify-sectioning 'color))) |
| 1213 | |
| 1214 | (use-package go-mode) |
| 1215 | |
| 1216 | \f |
| 1217 | ;;; Theme |
| 1218 | |
| 1219 | (add-to-list 'custom-theme-load-path "~/.emacs.d/lisp") |
| 1220 | (load-theme 'tangomod t) |
| 1221 | |
| 1222 | (use-package smart-mode-line |
| 1223 | :commands (sml/apply-theme) |
| 1224 | :demand |
| 1225 | :config |
| 1226 | (sml/setup) |
| 1227 | (smart-mode-line-enable)) |
| 1228 | |
| 1229 | (use-package doom-themes) |
| 1230 | |
| 1231 | (defvar a/org-mode-font-lock-keywords |
| 1232 | '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)" |
| 1233 | (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive |
| 1234 | (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind |
| 1235 | (4 '(:foreground "#c5c8c6") t)))) ; title |
| 1236 | |
| 1237 | (defun a/lights-on () |
| 1238 | "Enable my favourite light theme." |
| 1239 | (interactive) |
| 1240 | (mapc #'disable-theme custom-enabled-themes) |
| 1241 | (load-theme 'tangomod t) |
| 1242 | (sml/apply-theme 'automatic) |
| 1243 | (font-lock-remove-keywords |
| 1244 | 'org-mode a/org-mode-font-lock-keywords)) |
| 1245 | |
| 1246 | (defun a/lights-off () |
| 1247 | "Go dark." |
| 1248 | (interactive) |
| 1249 | (mapc #'disable-theme custom-enabled-themes) |
| 1250 | (load-theme 'doom-tomorrow-night t) |
| 1251 | (sml/apply-theme 'automatic) |
| 1252 | (font-lock-add-keywords |
| 1253 | 'org-mode a/org-mode-font-lock-keywords t)) |
| 1254 | |
| 1255 | (bind-keys |
| 1256 | ("s-t d" . a/lights-off) |
| 1257 | ("s-t l" . a/lights-on)) |
| 1258 | |
| 1259 | \f |
| 1260 | ;;; Emacs enhancements & auxiliary packages |
| 1261 | |
| 1262 | (use-feature man |
| 1263 | :config (setq Man-width 80)) |
| 1264 | |
| 1265 | (use-package which-key |
| 1266 | :defer 0.4 |
| 1267 | :delight |
| 1268 | :config |
| 1269 | (which-key-add-key-based-replacements |
| 1270 | ;; prefixes for global prefixes and minor modes |
| 1271 | "C-c @" "outline" |
| 1272 | "C-c !" "flycheck" |
| 1273 | "C-c 8" "typo" |
| 1274 | "C-c 8 -" "typo/dashes" |
| 1275 | "C-c 8 <" "typo/left-brackets" |
| 1276 | "C-c 8 >" "typo/right-brackets" |
| 1277 | "C-x 8" "unicode" |
| 1278 | "C-x a" "abbrev/expand" |
| 1279 | "C-x r" "rectangle/register/bookmark" |
| 1280 | "C-x v" "version control" |
| 1281 | ;; prefixes for my personal bindings |
| 1282 | "C-c a" "applications" |
| 1283 | "C-c a e" "erc" |
| 1284 | "C-c a o" "org" |
| 1285 | "C-c a s" "shells" |
| 1286 | "C-c p" "package-management" |
| 1287 | ;; "C-c p e" "package-management/epkg" |
| 1288 | "C-c p s" "straight.el" |
| 1289 | "C-c psa" "all" |
| 1290 | "C-c psp" "package" |
| 1291 | "C-c c" "compile-and-comments" |
| 1292 | "C-c e" "eval" |
| 1293 | "C-c f" "files" |
| 1294 | "C-c F" "frames" |
| 1295 | "C-S-h" "help(ful)" |
| 1296 | "C-c m" "multiple-cursors" |
| 1297 | "C-c P" "projectile" |
| 1298 | "C-c P s" "projectile/search" |
| 1299 | "C-c P x" "projectile/execute" |
| 1300 | "C-c P 4" "projectile/other-window" |
| 1301 | "C-c q" "boxquote" |
| 1302 | "s-g" "magit" |
| 1303 | "s-o" "outline" |
| 1304 | "s-t" "themes") |
| 1305 | |
| 1306 | ;; prefixes for major modes |
| 1307 | (which-key-add-major-mode-key-based-replacements 'message-mode |
| 1308 | "C-c f" "footnote") |
| 1309 | (which-key-add-major-mode-key-based-replacements 'org-mode |
| 1310 | "C-c C-v" "org-babel") |
| 1311 | (which-key-add-major-mode-key-based-replacements 'web-mode |
| 1312 | "C-c C-a" "web/attributes" |
| 1313 | "C-c C-b" "web/blocks" |
| 1314 | "C-c C-d" "web/dom" |
| 1315 | "C-c C-e" "web/element" |
| 1316 | "C-c C-t" "web/tags") |
| 1317 | |
| 1318 | (which-key-mode) |
| 1319 | :custom |
| 1320 | (which-key-add-column-padding 5) |
| 1321 | (which-key-max-description-length 32)) |
| 1322 | |
| 1323 | (use-package crux ; results in Waiting for git... [2 times] |
| 1324 | :defer 0.4 |
| 1325 | :bind (("C-c b k" . crux-kill-other-buffers) |
| 1326 | ("C-c d" . crux-duplicate-current-line-or-region) |
| 1327 | ("C-c D" . crux-duplicate-and-comment-current-line-or-region) |
| 1328 | ("C-c f c" . crux-copy-file-preserve-attributes) |
| 1329 | ("C-c f d" . crux-delete-file-and-buffer) |
| 1330 | ("C-c f r" . crux-rename-file-and-buffer) |
| 1331 | ("C-c j" . crux-top-join-line) |
| 1332 | ("C-S-j" . crux-top-join-line))) |
| 1333 | |
| 1334 | (use-package mwim |
| 1335 | :bind (("C-a" . mwim-beginning-of-code-or-line) |
| 1336 | ("C-e" . mwim-end-of-code-or-line) |
| 1337 | ("<home>" . mwim-beginning-of-line-or-code) |
| 1338 | ("<end>" . mwim-end-of-line-or-code))) |
| 1339 | |
| 1340 | (use-package projectile |
| 1341 | :defer 0.5 |
| 1342 | :bind-keymap ("C-c P" . projectile-command-map) |
| 1343 | :config |
| 1344 | (projectile-mode) |
| 1345 | |
| 1346 | (defun a/projectile-mode-line-fun () |
| 1347 | "Report project name and type in the modeline." |
| 1348 | (let ((project-name (projectile-project-name)) |
| 1349 | (project-type (projectile-project-type))) |
| 1350 | (format "%s%s" |
| 1351 | projectile-mode-line-prefix |
| 1352 | (if project-type |
| 1353 | (format ":%s" project-type) |
| 1354 | "")))) |
| 1355 | (setq projectile-mode-line-function 'a/projectile-mode-line-fun) |
| 1356 | |
| 1357 | (defun my-projectile-invalidate-cache (&rest _args) |
| 1358 | ;; ignore the args to `magit-checkout' |
| 1359 | (projectile-invalidate-cache nil)) |
| 1360 | |
| 1361 | (eval-after-load 'magit-branch |
| 1362 | '(progn |
| 1363 | (advice-add 'magit-checkout |
| 1364 | :after #'my-projectile-invalidate-cache) |
| 1365 | (advice-add 'magit-branch-and-checkout |
| 1366 | :after #'my-projectile-invalidate-cache))) |
| 1367 | :custom |
| 1368 | (projectile-completion-system 'ivy) |
| 1369 | (projectile-mode-line-prefix " proj")) |
| 1370 | |
| 1371 | (use-package helpful |
| 1372 | :defer 0.6 |
| 1373 | :bind |
| 1374 | (("C-S-h c" . helpful-command) |
| 1375 | ("C-S-h f" . helpful-callable) ; helpful-function |
| 1376 | ("C-S-h v" . helpful-variable) |
| 1377 | ("C-S-h k" . helpful-key) |
| 1378 | ("C-S-h p" . helpful-at-point))) |
| 1379 | |
| 1380 | (use-package unkillable-scratch |
| 1381 | :defer 0.6 |
| 1382 | :config |
| 1383 | (unkillable-scratch 1) |
| 1384 | :custom |
| 1385 | (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))) |
| 1386 | |
| 1387 | ;; ,---- |
| 1388 | ;; | make pretty boxed quotes like this |
| 1389 | ;; `---- |
| 1390 | (use-package boxquote |
| 1391 | :defer 0.6 |
| 1392 | :bind |
| 1393 | (:prefix-map a/boxquote-prefix-map |
| 1394 | :prefix "C-c q" |
| 1395 | ("b" . boxquote-buffer) |
| 1396 | ("B" . boxquote-insert-buffer) |
| 1397 | ("d" . boxquote-defun) |
| 1398 | ("F" . boxquote-insert-file) |
| 1399 | ("hf" . boxquote-describe-function) |
| 1400 | ("hk" . boxquote-describe-key) |
| 1401 | ("hv" . boxquote-describe-variable) |
| 1402 | ("hw" . boxquote-where-is) |
| 1403 | ("k" . boxquote-kill) |
| 1404 | ("p" . boxquote-paragraph) |
| 1405 | ("q" . boxquote-boxquote) |
| 1406 | ("r" . boxquote-region) |
| 1407 | ("s" . boxquote-shell-command) |
| 1408 | ("t" . boxquote-text) |
| 1409 | ("T" . boxquote-title) |
| 1410 | ("u" . boxquote-unbox) |
| 1411 | ("U" . boxquote-unbox-region) |
| 1412 | ("y" . boxquote-yank) |
| 1413 | ("M-q" . boxquote-fill-paragraph) |
| 1414 | ("M-w" . boxquote-kill-ring-save))) |
| 1415 | |
| 1416 | (use-package orgalist |
| 1417 | ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html |
| 1418 | :disabled t |
| 1419 | :after message |
| 1420 | :hook (message-mode . orgalist-mode)) |
| 1421 | |
| 1422 | ;; easily type pretty quotes & other typography, like ‘’“”-–—«»‹› |
| 1423 | (use-package typo |
| 1424 | :defer 0.5 |
| 1425 | :delight " typo" |
| 1426 | :config |
| 1427 | (typo-global-mode 1) |
| 1428 | :hook ((text-mode erc-mode) . typo-mode)) |
| 1429 | |
| 1430 | ;; highlight TODOs in buffers |
| 1431 | (use-package hl-todo |
| 1432 | :defer 0.5 |
| 1433 | :config |
| 1434 | (global-hl-todo-mode)) |
| 1435 | |
| 1436 | (use-package shrink-path |
| 1437 | :defer 0.5 |
| 1438 | :after eshell |
| 1439 | :config |
| 1440 | (defvar user-@-host (concat (user-login-name) "@" (system-name) " ")) |
| 1441 | (defun +eshell/prompt () |
| 1442 | (let ((base/dir (shrink-path-prompt default-directory))) |
| 1443 | (concat (propertize user-@-host 'face 'default) |
| 1444 | (propertize (car base/dir) |
| 1445 | 'face 'font-lock-comment-face) |
| 1446 | (propertize (cdr base/dir) |
| 1447 | 'face 'font-lock-constant-face) |
| 1448 | (propertize "> " 'face 'default)))) |
| 1449 | (setq eshell-prompt-regexp (concat user-@-host ".*> ") |
| 1450 | eshell-prompt-function #'+eshell/prompt)) |
| 1451 | |
| 1452 | (use-package eshell-up |
| 1453 | :after eshell |
| 1454 | :commands eshell-up) |
| 1455 | |
| 1456 | (use-package multi-term |
| 1457 | :defer 0.6 |
| 1458 | :bind (("C-c a s m m" . multi-term) |
| 1459 | ("C-c a s m d" . multi-term-dedicated-toggle) |
| 1460 | ("C-c a s m p" . multi-term-prev) |
| 1461 | ("C-c a s m n" . multi-term-next) |
| 1462 | :map term-mode-map |
| 1463 | ("C-c C-j" . term-char-mode)) |
| 1464 | :config |
| 1465 | (setq multi-term-program "screen" |
| 1466 | multi-term-program-switches (concat "-c" |
| 1467 | (getenv "XDG_CONFIG_HOME") |
| 1468 | "/screen/screenrc") |
| 1469 | ;; TODO: add separate bindings for connecting to existing |
| 1470 | ;; session vs. always creating a new one |
| 1471 | multi-term-dedicated-select-after-open-p t |
| 1472 | multi-term-dedicated-window-height 20 |
| 1473 | multi-term-dedicated-max-window-height 30 |
| 1474 | term-bind-key-alist |
| 1475 | '(("C-c C-c" . term-interrupt-subjob) |
| 1476 | ("C-c C-e" . term-send-esc) |
| 1477 | ("C-c C-j" . term-line-mode) |
| 1478 | ("C-k" . kill-line) |
| 1479 | ;; ("C-y" . term-paste) |
| 1480 | ("C-y" . term-send-raw) |
| 1481 | ("M-f" . term-send-forward-word) |
| 1482 | ("M-b" . term-send-backward-word) |
| 1483 | ("M-p" . term-send-up) |
| 1484 | ("M-n" . term-send-down) |
| 1485 | ("M-j" . term-send-raw-meta) |
| 1486 | ("M-y" . term-send-raw-meta) |
| 1487 | ("M-/" . term-send-raw-meta) |
| 1488 | ("M-0" . term-send-raw-meta) |
| 1489 | ("M-1" . term-send-raw-meta) |
| 1490 | ("M-2" . term-send-raw-meta) |
| 1491 | ("M-3" . term-send-raw-meta) |
| 1492 | ("M-4" . term-send-raw-meta) |
| 1493 | ("M-5" . term-send-raw-meta) |
| 1494 | ("M-6" . term-send-raw-meta) |
| 1495 | ("M-7" . term-send-raw-meta) |
| 1496 | ("M-8" . term-send-raw-meta) |
| 1497 | ("M-9" . term-send-raw-meta) |
| 1498 | ("<C-backspace>" . term-send-backward-kill-word) |
| 1499 | ("<M-DEL>" . term-send-backward-kill-word) |
| 1500 | ("M-d" . term-send-delete-word) |
| 1501 | ("M-," . term-send-raw) |
| 1502 | ("M-." . comint-dynamic-complete)) |
| 1503 | term-unbind-key-alist |
| 1504 | '("C-z" "C-x" "C-c" "C-h" |
| 1505 | ;; "C-y" |
| 1506 | "<ESC>"))) |
| 1507 | |
| 1508 | (use-package page-break-lines |
| 1509 | :defer 0.5 |
| 1510 | :delight " pgln" |
| 1511 | :custom |
| 1512 | (page-break-lines-max-width fill-column) |
| 1513 | :config |
| 1514 | (global-page-break-lines-mode)) |
| 1515 | |
| 1516 | (use-package expand-region |
| 1517 | :bind ("C-=" . er/expand-region)) |
| 1518 | |
| 1519 | (use-package multiple-cursors |
| 1520 | :bind |
| 1521 | (("C-S-<mouse-1>" . mc/add-cursor-on-click) |
| 1522 | (:prefix-map a/mc-prefix-map |
| 1523 | :prefix "C-c m" |
| 1524 | ("c" . mc/edit-lines) |
| 1525 | ("n" . mc/mark-next-like-this) |
| 1526 | ("p" . mc/mark-previous-like-this) |
| 1527 | ("a" . mc/mark-all-like-this)))) |
| 1528 | |
| 1529 | (use-package forge |
| 1530 | :after magit |
| 1531 | :demand) |
| 1532 | |
| 1533 | (use-package yasnippet |
| 1534 | :defer 0.6 |
| 1535 | :config |
| 1536 | (defconst yas-verbosity-cur yas-verbosity) |
| 1537 | (setq yas-verbosity 2) |
| 1538 | (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t) |
| 1539 | (yas-reload-all) |
| 1540 | (setq yas-verbosity yas-verbosity-cur) |
| 1541 | (yas-global-mode)) |
| 1542 | |
| 1543 | (use-package debbugs |
| 1544 | :straight (debbugs |
| 1545 | :host github |
| 1546 | :repo "emacs-straight/debbugs" |
| 1547 | :files (:defaults "Debbugs.wsdl"))) |
| 1548 | |
| 1549 | (use-package org-ref |
| 1550 | :init |
| 1551 | (a/setq-every '("~/usr/org/references.bib") |
| 1552 | reftex-default-bibliography |
| 1553 | org-ref-default-bibliography) |
| 1554 | (setq |
| 1555 | org-ref-bibliography-notes "~/usr/org/notes.org" |
| 1556 | org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")) |
| 1557 | |
| 1558 | ;; ugh, temporary (still better than using the proprietary web app) |
| 1559 | (use-package slack |
| 1560 | :commands (slack-start) |
| 1561 | :init |
| 1562 | (eval-when-compile ; silence the byte-compiler |
| 1563 | (defvar url-http-data nil) |
| 1564 | (defvar url-http-extra-headers nil) |
| 1565 | (defvar url-http-method nil) |
| 1566 | (defvar url-callback-function nil) |
| 1567 | (defvar url-callback-arguments nil) |
| 1568 | (defvar oauth--token-data nil)) |
| 1569 | (setq slack-buffer-emojify t |
| 1570 | slack-prefer-current-team t) |
| 1571 | :config |
| 1572 | (slack-register-team |
| 1573 | :name "nday-students" |
| 1574 | :default t |
| 1575 | :token nday-students-token |
| 1576 | :subscribed-channels '(general) |
| 1577 | :full-and-display-names t) |
| 1578 | (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t) |
| 1579 | (setq lui-time-stamp-format "[%Y-%m-%d %H:%M:%S]" |
| 1580 | lui-time-stamp-only-when-changed-p t |
| 1581 | lui-time-stamp-position 'right) |
| 1582 | :bind |
| 1583 | (("C-c s s" . slack-start) |
| 1584 | ("C-c s u" . slack-select-unread-rooms) |
| 1585 | ("C-c s b" . slack-select-rooms) |
| 1586 | ("C-c s t" . slack-change-current-team) |
| 1587 | ("C-c s c" . slack-ws-close) |
| 1588 | :map slack-mode-map |
| 1589 | ("M-p" . slack-buffer-goto-prev-message) |
| 1590 | ("M-n" . slack-buffer-goto-next-message) |
| 1591 | ("C-c e" . slack-message-edit) |
| 1592 | ("C-c k" . slack-message-delete) |
| 1593 | ("C-c C-k" . slack-channel-leave) |
| 1594 | ("C-c r a" . slack-message-add-reaction) |
| 1595 | ("C-c r r" . slack-message-remove-reaction) |
| 1596 | ("C-c r s" . slack-message-show-reaction-users) |
| 1597 | ("C-c p l" . slack-room-pins-list) |
| 1598 | ("C-c p a" . slack-message-pins-add) |
| 1599 | ("C-c p r" . slack-message-pins-remove) |
| 1600 | ("@" . slack-message-embed-mention) |
| 1601 | ("#" . slack-message-embed-channel))) |
| 1602 | |
| 1603 | (use-package alert |
| 1604 | :commands (alert) |
| 1605 | :init (setq alert-default-style 'notifications)) |
| 1606 | |
| 1607 | ;; (use-package fill-column-indicator) |
| 1608 | |
| 1609 | (use-package emojify |
| 1610 | :hook (erc-mode . emojify-mode)) |
| 1611 | |
| 1612 | \f |
| 1613 | ;;; Email (with Gnus) |
| 1614 | |
| 1615 | (defvar a/maildir (expand-file-name "~/mail/")) |
| 1616 | (with-eval-after-load 'recentf |
| 1617 | (add-to-list 'recentf-exclude a/maildir)) |
| 1618 | |
| 1619 | (setq |
| 1620 | a/gnus-init-file (no-littering-expand-etc-file-name "gnus") |
| 1621 | mail-user-agent 'gnus-user-agent |
| 1622 | read-mail-command 'gnus) |
| 1623 | |
| 1624 | (use-feature gnus |
| 1625 | :bind (("s-m" . gnus) |
| 1626 | ("s-M" . gnus-unplugged)) |
| 1627 | :init |
| 1628 | (setq |
| 1629 | gnus-select-method '(nnnil "") |
| 1630 | gnus-secondary-select-methods |
| 1631 | '((nnimap "amin" |
| 1632 | (nnimap-stream plain) |
| 1633 | (nnimap-address "127.0.0.1") |
| 1634 | (nnimap-server-port 143) |
| 1635 | (nnimap-authenticator plain) |
| 1636 | (nnimap-user "amin@shemshak.local")) |
| 1637 | (nnimap "gnu" |
| 1638 | (nnimap-stream plain) |
| 1639 | (nnimap-address "127.0.0.1") |
| 1640 | (nnimap-server-port 143) |
| 1641 | (nnimap-authenticator plain) |
| 1642 | (nnimap-user "bandali@gnu.local") |
| 1643 | (nnimap-inbox "INBOX") |
| 1644 | (nnimap-split-methods 'nnimap-split-fancy) |
| 1645 | (nnimap-split-fancy (| |
| 1646 | ;; (: gnus-registry-split-fancy-with-parent) |
| 1647 | ;; (: gnus-group-split-fancy "INBOX" t "INBOX") |
| 1648 | ;; gnu |
| 1649 | (list ".*emacs-devel.gnu.org" "l.gnu.emacs.devel") |
| 1650 | (list ".*help-gnu-emacs.gnu.org" "l.gnu.emacs.help") |
| 1651 | (list ".*info-gnu-emacs.gnu.org" "l.gnu.emacs.info") |
| 1652 | (list ".*emacs-orgmode.gnu.org" "l.gnu.emacs.orgmode") |
| 1653 | (list ".*emacs-tangents.gnu.org" "l.gnu.emacs.tangents") |
| 1654 | (list ".*emacsconf-discuss.gnu.org" "l.gnu.emacsconf.discuss") |
| 1655 | (list ".*fencepost-users.gnu.org" "l.gnu.fencepost.users") |
| 1656 | (list ".*gnunet-developers.gnu.org" "l.gnu.gnunet.developers") |
| 1657 | (list ".*help-gnunet.gnu.org" "l.gnu.gnunet.help") |
| 1658 | (list ".*bug-gnuzilla.gnu.org" "l.gnu.gnuzilla.bug") |
| 1659 | (list ".*gnuzilla-dev.gnu.org" "l.gnu.gnuzilla.dev") |
| 1660 | (list ".*guile-devel.gnu.org" "l.gnu.guile.devel") |
| 1661 | (list ".*guile-user.gnu.org" "l.gnu.guile.user") |
| 1662 | (list ".*guix-devel.gnu.org" "l.gnu.guix.devel") |
| 1663 | (list ".*help-guix.gnu.org" "l.gnu.guix.help") |
| 1664 | (list ".*info-guix.gnu.org" "l.gnu.guix.info") |
| 1665 | (list ".*savannah-hackers-public.gnu.org" "l.gnu.savannah.hackers.public") |
| 1666 | (list ".*savannah-users.gnu.org" "l.gnu.savannah.users") |
| 1667 | (list ".*www-commits.gnu.org" "l.gnu.www.commits") |
| 1668 | (list ".*www-discuss.gnu.org" "l.gnu.www.discuss") |
| 1669 | ;; webmasters |
| 1670 | (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters") |
| 1671 | ;; haskell |
| 1672 | (list ".*haskell-art.we.lurk.org" "l.haskell.art") |
| 1673 | (list ".*haskell-cafe.haskell.org" "l.haskell.cafe") |
| 1674 | ;; other |
| 1675 | (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec") |
| 1676 | (list ".*notmuch.notmuchmail.org" "l.notmuch") |
| 1677 | (list ".*dev.lists.parabola.nu" "l.parabola.dev") |
| 1678 | ;; *@lists.sr.ht |
| 1679 | (list ".*~bandali/public-inbox@lists.sr.ht" "l.~bandali.public-inbox") |
| 1680 | (list ".*~sircmpwn/sr.ht-admins@lists.sr.ht" "l.~sircmpwn.srht.admins") |
| 1681 | (list ".*~sircmpwn/sr.ht-announce@lists.sr.ht" "l.~sircmpwn.srht.announce") |
| 1682 | (list ".*~sircmpwn/sr.ht-dev@lists.sr.ht" "l.~sircmpwn.srht.dev") |
| 1683 | (list ".*~sircmpwn/sr.ht-discuss@lists.sr.ht" "l.~sircmpwn.srht.discuss") |
| 1684 | "INBOX"))) |
| 1685 | (nnimap "uw" |
| 1686 | (nnimap-stream plain) |
| 1687 | (nnimap-address "127.0.0.1") |
| 1688 | (nnimap-server-port 143) |
| 1689 | (nnimap-authenticator plain) |
| 1690 | (nnimap-user "abandali@uw.local") |
| 1691 | (nnimap-inbox "INBOX") |
| 1692 | (nnimap-split-methods 'nnimap-split-fancy) |
| 1693 | (nnimap-split-fancy (| |
| 1694 | ;; (: gnus-registry-split-fancy-with-parent) |
| 1695 | ;; se463-s19 |
| 1696 | ("subject" "\\(SE\\s-?463\\|Deliverable\\)" "course.se463-s19") |
| 1697 | (from "\\(SE\\s-?463\\|Gema\\|Hemant\\|Davood\\|Camilo\\|Reza\\|Michael\\|Sandy\\)" "course.se463-s19") |
| 1698 | ;; catch-all |
| 1699 | "INBOX"))) |
| 1700 | (nnimap "csc" |
| 1701 | (nnimap-stream plain) |
| 1702 | (nnimap-address "127.0.0.1") |
| 1703 | (nnimap-server-port 143) |
| 1704 | (nnimap-authenticator plain) |
| 1705 | (nnimap-user "abandali@csc.uw.local"))) |
| 1706 | gnus-message-archive-group "nnimap+amin:Sent" |
| 1707 | gnus-parameters |
| 1708 | '(("l\\.deepspec" |
| 1709 | (to-address . "deepspec@lists.cs.princeton.edu") |
| 1710 | (to-list . "deepspec@lists.cs.princeton.edu") |
| 1711 | (list-identifier . "\\[deepspec\\]")) |
| 1712 | ("l\\.gnu\\.emacs\\.devel" |
| 1713 | (to-address . "emacs-devel@gnu.org") |
| 1714 | (to-list . "emacs-devel@gnu.org")) |
| 1715 | ("l\\.gnu\\.emacs\\.help" |
| 1716 | (to-address . "help-gnu-emacs@gnu.org") |
| 1717 | (to-list . "help-gnu-emacs@gnu.org")) |
| 1718 | ("l\\.gnu\\.emacs\\.info" |
| 1719 | (to-address . "info-gnu-emacs@gnu.org") |
| 1720 | (to-list . "info-gnu-emacs@gnu.org")) |
| 1721 | ("l\\.gnu\\.emacs\\.orgmode" |
| 1722 | (to-address . "emacs-orgmode@gnu.org") |
| 1723 | (to-list . "emacs-orgmode@gnu.org") |
| 1724 | (list-identifier . "\\[O\\]")) |
| 1725 | ("l\\.gnu\\.emacs\\.tangents" |
| 1726 | (to-address . "emacs-tangents@gnu.org") |
| 1727 | (to-list . "emacs-tangents@gnu.org")) |
| 1728 | ("l\\.gnu\\.emacsconf\\.discuss" |
| 1729 | (to-address . "emacsconf-discuss@gnu.org") |
| 1730 | (to-list . "emacsconf-discuss@gnu.org")) |
| 1731 | ("l\\.gnu\\.fencepost\\.users" |
| 1732 | (to-address . "fencepost-users@gnu.org") |
| 1733 | (to-list . "fencepost-users@gnu.org") |
| 1734 | (list-identifier . "\\[Fencepost-users\\]")) |
| 1735 | ("l\\.gnu\\.gnunet\\.developers" |
| 1736 | (to-address . "gnunet-developers@gnu.org") |
| 1737 | (to-list . "gnunet-developers@gnu.org") |
| 1738 | (list-identifier . "\\[GNUnet-developers\\]")) |
| 1739 | ("l\\.gnu\\.gnunet\\.help" |
| 1740 | (to-address . "help-gnunet@gnu.org") |
| 1741 | (to-list . "help-gnunet@gnu.org") |
| 1742 | (list-identifier . "\\[Help-gnunet\\]")) |
| 1743 | ("l\\.gnu\\.gnuzilla\\.bug" |
| 1744 | (to-address . "bug-gnuzilla@gnu.org") |
| 1745 | (to-list . "bug-gnuzilla@gnu.org") |
| 1746 | (list-identifier . "\\[Bug-gnuzilla\\]")) |
| 1747 | ("l\\.gnu\\.gnuzilla\\.dev" |
| 1748 | (to-address . "gnuzilla-dev@gnu.org") |
| 1749 | (to-list . "gnuzilla-dev@gnu.org") |
| 1750 | (list-identifier . "\\[Gnuzilla-dev\\]")) |
| 1751 | ("l\\.gnu\\.guile\\.devel" |
| 1752 | (to-address . "guile-devel@gnu.org") |
| 1753 | (to-list . "guile-devel@gnu.org")) |
| 1754 | ("l\\.gnu\\.guile\\.user" |
| 1755 | (to-address . "guile-user@gnu.org") |
| 1756 | (to-list . "guile-user@gnu.org")) |
| 1757 | ("l\\.gnu\\.guix\\.devel" |
| 1758 | (to-address . "guix-devel@gnu.org") |
| 1759 | (to-list . "guix-devel@gnu.org")) |
| 1760 | ("l\\.gnu\\.guix\\.help" |
| 1761 | (to-address . "help-guix@gnu.org") |
| 1762 | (to-list . "help-guix@gnu.org")) |
| 1763 | ("l\\.gnu\\.guix\\.info" |
| 1764 | (to-address . "info-guix@gnu.org") |
| 1765 | (to-list . "info-guix@gnu.org")) |
| 1766 | ("l\\.gnu\\.savannah\\.hackers\\.public" |
| 1767 | (to-address . "savannah-hackers-public@gnu.org") |
| 1768 | (to-list . "savannah-hackers-public@gnu.org")) |
| 1769 | ("l\\.gnu\\.savannah\\.users" |
| 1770 | (to-address . "savannah-users@gnu.org") |
| 1771 | (to-list . "savannah-users@gnu.org")) |
| 1772 | ("l\\.gnu\\.www\\.commits" |
| 1773 | (to-address . "www-commits@gnu.org") |
| 1774 | (to-list . "www-commits@gnu.org")) |
| 1775 | ("l\\.gnu\\.www\\.discuss" |
| 1776 | (to-address . "www-discuss@gnu.org") |
| 1777 | (to-list . "www-discuss@gnu.org")) |
| 1778 | ("l\\.haskell\\.art" |
| 1779 | (to-address . "haskell-art@we.lurk.org") |
| 1780 | (to-list . "haskell-art@we.lurk.org") |
| 1781 | (list-identifier . "\\[haskell-art\\]")) |
| 1782 | ("l\\.haskell\\.cafe" |
| 1783 | (to-address . "haskell-cafe@haskell.org") |
| 1784 | (to-list . "haskell-cafe@haskell.org") |
| 1785 | (list-identifier . "\\[Haskell-cafe\\]")) |
| 1786 | ("l\\.notmuch" |
| 1787 | (to-address . "notmuch@notmuchmail.org") |
| 1788 | (to-list . "notmuch@notmuchmail.org")) |
| 1789 | ("l\\.parabola\\.dev" |
| 1790 | (to-address . "dev@lists.parabola.nu") |
| 1791 | (to-list . "dev@lists.parabola.nu") |
| 1792 | (list-identifier . "\\[Dev\\]")) |
| 1793 | ("l\\.~bandali\\.public-inbox" |
| 1794 | (to-address . "~bandali/public-inbox@lists.sr.ht") |
| 1795 | (to-list . "~bandali/public-inbox@lists.sr.ht")) |
| 1796 | ("l\\.~sircmpwn\\.srht\\.admins" |
| 1797 | (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") |
| 1798 | (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) |
| 1799 | ("l\\.~sircmpwn\\.srht\\.announce" |
| 1800 | (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") |
| 1801 | (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) |
| 1802 | ("l\\.~sircmpwn\\.srht\\.dev" |
| 1803 | (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") |
| 1804 | (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) |
| 1805 | ("l\\.~sircmpwn\\.srht\\.discuss" |
| 1806 | (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") |
| 1807 | (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) |
| 1808 | ("webmasters" |
| 1809 | (to-address . "webmasters@gnu.org") |
| 1810 | (to-list . "webmasters@gnu.org")) |
| 1811 | ("gnu.*" |
| 1812 | (gcc-self . t)) |
| 1813 | ("gnu\\." |
| 1814 | (subscribed . t)) |
| 1815 | ("nnimap\\+uw:.*" |
| 1816 | (gcc-self . t))) |
| 1817 | gnus-large-newsgroup 50 |
| 1818 | gnus-home-directory (no-littering-expand-var-file-name "gnus/") |
| 1819 | gnus-directory (concat gnus-home-directory "news/") |
| 1820 | message-directory (concat gnus-home-directory "mail/") |
| 1821 | nndraft-directory (concat gnus-home-directory "drafts/") |
| 1822 | gnus-save-newsrc-file nil |
| 1823 | gnus-read-newsrc-file nil |
| 1824 | gnus-interactive-exit nil |
| 1825 | gnus-gcc-mark-as-read t) |
| 1826 | :config |
| 1827 | (require 'ebdb) |
| 1828 | (require 'ebdb-mua) |
| 1829 | (require 'ebdb-gnus) |
| 1830 | |
| 1831 | ;; (gnus-registry-initialize) |
| 1832 | |
| 1833 | (with-eval-after-load 'recentf |
| 1834 | (add-to-list 'recentf-exclude gnus-home-directory))) |
| 1835 | |
| 1836 | (use-feature gnus-art |
| 1837 | :config |
| 1838 | (setq |
| 1839 | gnus-visible-headers |
| 1840 | (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:") |
| 1841 | gnus-sorted-header-list |
| 1842 | '("^From:" "^Subject:" "^Summary:" "^Keywords:" |
| 1843 | "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator" |
| 1844 | "^Newsgroups:" "List-Id:" "^Organization:" |
| 1845 | "^User-Agent:" "^Date:") |
| 1846 | ;; local-lapsed article dates |
| 1847 | ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11 |
| 1848 | gnus-article-date-headers '(user-defined) |
| 1849 | gnus-article-time-format |
| 1850 | (lambda (time) |
| 1851 | (let* ((date (format-time-string "%a, %d %b %Y %T %z" time)) |
| 1852 | (local (article-make-date-line date 'local)) |
| 1853 | (combined-lapsed (article-make-date-line date |
| 1854 | 'combined-lapsed)) |
| 1855 | (lapsed (progn |
| 1856 | (string-match " (.+" combined-lapsed) |
| 1857 | (match-string 0 combined-lapsed)))) |
| 1858 | (concat local lapsed)))) |
| 1859 | (bind-keys |
| 1860 | :map gnus-article-mode-map |
| 1861 | ("M-L" . org-store-link))) |
| 1862 | |
| 1863 | (use-feature gnus-sum |
| 1864 | :bind (:map gnus-summary-mode-map |
| 1865 | :prefix-map a/gnus-summary-prefix-map |
| 1866 | :prefix "v" |
| 1867 | ("r" . gnus-summary-reply) |
| 1868 | ("w" . gnus-summary-wide-reply) |
| 1869 | ("v" . gnus-summary-show-raw-article)) |
| 1870 | :config |
| 1871 | (bind-keys |
| 1872 | :map gnus-summary-mode-map |
| 1873 | ("M-L" . org-store-link)) |
| 1874 | :hook (gnus-summary-mode . a/no-mouse-autoselect-window)) |
| 1875 | |
| 1876 | (use-feature gnus-msg |
| 1877 | :config |
| 1878 | (defvar a/gnu-signature "Amin Bandali | GNU Webmaster |
| 1879 | https://bandali.eu.org | https://gnu.org |
| 1880 | GPG Key: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103") |
| 1881 | (defvar a/uw-signature "Amin Bandali, MMath Student |
| 1882 | Cheriton School of Computer Science |
| 1883 | University of Waterloo |
| 1884 | https://bandali.eu.org") |
| 1885 | (defvar a/csc-signature "Amin Bandali | Termcom, CSC |
| 1886 | https://csclub.uwaterloo.ca/~abandali/") |
| 1887 | (setq gnus-posting-styles |
| 1888 | '((".*" |
| 1889 | (address "amin@shemshak.org") |
| 1890 | (body "\nBest,\n") |
| 1891 | (eval (setq a/message-cite-say-hi t))) |
| 1892 | ("nnimap\\+gnu:.*" |
| 1893 | (address "bandali@gnu.org") |
| 1894 | (signature a/gnu-signature) |
| 1895 | (eval (set (make-local-variable 'message-user-fqdn) "fencepost.gnu.org"))) |
| 1896 | ((header "subject" "ThankCRM") |
| 1897 | (to "webmasters-comment@gnu.org") |
| 1898 | (body "") |
| 1899 | (eval (setq a/message-cite-say-hi nil))) |
| 1900 | ("nnimap\\+uw:.*" |
| 1901 | (address "abandali@uwaterloo.ca") |
| 1902 | (signature a/uw-signature)) |
| 1903 | ("nnimap\\+uw:INBOX" |
| 1904 | (gcc "\"nnimap+uw:Sent Items\"")) |
| 1905 | ("nnimap\\+csc:.*" |
| 1906 | (address "abandali@csclub.uwaterloo.ca") |
| 1907 | (signature a/csc-signature) |
| 1908 | (gcc "nnimap+csc:Sent"))))) |
| 1909 | |
| 1910 | (use-feature gnus-topic |
| 1911 | :hook (gnus-group-mode . gnus-topic-mode) |
| 1912 | :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) |
| 1913 | |
| 1914 | (use-feature gnus-agent |
| 1915 | :config |
| 1916 | (setq gnus-agent-synchronize-flags 'ask) |
| 1917 | :hook (gnus-group-mode . gnus-agent-mode)) |
| 1918 | |
| 1919 | (use-feature gnus-group |
| 1920 | :config |
| 1921 | (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) |
| 1922 | |
| 1923 | (comment |
| 1924 | ;; problematic with ebdb's popup, *EBDB-Gnus* |
| 1925 | (use-feature gnus-win |
| 1926 | :config |
| 1927 | (setq gnus-use-full-window nil))) |
| 1928 | |
| 1929 | (use-feature gnus-dired |
| 1930 | :commands gnus-dired-mode |
| 1931 | :init |
| 1932 | (add-hook 'dired-mode-hook 'gnus-dired-mode)) |
| 1933 | |
| 1934 | (use-feature mm-decode |
| 1935 | :config |
| 1936 | (setq mm-discouraged-alternatives '("text/html" "text/richtext"))) |
| 1937 | |
| 1938 | (use-feature sendmail |
| 1939 | :config |
| 1940 | (setq sendmail-program "/usr/bin/msmtp" |
| 1941 | ;; message-sendmail-extra-arguments '("-v" "-d") |
| 1942 | mail-specify-envelope-from t |
| 1943 | mail-envelope-from 'header)) |
| 1944 | |
| 1945 | (use-feature message |
| 1946 | :config |
| 1947 | ;; redefine for a simplified In-Reply-To header |
| 1948 | ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67) |
| 1949 | (defun message-make-in-reply-to () |
| 1950 | "Return the In-Reply-To header for this message." |
| 1951 | (when message-reply-headers |
| 1952 | (let ((from (mail-header-from message-reply-headers)) |
| 1953 | (msg-id (mail-header-id message-reply-headers))) |
| 1954 | (when from |
| 1955 | msg-id)))) |
| 1956 | |
| 1957 | (defconst a/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:") |
| 1958 | (defconst message-cite-style-bandali |
| 1959 | '((message-cite-function 'message-cite-original) |
| 1960 | (message-citation-line-function 'message-insert-formatted-citation-line) |
| 1961 | (message-cite-reply-position 'traditional) |
| 1962 | (message-yank-prefix "> ") |
| 1963 | (message-yank-cited-prefix ">") |
| 1964 | (message-yank-empty-prefix ">") |
| 1965 | (message-citation-line-format |
| 1966 | (if a/message-cite-say-hi |
| 1967 | (concat "Hi %F,\n\n" a/message-cite-style-format) |
| 1968 | a/message-cite-style-format))) |
| 1969 | "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.") |
| 1970 | (setq ;; message-cite-style 'message-cite-style-bandali |
| 1971 | message-kill-buffer-on-exit t |
| 1972 | message-send-mail-function 'message-send-mail-with-sendmail |
| 1973 | message-sendmail-envelope-from 'header |
| 1974 | message-subscribed-address-functions |
| 1975 | '(gnus-find-subscribed-addresses) |
| 1976 | message-dont-reply-to-names |
| 1977 | "\\(\\(amin@\\(shemshak\\|bndl\\)\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|aminb?\\|mab\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)") |
| 1978 | (require 'company-ebdb) |
| 1979 | :hook (;; (message-setup . mml-secure-message-sign-pgpmime) |
| 1980 | (message-mode . flyspell-mode) |
| 1981 | (message-mode . (lambda () |
| 1982 | ;; (setq fill-column 65 |
| 1983 | ;; message-fill-column 65) |
| 1984 | (make-local-variable 'company-idle-delay) |
| 1985 | (setq company-idle-delay 0.2)))) |
| 1986 | ;; :custom-face |
| 1987 | ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold)))) |
| 1988 | ;; (message-header-to ((t (:foreground "#111" :weight normal)))) |
| 1989 | ;; (message-header-cc ((t (:foreground "#333" :weight normal)))) |
| 1990 | ) |
| 1991 | |
| 1992 | (use-feature mml |
| 1993 | :delight " mml") |
| 1994 | |
| 1995 | (use-feature mml-sec |
| 1996 | :custom |
| 1997 | (mml-secure-openpgp-encrypt-to-self t) |
| 1998 | (mml-secure-openpgp-sign-with-sender t)) |
| 1999 | |
| 2000 | (use-feature footnote |
| 2001 | :after message |
| 2002 | ;; :config |
| 2003 | ;; (setq footnote-start-tag "" |
| 2004 | ;; footnote-end-tag "" |
| 2005 | ;; footnote-style 'unicode) |
| 2006 | :bind |
| 2007 | (:map message-mode-map |
| 2008 | :prefix-map a/footnote-prefix-map |
| 2009 | :prefix "C-c f" |
| 2010 | ("a" . footnote-add-footnote) |
| 2011 | ("b" . footnote-back-to-message) |
| 2012 | ("c" . footnote-cycle-style) |
| 2013 | ("d" . footnote-delete-footnote) |
| 2014 | ("g" . footnote-goto-footnote) |
| 2015 | ("r" . footnote-renumber-footnotes) |
| 2016 | ("s" . footnote-set-style))) |
| 2017 | |
| 2018 | (use-package ebdb |
| 2019 | :straight (:host github :repo "girzel/ebdb") |
| 2020 | :after gnus |
| 2021 | :bind (:map gnus-group-mode-map ("e" . ebdb)) |
| 2022 | :config |
| 2023 | (setq ebdb-sources (no-littering-expand-var-file-name "ebdb")) |
| 2024 | (with-eval-after-load 'swiper |
| 2025 | (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) |
| 2026 | |
| 2027 | (use-feature ebdb-com |
| 2028 | :after ebdb) |
| 2029 | |
| 2030 | ;; (use-package ebdb-complete |
| 2031 | ;; :after ebdb |
| 2032 | ;; :config |
| 2033 | ;; (ebdb-complete-enable)) |
| 2034 | |
| 2035 | (use-package company-ebdb |
| 2036 | :config |
| 2037 | (defun company-ebdb--post-complete (_) nil)) |
| 2038 | |
| 2039 | (use-feature ebdb-gnus |
| 2040 | :after ebdb |
| 2041 | :custom |
| 2042 | (ebdb-gnus-window-configuration |
| 2043 | '(article |
| 2044 | (vertical 1.0 |
| 2045 | (summary 0.25 point) |
| 2046 | (horizontal 1.0 |
| 2047 | (article 1.0) |
| 2048 | (ebdb-gnus 0.3)))))) |
| 2049 | |
| 2050 | (use-feature ebdb-mua |
| 2051 | :after ebdb |
| 2052 | ;; :custom (ebdb-mua-pop-up nil) |
| 2053 | ) |
| 2054 | |
| 2055 | ;; (use-package ebdb-message |
| 2056 | ;; :after ebdb) |
| 2057 | |
| 2058 | |
| 2059 | ;; (use-package ebdb-vcard |
| 2060 | ;; :after ebdb) |
| 2061 | |
| 2062 | (use-package message-x) |
| 2063 | |
| 2064 | (comment |
| 2065 | (use-package message-x |
| 2066 | :custom |
| 2067 | (message-x-completion-alist |
| 2068 | (quote |
| 2069 | (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address) |
| 2070 | ((if |
| 2071 | (boundp |
| 2072 | (quote message-newgroups-header-regexp)) |
| 2073 | message-newgroups-header-regexp message-newsgroups-header-regexp) |
| 2074 | . message-expand-group)))))) |
| 2075 | |
| 2076 | (comment |
| 2077 | (use-package gnus-harvest |
| 2078 | :commands gnus-harvest-install |
| 2079 | :demand t |
| 2080 | :config |
| 2081 | (if (featurep 'message-x) |
| 2082 | (gnus-harvest-install 'message-x) |
| 2083 | (gnus-harvest-install)))) |
| 2084 | |
| 2085 | \f |
| 2086 | ;;; IRC (with ERC and ZNC) |
| 2087 | |
| 2088 | (use-feature erc |
| 2089 | :bind (("C-c a e b" . erc-switch-to-buffer) |
| 2090 | :map erc-mode-map |
| 2091 | ("M-a" . erc-track-switch-buffer)) |
| 2092 | :custom |
| 2093 | (erc-join-buffer 'bury) |
| 2094 | (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) |
| 2095 | (erc-nick "bandali") |
| 2096 | (erc-rename-buffers t) |
| 2097 | (erc-server-reconnect-attempts 5) |
| 2098 | (erc-server-reconnect-timeout 3) |
| 2099 | :config |
| 2100 | (with-eval-after-load 'ivy |
| 2101 | ;; ignore channel buffer names |
| 2102 | (add-to-list 'ivy-ignore-buffers "^#")) |
| 2103 | (defun erc-cmd-OPME () |
| 2104 | "Request chanserv to op me." |
| 2105 | (erc-message "PRIVMSG" |
| 2106 | (format "chanserv op %s %s" |
| 2107 | (erc-default-target) |
| 2108 | (erc-current-nick)) nil)) |
| 2109 | (defun erc-cmd-DEOPME () |
| 2110 | "Deop myself from current channel." |
| 2111 | (erc-cmd-DEOP (format "%s" (erc-current-nick)))) |
| 2112 | (add-to-list 'erc-modules 'keep-place) |
| 2113 | (add-to-list 'erc-modules 'notifications) |
| 2114 | (add-to-list 'erc-modules 'spelling) |
| 2115 | (add-to-list 'erc-modules 'scrolltoplace) |
| 2116 | (erc-update-modules)) |
| 2117 | |
| 2118 | (use-feature erc-fill |
| 2119 | :after erc |
| 2120 | :custom |
| 2121 | (erc-fill-function 'erc-fill-static) |
| 2122 | (erc-fill-static-center 18)) |
| 2123 | |
| 2124 | (use-feature erc-pcomplete |
| 2125 | :after erc |
| 2126 | :custom |
| 2127 | (erc-pcomplete-nick-postfix ",")) |
| 2128 | |
| 2129 | (use-feature erc-track |
| 2130 | :after erc |
| 2131 | :custom |
| 2132 | (erc-track-enable-keybindings nil) |
| 2133 | (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" |
| 2134 | "324" "329" "332" "333" "353" "477")) |
| 2135 | (erc-track-priority-faces-only 'all) |
| 2136 | (erc-track-shorten-function nil)) |
| 2137 | |
| 2138 | (use-package erc-hl-nicks |
| 2139 | :after erc) |
| 2140 | |
| 2141 | (use-package erc-scrolltoplace |
| 2142 | :after erc) |
| 2143 | |
| 2144 | (use-package znc |
| 2145 | :straight (:host nil :repo "https://git.shemshak.org/amin/znc.el") |
| 2146 | :bind (("C-c a e e" . znc-erc) |
| 2147 | ("C-c a e a" . znc-all)) |
| 2148 | :config |
| 2149 | (let ((pwd (let ((auth (auth-source-search :host "znca"))) |
| 2150 | (cond |
| 2151 | ((null auth) (error "Couldn't find znca's authinfo")) |
| 2152 | (t (funcall (plist-get (car auth) :secret))))))) |
| 2153 | (setq znc-servers |
| 2154 | `(("znc.shemshak.org" 1337 t |
| 2155 | ((freenode "amin/freenode" ,pwd))) |
| 2156 | ("znc.shemshak.org" 1337 t |
| 2157 | ((moznet "amin/moznet" ,pwd))) |
| 2158 | ("znc.shemshak.org" 1337 t |
| 2159 | ((oftc "amin/oftc" ,pwd))))))) |
| 2160 | |
| 2161 | \f |
| 2162 | ;;; Post initialization |
| 2163 | |
| 2164 | (message "Loading %s...done (%.3fs)" user-init-file |
| 2165 | (float-time (time-subtract (current-time) |
| 2166 | a/before-user-init-time))) |
| 2167 | |
| 2168 | ;;; init.el ends here |