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