Commit | Line | Data |
---|---|---|
33b1a7ea | 1 | ;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*- |
41d290a2 | 2 | |
33b1a7ea | 3 | ;; Copyright (C) 2018-2019 Amin Bandali <bandali@gnu.org> |
41d290a2 AB |
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 | ||
33b1a7ea | 20 | ;; GNU Emacs configuration of Amin Bandali, computer scientist, |
92ad9675 | 21 | ;; Free Software activist, and GNU maintainer & webmaster. Packages |
f7910e3d | 22 | ;; are installed through using Borg for a fully reproducible setup. |
b57457b2 AB |
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 | |
41d290a2 | 35 | |
49e9503b AB |
36 | ;;; Code: |
37 | ||
b57457b2 AB |
38 | ;;; Emacs initialization |
39 | ||
dca50cf5 | 40 | (defvar b/before-user-init-time (current-time) |
41d290a2 | 41 | "Value of `current-time' when Emacs begins loading `user-init-file'.") |
83364e5b AB |
42 | (defvar b/emacs-initialized nil |
43 | "Whether Emacs has been initialized.") | |
8b1a2f32 AB |
44 | (defvar b/exwm-p (string= (system-name) "chaman") |
45 | "Whether or not we will be using `exwm'.") | |
83364e5b AB |
46 | |
47 | (when (not (bound-and-true-p b/emacs-initialized)) | |
48 | (message "Loading Emacs...done (%.3fs)" | |
49 | (float-time (time-subtract b/before-user-init-time | |
50 | before-init-time)))) | |
41d290a2 | 51 | |
b57457b2 AB |
52 | ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' |
53 | ;; during startup to reduce garbage collection frequency. clearing | |
54 | ;; `file-name-handler-alist' seems to help reduce startup time too. | |
dca50cf5 AB |
55 | (defvar b/gc-cons-threshold gc-cons-threshold) |
56 | (defvar b/gc-cons-percentage gc-cons-percentage) | |
57 | (defvar b/file-name-handler-alist file-name-handler-alist) | |
bc58e70a | 58 | (setq gc-cons-threshold (* 30 1024 1024) ; 30 MiB |
41d290a2 AB |
59 | gc-cons-percentage 0.6 |
60 | file-name-handler-alist nil | |
61 | ;; sidesteps a bug when profiling with esup | |
62 | esup-child-profile-require-level 0) | |
63 | ||
b57457b2 | 64 | ;; set them back to their defaults once we're done initializing |
dca50cf5 | 65 | (defun b/post-init () |
83364e5b AB |
66 | "My post-initialize function, run after loading `user-init-file'." |
67 | (setq b/emacs-initialized t | |
68 | gc-cons-threshold b/gc-cons-threshold | |
69 | gc-cons-percentage b/gc-cons-percentage | |
e8a3b8f7 | 70 | file-name-handler-alist b/file-name-handler-alist) |
8b1a2f32 AB |
71 | (when b/exwm-p |
72 | (with-eval-after-load 'exwm-workspace | |
73 | (setq-default | |
74 | mode-line-format | |
75 | (append | |
76 | mode-line-format | |
77 | '((:eval | |
78 | (format | |
79 | "[%s]" (number-to-string | |
80 | exwm-workspace-current-index))))))))) | |
dca50cf5 | 81 | (add-hook 'after-init-hook #'b/post-init) |
41d290a2 | 82 | |
b57457b2 | 83 | ;; increase number of lines kept in *Messages* log |
41d290a2 AB |
84 | (setq message-log-max 20000) |
85 | ||
b57457b2 AB |
86 | ;; optionally, uncomment to supress some byte-compiler warnings |
87 | ;; (see C-h v byte-compile-warnings RET for more info) | |
41d290a2 AB |
88 | ;; (setq byte-compile-warnings |
89 | ;; '(not free-vars unresolved noruntime lexical make-local)) | |
90 | ||
b57457b2 AB |
91 | \f |
92 | ;;; whoami | |
93 | ||
41d290a2 | 94 | (setq user-full-name "Amin Bandali" |
33b1a7ea | 95 | user-mail-address "bandali@gnu.org") |
41d290a2 | 96 | |
b57457b2 AB |
97 | \f |
98 | ;;; comment macro | |
99 | ||
100 | ;; useful for commenting out multiple sexps at a time | |
101 | (defmacro comment (&rest _) | |
102 | "Comment out one or more s-expressions." | |
103 | (declare (indent defun)) | |
104 | nil) | |
105 | ||
106 | \f | |
33273849 AB |
107 | ;;; Package management |
108 | ||
47904cb7 AB |
109 | ;; No package.el (for emacs 26 and before) |
110 | (when (version< emacs-version "27") | |
33273849 AB |
111 | (setq package-enable-at-startup nil) |
112 | ;; (package-initialize) | |
113 | ) | |
33273849 AB |
114 | ;; for emacs 27 and later, we use early-init.el. see |
115 | ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b | |
116 | ||
032726b6 AB |
117 | (progn ; `borg' |
118 | (add-to-list 'load-path | |
119 | (expand-file-name "lib/borg" user-emacs-directory)) | |
120 | (require 'borg) | |
121 | (borg-initialize) | |
122 | (setq borg-rewrite-urls-alist | |
123 | '(("git@github.com:" . "https://github.com/") | |
124 | ("git@gitlab.com:" . "https://gitlab.com/")))) | |
33273849 AB |
125 | |
126 | ;; use-package | |
41d290a2 AB |
127 | (if nil ; set to t when need to debug init |
128 | (progn | |
129 | (setq use-package-verbose t | |
130 | use-package-expand-minimally nil | |
131 | use-package-compute-statistics t | |
132 | debug-on-error t) | |
133 | (require 'use-package)) | |
134 | (setq use-package-verbose nil | |
135 | use-package-expand-minimally t)) | |
136 | ||
137 | (setq use-package-always-defer t) | |
138 | (require 'bind-key) | |
139 | ||
b57457b2 AB |
140 | \f |
141 | ;;; Initial setup | |
142 | ||
143 | ;; keep ~/.emacs.d clean | |
1060413b AB |
144 | (use-package no-littering |
145 | :demand | |
146 | :config | |
147 | (defalias 'b/etc 'no-littering-expand-etc-file-name) | |
148 | (defalias 'b/var 'no-littering-expand-var-file-name)) | |
41d290a2 | 149 | |
032726b6 AB |
150 | (use-package auto-compile |
151 | :demand | |
152 | :config | |
153 | (auto-compile-on-load-mode) | |
154 | (auto-compile-on-save-mode) | |
155 | (setq auto-compile-display-buffer nil) | |
156 | (setq auto-compile-mode-line-counter t) | |
157 | (setq auto-compile-source-recreate-deletes-dest t) | |
158 | (setq auto-compile-toggle-deletes-nonlib-dest t) | |
159 | (setq auto-compile-update-autoloads t)) | |
160 | ||
b57457b2 | 161 | ;; separate custom file (don't want it mixing with init.el) |
47904cb7 | 162 | (use-package custom |
60ff805e | 163 | :no-require |
41d290a2 | 164 | :config |
dca50cf5 | 165 | (setq custom-file (b/etc "custom.el")) |
41d290a2 AB |
166 | (when (file-exists-p custom-file) |
167 | (load custom-file)) | |
b57457b2 | 168 | ;; while at it, treat themes as safe |
60ff805e AB |
169 | (setf custom-safe-themes t) |
170 | ;; only one custom theme at a time | |
171 | (comment | |
172 | (defadvice load-theme (before clear-previous-themes activate) | |
173 | "Clear existing theme settings instead of layering them" | |
174 | (mapc #'disable-theme custom-enabled-themes)))) | |
41d290a2 | 175 | |
b57457b2 | 176 | ;; load the secrets file if it exists, otherwise show a warning |
dca50cf5 AB |
177 | (comment |
178 | (with-demoted-errors | |
179 | (load (b/etc "secrets")))) | |
41d290a2 | 180 | |
b57457b2 AB |
181 | ;; start up emacs server. see |
182 | ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server | |
47904cb7 | 183 | (use-package server |
f7910e3d | 184 | :defer 0.5 |
41d290a2 AB |
185 | :config (or (server-running-p) (server-mode))) |
186 | ||
60ff805e AB |
187 | \f |
188 | ;;; Useful utilities | |
189 | ||
60ff805e AB |
190 | (defmacro b/setq-every (value &rest vars) |
191 | "Set all the variables from VARS to value VALUE." | |
192 | (declare (indent defun) (debug t)) | |
193 | `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))) | |
194 | ||
195 | (defun b/start-process (program &rest args) | |
196 | "Same as `start-process', but doesn't bother about name and buffer." | |
197 | (let ((process-name (concat program "_process")) | |
198 | (buffer-name (generate-new-buffer-name | |
199 | (concat program "_output")))) | |
200 | (apply #'start-process | |
201 | process-name buffer-name program args))) | |
202 | ||
203 | (defun b/dired-start-process (program &optional args) | |
204 | "Open current file with a PROGRAM." | |
205 | ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can | |
206 | ;; be nil, so remove it). | |
207 | (apply #'b/start-process | |
208 | program | |
209 | (remove nil (list args (dired-get-file-for-visit))))) | |
210 | ||
211 | (defun b/add-elisp-section () | |
212 | (interactive) | |
213 | (insert "\n") | |
214 | (previous-line) | |
215 | (insert "\n\f\n;;; ")) | |
216 | ||
a1e77a3d AB |
217 | ;; (defvar b/fill-column 47 |
218 | ;; "My custom `fill-column'.") | |
3214b7ca AB |
219 | |
220 | (defconst b/asterism "* * *") | |
221 | ||
bc2f85e1 | 222 | (defun b/insert-asterism () |
3214b7ca | 223 | "Insert a centred asterism." |
bc2f85e1 | 224 | (interactive) |
3214b7ca AB |
225 | (insert |
226 | (concat | |
227 | "\n\n" | |
a1e77a3d | 228 | (make-string (floor (/ (- fill-column (length b/asterism)) 2)) |
3214b7ca AB |
229 | ?\s) |
230 | b/asterism | |
231 | "\n\n"))) | |
bc2f85e1 | 232 | |
60ff805e AB |
233 | (defun b/no-mouse-autoselect-window () |
234 | "Conveniently disable `focus-follows-mouse'. | |
235 | For disabling the behaviour for certain buffers and/or modes." | |
236 | (make-local-variable 'mouse-autoselect-window) | |
237 | (setq mouse-autoselect-window nil)) | |
238 | ||
a5cc22f4 AB |
239 | (defun b/kill-current-buffer () |
240 | "Kill the current buffer." | |
241 | ;; also see https://redd.it/64xb3q | |
242 | (interactive) | |
243 | (kill-buffer (current-buffer))) | |
244 | ||
60ff805e AB |
245 | \f |
246 | ;;; Defaults | |
247 | ||
248 | ;;;; C-level customizations | |
249 | ||
250 | (setq | |
251 | ;; minibuffer | |
252 | enable-recursive-minibuffers t | |
253 | resize-mini-windows t | |
254 | ;; more useful frame titles | |
255 | frame-title-format '("" invocation-name " - " | |
256 | (:eval | |
257 | (if (buffer-file-name) | |
258 | (abbreviate-file-name (buffer-file-name)) | |
259 | "%b"))) | |
260 | ;; i don't feel like jumping out of my chair every now and again; so | |
261 | ;; don't BEEP! at me, emacs | |
262 | ring-bell-function 'ignore | |
263 | ;; better scrolling | |
264 | ;; scroll-margin 1 | |
265 | ;; scroll-conservatively 10000 | |
266 | scroll-step 1 | |
267 | scroll-conservatively 10 | |
268 | scroll-preserve-screen-position 1 | |
269 | ;; focus follows mouse | |
39cc9c96 | 270 | mouse-autoselect-window t) |
60ff805e AB |
271 | |
272 | (setq-default | |
273 | ;; always use space for indentation | |
274 | indent-tabs-mode nil | |
275 | tab-width 4 | |
276 | ;; cursor shape | |
567440fa | 277 | cursor-type t) |
60ff805e | 278 | |
b57457b2 AB |
279 | ;; unicode support |
280 | (comment | |
281 | (dolist (ft (fontset-list)) | |
282 | (set-fontset-font | |
283 | ft | |
284 | 'unicode | |
285 | (font-spec :name "Source Code Pro" :size 14)) | |
286 | (set-fontset-font | |
287 | ft | |
288 | 'unicode | |
289 | (font-spec :name "DejaVu Sans Mono") | |
290 | nil | |
291 | 'append) | |
292 | ;; (set-fontset-font | |
293 | ;; ft | |
294 | ;; 'unicode | |
295 | ;; (font-spec | |
296 | ;; :name "Symbola monospacified for DejaVu Sans Mono") | |
297 | ;; nil | |
298 | ;; 'append) | |
299 | ;; (set-fontset-font | |
300 | ;; ft | |
301 | ;; #x2115 ; ℕ | |
302 | ;; (font-spec :name "DejaVu Sans Mono") | |
303 | ;; nil | |
304 | ;; 'append) | |
305 | (set-fontset-font | |
306 | ft | |
307 | (cons ?Α ?ω) | |
308 | (font-spec :name "DejaVu Sans Mono" :size 14) | |
309 | nil | |
310 | 'prepend))) | |
311 | ||
60ff805e | 312 | ;;;; Elisp-level customizations |
41d290a2 | 313 | |
47904cb7 | 314 | (use-package startup |
60ff805e AB |
315 | :no-require |
316 | :demand | |
41d290a2 | 317 | :config |
60ff805e AB |
318 | ;; don't need to see the startup echo area message |
319 | (advice-add #'display-startup-echo-area-message :override #'ignore) | |
320 | :custom | |
321 | ;; i want *scratch* as my startup buffer | |
322 | (initial-buffer-choice t) | |
323 | ;; i don't need the default hint | |
324 | (initial-scratch-message nil) | |
325 | ;; use customizable text-mode as major mode for *scratch* | |
2568a634 | 326 | ;; (initial-major-mode 'text-mode) |
60ff805e AB |
327 | ;; inhibit buffer list when more than 2 files are loaded |
328 | (inhibit-startup-buffer-menu t) | |
329 | ;; don't need to see the startup screen or echo area message | |
330 | (inhibit-startup-screen t) | |
331 | (inhibit-startup-echo-area-message user-login-name)) | |
41d290a2 | 332 | |
47904cb7 | 333 | (use-package files |
60ff805e AB |
334 | :no-require |
335 | :demand | |
9fc30d4c | 336 | :custom |
60ff805e AB |
337 | ;; backups (C-h v make-backup-files RET) |
338 | (backup-by-copying t) | |
339 | (version-control t) | |
340 | (delete-old-versions t) | |
41d290a2 | 341 | |
60ff805e AB |
342 | ;; auto-save |
343 | (auto-save-file-name-transforms | |
344 | `((".*" ,(b/var "auto-save/") t))) | |
41d290a2 | 345 | |
60ff805e AB |
346 | ;; insert newline at the end of files |
347 | (require-final-newline t) | |
b57457b2 | 348 | |
60ff805e AB |
349 | ;; open read-only file buffers in view-mode |
350 | ;; (enables niceties like `q' for quit) | |
351 | (view-read-only t)) | |
41d290a2 | 352 | |
60ff805e AB |
353 | ;; disable disabled commands |
354 | (setq disabled-command-function nil) | |
41d290a2 | 355 | |
60ff805e AB |
356 | ;; lazy-person-friendly yes/no prompts |
357 | (defalias 'yes-or-no-p #'y-or-n-p) | |
b57457b2 | 358 | |
60ff805e | 359 | ;; enable automatic reloading of changed buffers and files |
47904cb7 | 360 | (use-package autorevert |
60ff805e AB |
361 | :demand |
362 | :config | |
363 | (global-auto-revert-mode 1) | |
364 | :custom | |
365 | (auto-revert-verbose nil) | |
366 | (global-auto-revert-non-file-buffers nil)) | |
b57457b2 AB |
367 | |
368 | ;; time and battery in mode-line | |
47904cb7 | 369 | (use-package time |
e4902e0b | 370 | :demand |
64938292 AB |
371 | :config |
372 | (display-time-mode) | |
373 | :custom | |
374 | (display-time-default-load-average nil) | |
f7910e3d | 375 | (display-time-format " %a %b %-e %-l:%M%P") |
ad61316b AB |
376 | (display-time-mail-icon '(image :type xpm :file "gnus/gnus-pointer.xpm" :ascent center)) |
377 | (display-time-use-mail-icon t)) | |
64938292 | 378 | |
47904cb7 | 379 | (use-package battery |
e4902e0b | 380 | :demand |
64938292 AB |
381 | :config |
382 | (display-battery-mode) | |
383 | :custom | |
f7910e3d | 384 | (battery-mode-line-format "%p%% %t")) |
b57457b2 | 385 | |
47904cb7 | 386 | (use-package fringe |
60ff805e AB |
387 | :demand |
388 | :config | |
389 | ;; smaller fringe | |
390 | ;; (fringe-mode '(3 . 1)) | |
391 | (fringe-mode nil)) | |
41d290a2 | 392 | |
47904cb7 | 393 | (use-package winner |
60ff805e AB |
394 | :demand |
395 | :config | |
396 | ;; enable winner-mode (C-h f winner-mode RET) | |
397 | (winner-mode 1)) | |
41d290a2 | 398 | |
47904cb7 | 399 | (use-package compile |
60ff805e AB |
400 | :config |
401 | ;; don't display *compilation* buffer on success. based on | |
402 | ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf' | |
403 | ;; instead of the now obsolete `flet'. | |
dca50cf5 | 404 | (defun b/compilation-finish-function (buffer outstr) |
41d290a2 AB |
405 | (unless (string-match "finished" outstr) |
406 | (switch-to-buffer-other-window buffer)) | |
407 | t) | |
408 | ||
dca50cf5 | 409 | (setq compilation-finish-functions #'b/compilation-finish-function) |
41d290a2 AB |
410 | |
411 | (require 'cl-macs) | |
412 | ||
413 | (defadvice compilation-start | |
414 | (around inhibit-display | |
415 | (command &optional mode name-function highlight-regexp)) | |
416 | (if (not (string-match "^\\(find\\|grep\\)" command)) | |
417 | (cl-letf (((symbol-function 'display-buffer) #'ignore)) | |
418 | (save-window-excursion ad-do-it)) | |
419 | ad-do-it)) | |
420 | (ad-activate 'compilation-start)) | |
421 | ||
47904cb7 | 422 | (use-package isearch |
60ff805e AB |
423 | :custom |
424 | ;; allow scrolling in Isearch | |
425 | (isearch-allow-scroll t) | |
426 | ;; search for non-ASCII characters: i’d like non-ASCII characters such | |
427 | ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII | |
428 | ;; counterpart. shoutout to | |
429 | ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html | |
430 | (search-default-mode #'char-fold-to-regexp)) | |
431 | ||
432 | ;; uncomment to extend the above behaviour to query-replace | |
433 | (comment | |
47904cb7 | 434 | (use-package replace |
60ff805e AB |
435 | :custom |
436 | (replace-char-fold t))) | |
b9901074 | 437 | |
47904cb7 | 438 | (use-package vc |
b1a5d811 AB |
439 | :bind ("C-x v C-=" . vc-ediff)) |
440 | ||
47904cb7 | 441 | (use-package vc-git |
e59c8878 AB |
442 | :after vc |
443 | :custom | |
444 | (vc-git-print-log-follow t)) | |
445 | ||
47904cb7 | 446 | (use-package ediff |
b1a5d811 AB |
447 | :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) |
448 | :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) | |
449 | (ediff-split-window-function 'split-window-horizontally))) | |
450 | ||
47904cb7 | 451 | (use-package face-remap |
60ff805e AB |
452 | :custom |
453 | ;; gentler font resizing | |
454 | (text-scale-mode-step 1.05)) | |
455 | ||
47904cb7 | 456 | (use-package mwheel |
60ff805e AB |
457 | :defer 0.4 |
458 | :config | |
459 | (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)) ; one line at a time | |
460 | mouse-wheel-progressive-speed nil ; don't accelerate scrolling | |
461 | mouse-wheel-follow-mouse t)) ; scroll window under mouse | |
462 | ||
47904cb7 | 463 | (use-package pixel-scroll |
60ff805e AB |
464 | :defer 0.4 |
465 | :config (pixel-scroll-mode 1)) | |
466 | ||
47904cb7 | 467 | (use-package epg-config |
a89c8bd8 AB |
468 | :config |
469 | ;; ask for GPG passphrase in minibuffer | |
470 | ;; this will fail if gpg>=2.1 is not available | |
471 | (if (version< "27" emacs-version) | |
472 | (setq epg-pinentry-mode 'loopback) | |
473 | (setq epa-pinentry-mode 'loopback)) | |
60ff805e | 474 | :custom |
47904cb7 | 475 | (epg-gpg-program (executable-find "gpg"))) |
1d405cde | 476 | |
47904cb7 AB |
477 | (use-package epg |
478 | :after epg-config) | |
479 | ||
a89c8bd8 | 480 | (use-package pinentry |
8b1a2f32 | 481 | :disabled |
a89c8bd8 AB |
482 | :demand |
483 | :after (epa epg server) | |
484 | :config | |
485 | ;; workaround for systemd-based distros: | |
486 | ;; (setq pinentry--socket-dir server-socket-dir) | |
487 | (pinentry-start)) | |
488 | ||
47904cb7 | 489 | (use-package auth-source |
b98dbb3d AB |
490 | :custom |
491 | (auth-sources '("~/.authinfo.gpg")) | |
492 | (authinfo-hidden (regexp-opt '("password" "client-secret" "token")))) | |
493 | ||
b57457b2 AB |
494 | \f |
495 | ;;; General bindings | |
496 | ||
41d290a2 AB |
497 | (bind-keys |
498 | ("C-c a i" . ielm) | |
499 | ||
500 | ("C-c e b" . eval-buffer) | |
2a816b71 | 501 | ("C-c e e" . eval-last-sexp) |
41d290a2 AB |
502 | ("C-c e r" . eval-region) |
503 | ||
504 | ("C-c e i" . emacs-init-time) | |
505 | ("C-c e u" . emacs-uptime) | |
dca50cf5 | 506 | ("C-c e v" . emacs-version) |
41d290a2 | 507 | |
567440fa AB |
508 | ("C-c f ." . find-file) |
509 | ("C-c f d" . find-name-dired) | |
510 | ("C-c f l" . find-library) | |
511 | ||
41d290a2 AB |
512 | ("C-c F m" . make-frame-command) |
513 | ("C-c F d" . delete-frame) | |
435306f6 | 514 | ("C-c F D" . server-edit) |
41d290a2 | 515 | |
41d290a2 AB |
516 | ("C-S-h C" . describe-char) |
517 | ("C-S-h F" . describe-face) | |
518 | ||
567440fa AB |
519 | ("C-c x" . execute-extended-command) |
520 | ||
a5cc22f4 | 521 | ("C-x k" . b/kill-current-buffer) |
41d290a2 | 522 | ("C-x K" . kill-buffer) |
2a816b71 AB |
523 | ("C-x s" . save-buffer) |
524 | ("C-x S" . save-some-buffers) | |
41d290a2 | 525 | |
b57457b2 | 526 | :map emacs-lisp-mode-map |
dca50cf5 | 527 | ("<C-return>" . b/add-elisp-section)) |
41d290a2 AB |
528 | |
529 | (when (display-graphic-p) | |
530 | (unbind-key "C-z" global-map)) | |
531 | ||
500004f4 AB |
532 | (bind-keys |
533 | ;; for back and forward mouse keys | |
0365678c | 534 | ("<XF86Back>" . previous-buffer) |
500004f4 | 535 | ("<mouse-8>" . previous-buffer) |
4bdfe6ab | 536 | ;; ("<drag-mouse-8>" . previous-buffer) |
0365678c | 537 | ("<XF86Forward>" . next-buffer) |
500004f4 | 538 | ("<mouse-9>" . next-buffer) |
4bdfe6ab AB |
539 | ;; ("<drag-mouse-9>" . next-buffer) |
540 | ;; ("<drag-mouse-2>" . kill-this-buffer) | |
541 | ;; ("<drag-mouse-3>" . switch-to-buffer) | |
542 | ) | |
500004f4 | 543 | |
b57457b2 AB |
544 | \f |
545 | ;;; Essential packages | |
546 | ||
f7910e3d AB |
547 | (add-to-list |
548 | 'load-path | |
549 | (expand-file-name | |
550 | (convert-standard-filename "lisp") user-emacs-directory)) | |
551 | ||
8b1a2f32 AB |
552 | (when b/exwm-p |
553 | (require 'bandali-exwm)) | |
33273849 | 554 | |
f7910e3d | 555 | (require 'bandali-org) |
41d290a2 | 556 | |
b57457b2 | 557 | ;; *the* right way to do git |
41d290a2 | 558 | (use-package magit |
2a816b71 AB |
559 | :bind (("C-x g" . magit-status) |
560 | ("C-c g g" . magit-status) | |
ef6c487c AB |
561 | ("C-c g b" . magit-blame-addition) |
562 | ("C-c g l" . magit-log-buffer-file)) | |
41d290a2 AB |
563 | :config |
564 | (magit-add-section-hook 'magit-status-sections-hook | |
565 | 'magit-insert-modules | |
566 | 'magit-insert-stashes | |
567 | 'append) | |
3b3615f5 AB |
568 | ;; (magit-add-section-hook 'magit-status-sections-hook |
569 | ;; 'magit-insert-ignored-files | |
570 | ;; 'magit-insert-untracked-files | |
571 | ;; 'append) | |
8a2e0eef | 572 | (setq magit-repository-directories '(("~/.emacs.d/" . 0) |
81ea6e55 | 573 | ("~/src/git/" . 2))) |
41d290a2 AB |
574 | (nconc magit-section-initial-visibility-alist |
575 | '(([unpulled status] . show) | |
576 | ([unpushed status] . show))) | |
3fffeb0a AB |
577 | :custom |
578 | (magit-diff-refine-hunk t) | |
579 | (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) | |
6ca3a7b1 | 580 | ;; (magit-completing-read-function 'magit-ido-completing-read) |
41d290a2 AB |
581 | :custom-face (magit-diff-file-heading ((t (:weight normal))))) |
582 | ||
b57457b2 | 583 | ;; recently opened files |
47904cb7 | 584 | (use-package recentf |
41d290a2 | 585 | :defer 0.2 |
dca50cf5 | 586 | ;; :config |
9424b3d6 | 587 | ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") |
6eb104ff AB |
588 | :config |
589 | (recentf-mode) | |
dca50cf5 | 590 | :custom |
1060413b | 591 | (recentf-max-saved-items 2000)) |
41d290a2 | 592 | |
6ca3a7b1 | 593 | (comment |
47904cb7 | 594 | (use-package ido |
6ca3a7b1 AB |
595 | :demand |
596 | :bind | |
597 | (:map ido-common-completion-map | |
598 | ([escape] . minibuffer-keyboard-quit) | |
599 | ("DEL" . b/ido-backspace)) | |
600 | :config | |
601 | (require 'delsel) | |
602 | (defun b/ido-backspace () | |
603 | "Forward to `backward-delete-char'. On error (read-only), quit." | |
604 | (interactive) | |
605 | (condition-case nil | |
606 | (backward-delete-char 1) | |
607 | (error | |
608 | (minibuffer-keyboard-quit)))) | |
609 | (ido-mode 1) | |
610 | (ido-everywhere 1) | |
611 | :custom | |
612 | (ido-enable-flex-matching t) | |
613 | ;; (ido-enable-regexp t) | |
614 | ;; (ido-enable-prefix t) | |
615 | (ido-max-window-height 10) | |
616 | (ido-use-virtual-buffers t)) | |
617 | ||
618 | (use-package ido-vertical-mode | |
619 | :defer 0.3 | |
620 | :config | |
621 | (ido-vertical-mode 1) | |
622 | :custom | |
623 | (ido-vertical-define-keys 'C-n-C-p-up-and-down) | |
624 | (ido-vertical-show-count t)) | |
6eb104ff | 625 | |
6ca3a7b1 AB |
626 | (use-package ido-completing-read+ |
627 | :defer 0.3 | |
628 | :after ido | |
629 | :config | |
630 | (ido-ubiquitous-mode 1)) | |
6eb104ff | 631 | |
6ca3a7b1 AB |
632 | (use-package crm-custom |
633 | :defer 0.3 | |
634 | :config | |
635 | (crm-custom-mode 1)) | |
636 | ||
47904cb7 | 637 | (use-package icomplete |
6ca3a7b1 AB |
638 | :defer 0.3 |
639 | :config | |
640 | (icomplete-mode 1))) | |
6eb104ff AB |
641 | |
642 | (use-package amx | |
643 | :defer 0.3 | |
644 | :config | |
645 | (amx-mode)) | |
646 | ||
41d290a2 AB |
647 | (use-package ivy |
648 | :defer 0.3 | |
649 | :bind | |
650 | (:map ivy-minibuffer-map | |
651 | ([escape] . keyboard-escape-quit) | |
652 | ([S-up] . ivy-previous-history-element) | |
653 | ([S-down] . ivy-next-history-element) | |
654 | ("DEL" . ivy-backward-delete-char)) | |
655 | :config | |
656 | (setq ivy-wrap t | |
6ca3a7b1 | 657 | ;; ivy-height 14 |
41d290a2 AB |
658 | ivy-use-virtual-buffers t |
659 | ivy-virtual-abbreviate 'abbreviate | |
660 | ivy-count-format "%d/%d ") | |
fcd36528 AB |
661 | |
662 | (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode)) | |
663 | (defun b/ivy-ignore-buffer-p (str) | |
664 | "Return non-nil if str names a buffer with a major mode | |
665 | derived from one of `b/ivy-ignore-buffer-modes'. | |
666 | ||
667 | This function is intended for use with `ivy-ignore-buffers'." | |
668 | (let* ((buf (get-buffer str)) | |
669 | (mode (and buf (buffer-local-value 'major-mode buf)))) | |
670 | (and mode | |
671 | (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes)))) | |
672 | (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p) | |
673 | ||
41d290a2 | 674 | (ivy-mode 1) |
27113bb8 | 675 | :custom-face |
295b1b10 | 676 | (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee")))) |
27113bb8 | 677 | (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold)))) |
295b1b10 AB |
678 | (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold)))) |
679 | (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold)))) | |
27113bb8 AB |
680 | (ivy-current-match ((((class color) (background light)) |
681 | :background "#d7d7d7" :foreground "black") | |
682 | (((class color) (background dark)) | |
683 | :background "#65a7e2" :foreground "black")))) | |
41d290a2 AB |
684 | |
685 | (use-package swiper | |
6ca3a7b1 AB |
686 | :demand |
687 | :after ivy | |
ab1f4969 | 688 | :bind (("C-S-s" . swiper-isearch))) |
41d290a2 AB |
689 | |
690 | (use-package counsel | |
ab1f4969 AB |
691 | :demand |
692 | :after ivy | |
693 | :bind (("C-c f r" . counsel-recentf) | |
6ca3a7b1 | 694 | :map minibuffer-local-map |
ab1f4969 | 695 | ("C-r" . counsel-minibuffer-history)) |
6ca3a7b1 AB |
696 | :config |
697 | (counsel-mode 1) | |
698 | (defalias 'locate #'counsel-locate)) | |
41d290a2 | 699 | |
8b1a2f32 | 700 | (comment |
47904cb7 | 701 | (use-package eshell |
41d290a2 AB |
702 | :defer 0.5 |
703 | :commands eshell | |
704 | :bind ("C-c a s e" . eshell) | |
705 | :config | |
706 | (eval-when-compile (defvar eshell-prompt-regexp)) | |
dca50cf5 | 707 | (defun b/eshell-quit-or-delete-char (arg) |
41d290a2 AB |
708 | (interactive "p") |
709 | (if (and (eolp) (looking-back eshell-prompt-regexp nil)) | |
710 | (eshell-life-is-too-much) | |
711 | (delete-char arg))) | |
712 | ||
dca50cf5 | 713 | (defun b/eshell-clear () |
41d290a2 AB |
714 | (interactive) |
715 | (let ((inhibit-read-only t)) | |
716 | (erase-buffer)) | |
717 | (eshell-send-input)) | |
718 | ||
dca50cf5 | 719 | (defun b/eshell-setup () |
41d290a2 AB |
720 | (make-local-variable 'company-idle-delay) |
721 | (defvar company-idle-delay) | |
722 | (setq company-idle-delay nil) | |
723 | (bind-keys :map eshell-mode-map | |
dca50cf5 AB |
724 | ("C-d" . b/eshell-quit-or-delete-char) |
725 | ("C-S-l" . b/eshell-clear) | |
41d290a2 | 726 | ("M-r" . counsel-esh-history) |
6eb104ff | 727 | ;; ([tab] . company-complete) |
946188e1 AB |
728 | ) |
729 | (if (version< "27" emacs-version) | |
730 | (bind-keys :map eshell-hist-mode-map | |
731 | ("M-r" . counsel-esh-history)) | |
732 | (bind-keys :map eshell-mode-map | |
733 | ("M-r" . counsel-esh-history)))) | |
41d290a2 | 734 | |
5b4b57a9 AB |
735 | (setq |
736 | eshell-prompt-regexp "\\(.*\n\\)*[$#] " | |
737 | eshell-prompt-function | |
738 | (lambda () | |
739 | (concat | |
740 | (propertize (format "%s@%s:" (user-login-name) (system-name)) | |
741 | 'face 'default) | |
742 | (propertize (abbreviate-file-name default-directory) | |
743 | 'face 'font-lock-comment-face) | |
744 | (propertize "\n" 'face 'default) | |
745 | (if (= (user-uid) 0) | |
746 | (propertize "#" 'face 'red) | |
747 | (propertize "$" 'face 'default)) | |
748 | (propertize " " 'face 'default)))) | |
749 | ||
dca50cf5 | 750 | :hook (eshell-mode . b/eshell-setup) |
41d290a2 AB |
751 | :custom |
752 | (eshell-hist-ignoredups t) | |
753 | (eshell-input-filter 'eshell-input-filter-initial-space)) | |
754 | ||
47904cb7 | 755 | (use-package ibuffer |
41d290a2 | 756 | :bind |
92df6c4f | 757 | (("C-x C-b" . ibuffer) |
41d290a2 AB |
758 | :map ibuffer-mode-map |
759 | ("P" . ibuffer-backward-filter-group) | |
760 | ("N" . ibuffer-forward-filter-group) | |
761 | ("M-p" . ibuffer-do-print) | |
762 | ("M-n" . ibuffer-do-shell-command-pipe-replace)) | |
763 | :config | |
764 | ;; Use human readable Size column instead of original one | |
765 | (define-ibuffer-column size-h | |
766 | (:name "Size" :inline t) | |
767 | (cond | |
768 | ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) | |
769 | ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0))) | |
770 | ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) | |
771 | (t (format "%8d" (buffer-size))))) | |
772 | :custom | |
773 | (ibuffer-saved-filter-groups | |
774 | '(("default" | |
775 | ("dired" (mode . dired-mode)) | |
776 | ("org" (mode . org-mode)) | |
777 | ("gnus" | |
778 | (or | |
779 | (mode . gnus-group-mode) | |
780 | (mode . gnus-summary-mode) | |
781 | (mode . gnus-article-mode) | |
782 | ;; not really, but... | |
783 | (mode . message-mode))) | |
784 | ("web" | |
785 | (or | |
68b2cdaa AB |
786 | ;; (mode . web-mode) |
787 | (mode . mhtml-mode) | |
41d290a2 AB |
788 | (mode . css-mode) |
789 | (mode . scss-mode) | |
790 | (mode . js2-mode))) | |
791 | ("shell" | |
792 | (or | |
793 | (mode . eshell-mode) | |
794 | (mode . shell-mode) | |
795 | (mode . term-mode))) | |
796 | ("programming" | |
797 | (or | |
798 | (mode . python-mode) | |
799 | (mode . c-mode) | |
800 | (mode . c++-mode) | |
801 | (mode . java-mode) | |
802 | (mode . emacs-lisp-mode) | |
803 | (mode . scheme-mode) | |
804 | (mode . haskell-mode) | |
805 | (mode . lean-mode) | |
47904cb7 | 806 | ;; (mode . go-mode) |
41d290a2 AB |
807 | (mode . alloy-mode))) |
808 | ("tex" | |
809 | (or | |
810 | (mode . bibtex-mode) | |
811 | (mode . latex-mode))) | |
812 | ("emacs" | |
813 | (or | |
814 | (name . "^\\*scratch\\*$") | |
815 | (name . "^\\*Messages\\*$"))) | |
319c6483 | 816 | ("exwm" (mode . exwm-mode)) |
41d290a2 AB |
817 | ("erc" (mode . erc-mode))))) |
818 | (ibuffer-formats | |
819 | '((mark modified read-only locked " " | |
319c6483 | 820 | (name 72 72 :left :elide) |
41d290a2 AB |
821 | " " |
822 | (size-h 9 -1 :right) | |
823 | " " | |
824 | (mode 16 16 :left :elide) | |
825 | " " filename-and-process) | |
826 | (mark " " | |
827 | (name 16 -1) | |
828 | " " filename))) | |
829 | :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default")))) | |
830 | ||
47904cb7 | 831 | (use-package outline |
2e81c51a | 832 | :disabled |
41d290a2 AB |
833 | :hook (prog-mode . outline-minor-mode) |
834 | :bind | |
835 | (:map | |
836 | outline-minor-mode-map | |
837 | ("<s-tab>" . outline-toggle-children) | |
838 | ("M-p" . outline-previous-visible-heading) | |
839 | ("M-n" . outline-next-visible-heading) | |
dca50cf5 | 840 | :prefix-map b/outline-prefix-map |
ed8c4fa9 | 841 | :prefix "s-O" |
41d290a2 AB |
842 | ("TAB" . outline-toggle-children) |
843 | ("a" . outline-hide-body) | |
844 | ("H" . outline-hide-body) | |
845 | ("S" . outline-show-all) | |
846 | ("h" . outline-hide-subtree) | |
847 | ("s" . outline-show-subtree))) | |
848 | ||
47904cb7 | 849 | (use-package ls-lisp |
41d290a2 AB |
850 | :custom (ls-lisp-dirs-first t)) |
851 | ||
47904cb7 | 852 | (use-package dired |
41d290a2 | 853 | :config |
14bd6398 AB |
854 | (setq dired-dwim-target t |
855 | dired-listing-switches "-alh" | |
41d290a2 AB |
856 | ls-lisp-use-insert-directory-program nil) |
857 | ||
858 | ;; easily diff 2 marked files | |
859 | ;; https://oremacs.com/2017/03/18/dired-ediff/ | |
860 | (defun dired-ediff-files () | |
861 | (interactive) | |
862 | (require 'dired-aux) | |
863 | (defvar ediff-after-quit-hook-internal) | |
864 | (let ((files (dired-get-marked-files)) | |
865 | (wnd (current-window-configuration))) | |
866 | (if (<= (length files) 2) | |
867 | (let ((file1 (car files)) | |
868 | (file2 (if (cdr files) | |
869 | (cadr files) | |
870 | (read-file-name | |
871 | "file: " | |
872 | (dired-dwim-target-directory))))) | |
873 | (if (file-newer-than-file-p file1 file2) | |
874 | (ediff-files file2 file1) | |
875 | (ediff-files file1 file2)) | |
876 | (add-hook 'ediff-after-quit-hook-internal | |
877 | (lambda () | |
878 | (setq ediff-after-quit-hook-internal nil) | |
879 | (set-window-configuration wnd)))) | |
880 | (error "no more than 2 files should be marked")))) | |
06ee5a00 AB |
881 | |
882 | (require 'dired-x) | |
883 | (setq dired-guess-shell-alist-user | |
884 | '(("\\.pdf\\'" "evince" "zathura" "okular") | |
885 | ("\\.doc\\'" "libreoffice") | |
886 | ("\\.docx\\'" "libreoffice") | |
887 | ("\\.ppt\\'" "libreoffice") | |
888 | ("\\.pptx\\'" "libreoffice") | |
889 | ("\\.xls\\'" "libreoffice") | |
890 | ("\\.xlsx\\'" "libreoffice") | |
891 | ("\\.flac\\'" "mpv"))) | |
41d290a2 AB |
892 | :bind (:map dired-mode-map |
893 | ("b" . dired-up-directory) | |
b1ed18e4 AB |
894 | ("E" . dired-ediff-files) |
895 | ("e" . dired-toggle-read-only) | |
41d290a2 AB |
896 | ("\\" . dired-hide-details-mode) |
897 | ("z" . (lambda () | |
898 | (interactive) | |
dca50cf5 | 899 | (b/dired-start-process "zathura")))) |
41d290a2 AB |
900 | :hook (dired-mode . dired-hide-details-mode)) |
901 | ||
47904cb7 | 902 | (use-package help |
41d290a2 AB |
903 | :config |
904 | (temp-buffer-resize-mode) | |
905 | (setq help-window-select t)) | |
906 | ||
47904cb7 | 907 | (use-package tramp |
41d290a2 AB |
908 | :config |
909 | (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) | |
910 | (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) | |
911 | (add-to-list 'tramp-default-proxies-alist | |
912 | (list (regexp-quote (system-name)) nil nil))) | |
913 | ||
47904cb7 | 914 | (use-package doc-view |
41d290a2 AB |
915 | :bind (:map doc-view-mode-map |
916 | ("M-RET" . image-previous-line))) | |
917 | ||
b57457b2 AB |
918 | \f |
919 | ;;; Editing | |
920 | ||
921 | ;; highlight uncommitted changes in the left fringe | |
41d290a2 | 922 | (use-package diff-hl |
df1c9bc8 | 923 | :defer 0.6 |
41d290a2 AB |
924 | :config |
925 | (setq diff-hl-draw-borders nil) | |
926 | (global-diff-hl-mode) | |
927 | :hook (magit-post-refresh . diff-hl-magit-post-refresh)) | |
928 | ||
b57457b2 | 929 | ;; display Lisp objects at point in the echo area |
47904cb7 | 930 | (use-package eldoc |
41d290a2 AB |
931 | :when (version< "25" emacs-version) |
932 | :config (global-eldoc-mode)) | |
933 | ||
b57457b2 | 934 | ;; highlight matching parens |
47904cb7 | 935 | (use-package paren |
41d290a2 AB |
936 | :demand |
937 | :config (show-paren-mode)) | |
938 | ||
47904cb7 | 939 | (use-package elec-pair |
40eddfea AB |
940 | :demand |
941 | :config (electric-pair-mode)) | |
942 | ||
47904cb7 | 943 | (use-package simple |
60ff805e AB |
944 | :config (column-number-mode) |
945 | :custom | |
946 | ;; Save what I copy into clipboard from other applications into Emacs' | |
947 | ;; kill-ring, which would allow me to still be able to easily access | |
948 | ;; it in case I kill (cut or copy) something else inside Emacs before | |
949 | ;; yanking (pasting) what I'd originally intended to. | |
950 | (save-interprogram-paste-before-kill t)) | |
41d290a2 | 951 | |
b57457b2 | 952 | ;; save minibuffer history |
47904cb7 | 953 | (use-package savehist |
1060413b | 954 | :demand |
dca50cf5 AB |
955 | :config |
956 | (savehist-mode) | |
1060413b | 957 | (add-to-list 'savehist-additional-variables 'kill-ring)) |
41d290a2 | 958 | |
b57457b2 | 959 | ;; automatically save place in files |
47904cb7 | 960 | (use-package saveplace |
41d290a2 | 961 | :when (version< "25" emacs-version) |
1060413b | 962 | :config (save-place-mode)) |
41d290a2 | 963 | |
47904cb7 | 964 | (use-package prog-mode |
41d290a2 AB |
965 | :config (global-prettify-symbols-mode) |
966 | (defun indicate-buffer-boundaries-left () | |
967 | (setq indicate-buffer-boundaries 'left)) | |
968 | (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left)) | |
969 | ||
47904cb7 | 970 | (use-package text-mode |
bc2f85e1 | 971 | :bind (:map text-mode-map ("C-*" . b/insert-asterism)) |
93a86536 AB |
972 | :hook ((text-mode . indicate-buffer-boundaries-left) |
973 | (text-mode . flyspell-mode))) | |
41d290a2 | 974 | |
47904cb7 | 975 | (use-package conf-mode |
300b7363 AB |
976 | :mode "\\.*rc$") |
977 | ||
47904cb7 | 978 | (use-package sh-mode |
300b7363 AB |
979 | :mode "\\.bashrc$") |
980 | ||
41d290a2 | 981 | (use-package company |
ccade202 | 982 | :disabled |
41d290a2 AB |
983 | :bind |
984 | (:map company-active-map | |
985 | ([tab] . company-complete-common-or-cycle) | |
d39234b9 AB |
986 | ([escape] . company-abort) |
987 | ("C-p" . company-select-previous-or-abort) | |
988 | ("C-n" . company-select-next-or-abort)) | |
41d290a2 AB |
989 | :custom |
990 | (company-minimum-prefix-length 1) | |
991 | (company-selection-wrap-around t) | |
992 | (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]") | |
993 | (company-dabbrev-downcase nil) | |
994 | (company-dabbrev-ignore-case nil) | |
6eb104ff AB |
995 | ;; :config |
996 | ;; (global-company-mode t) | |
997 | ) | |
41d290a2 AB |
998 | |
999 | (use-package flycheck | |
1000 | :defer 0.6 | |
1001 | :hook (prog-mode . flycheck-mode) | |
1002 | :bind | |
1003 | (:map flycheck-mode-map | |
1004 | ("M-P" . flycheck-previous-error) | |
1005 | ("M-N" . flycheck-next-error)) | |
1006 | :config | |
1007 | ;; Use the load-path from running Emacs when checking elisp files | |
1008 | (setq flycheck-emacs-lisp-load-path 'inherit) | |
1009 | ||
1010 | ;; Only flycheck when I actually save the buffer | |
54209e74 AB |
1011 | (setq flycheck-check-syntax-automatically '(mode-enabled save)) |
1012 | :custom (flycheck-mode-line-prefix "flyc")) | |
1013 | ||
47904cb7 | 1014 | (use-package flyspell) |
41d290a2 AB |
1015 | |
1016 | ;; http://endlessparentheses.com/ispell-and-apostrophes.html | |
47904cb7 | 1017 | (use-package ispell |
41d290a2 AB |
1018 | :defer 0.6 |
1019 | :config | |
1020 | ;; ’ can be part of a word | |
1021 | (setq ispell-local-dictionary-alist | |
1022 | `((nil "[[:alpha:]]" "[^[:alpha:]]" | |
b1ed9ee8 AB |
1023 | "['\x2019]" nil ("-B") nil utf-8)) |
1024 | ispell-program-name (executable-find "hunspell")) | |
41d290a2 AB |
1025 | ;; don't send ’ to the subprocess |
1026 | (defun endless/replace-apostrophe (args) | |
1027 | (cons (replace-regexp-in-string | |
1028 | "’" "'" (car args)) | |
1029 | (cdr args))) | |
1030 | (advice-add #'ispell-send-string :filter-args | |
1031 | #'endless/replace-apostrophe) | |
1032 | ||
1033 | ;; convert ' back to ’ from the subprocess | |
1034 | (defun endless/replace-quote (args) | |
1035 | (if (not (derived-mode-p 'org-mode)) | |
1036 | args | |
1037 | (cons (replace-regexp-in-string | |
1038 | "'" "’" (car args)) | |
1039 | (cdr args)))) | |
1040 | (advice-add #'ispell-parse-output :filter-args | |
1041 | #'endless/replace-quote)) | |
1042 | ||
47904cb7 | 1043 | (use-package abbrev |
1060413b | 1044 | :hook (text-mode . abbrev-mode)) |
54209e74 | 1045 | |
b57457b2 AB |
1046 | \f |
1047 | ;;; Programming modes | |
1048 | ||
47904cb7 | 1049 | (use-package lisp-mode |
41d290a2 | 1050 | :config |
41d290a2 AB |
1051 | (defun indent-spaces-mode () |
1052 | (setq indent-tabs-mode nil)) | |
1053 | (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) | |
1054 | ||
47904cb7 | 1055 | (use-package reveal |
54209e74 AB |
1056 | :hook (emacs-lisp-mode . reveal-mode)) |
1057 | ||
47904cb7 AB |
1058 | (use-package elisp-mode) |
1059 | ||
1060 | ;; (use-package alloy-mode | |
1061 | ;; :straight (:host github :repo "dwwmmn/alloy-mode") | |
1062 | ;; :mode "\\.\\(als\\|dsh\\)\\'" | |
1063 | ;; :config | |
1064 | ;; (setq alloy-basic-offset 2) | |
1065 | ;; ;; (defun b/alloy-simple-indent (start end) | |
1066 | ;; ;; (interactive "r") | |
1067 | ;; ;; ;; (if (region-active-p) | |
1068 | ;; ;; ;; (indent-rigidly start end alloy-basic-offset) | |
1069 | ;; ;; ;; (if (bolp) | |
1070 | ;; ;; ;; (indent-rigidly (line-beginning-position) | |
1071 | ;; ;; ;; (line-end-position) | |
1072 | ;; ;; ;; alloy-basic-offset))) | |
1073 | ;; ;; (indent-to (+ (current-column) alloy-basic-offset))) | |
1074 | ;; :bind (:map alloy-mode-map | |
1075 | ;; ("RET" . electric-newline-and-maybe-indent) | |
1076 | ;; ;; ("TAB" . b/alloy-simple-indent) | |
1077 | ;; ("TAB" . indent-for-tab-command)) | |
1078 | ;; :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil)))) | |
33273849 AB |
1079 | |
1080 | (eval-when-compile (defvar lean-mode-map)) | |
1081 | (use-package lean-mode | |
33273849 AB |
1082 | :defer 0.4 |
1083 | :bind (:map lean-mode-map | |
1084 | ("S-SPC" . company-complete)) | |
1085 | :config | |
1086 | (require 'lean-input) | |
1087 | (setq default-input-method "Lean" | |
1088 | lean-input-tweak-all '(lean-input-compose | |
1089 | (lean-input-prepend "/") | |
1090 | (lean-input-nonempty)) | |
1091 | lean-input-user-translations '(("/" "/"))) | |
1092 | (lean-input-setup)) | |
1093 | ||
68b2cdaa AB |
1094 | (use-package mhtml-mode) |
1095 | ||
47904cb7 | 1096 | (use-package sgml-mode |
41d290a2 | 1097 | :config |
5dfaee4c | 1098 | (setq sgml-basic-offset 0)) |
41d290a2 | 1099 | |
47904cb7 | 1100 | (use-package css-mode |
41d290a2 AB |
1101 | :config |
1102 | (setq css-indent-offset 2)) | |
1103 | ||
41d290a2 | 1104 | (use-package emmet-mode |
68b2cdaa | 1105 | :after (:any mhtml-mode css-mode sgml-mode) |
41d290a2 AB |
1106 | :bind* (("C-)" . emmet-next-edit-point) |
1107 | ("C-(" . emmet-prev-edit-point)) | |
1108 | :config | |
1109 | (unbind-key "C-j" emmet-mode-keymap) | |
1110 | (setq emmet-move-cursor-between-quotes t) | |
92ad9675 | 1111 | :hook (css-mode html-mode sgml-mode)) |
41d290a2 | 1112 | |
1060413b | 1113 | (use-package geiser) |
41d290a2 | 1114 | |
47904cb7 | 1115 | (use-package geiser-guile |
41d290a2 AB |
1116 | :config |
1117 | (setq geiser-guile-load-path "~/src/git/guix")) | |
1118 | ||
1119 | (use-package guix) | |
1120 | ||
b57457b2 AB |
1121 | (comment |
1122 | (use-package auctex | |
1123 | :custom | |
1124 | (font-latex-fontify-sectioning 'color))) | |
1125 | ||
47904cb7 AB |
1126 | (use-package go-mode |
1127 | :disabled) | |
99473567 | 1128 | |
f704f564 AB |
1129 | (use-package po-mode |
1130 | :hook | |
1131 | (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit)))) | |
1132 | ||
47904cb7 | 1133 | (use-package tex-mode |
748bd8ac AB |
1134 | :config |
1135 | (cl-delete-if | |
1136 | (lambda (p) (string-match "^---?" (car p))) | |
0758ec38 AB |
1137 | tex--prettify-symbols-alist) |
1138 | :hook ((tex-mode . auto-fill-mode) | |
3457307b | 1139 | (tex-mode . flyspell-mode))) |
748bd8ac | 1140 | |
47904cb7 AB |
1141 | ;; (use-package george-mode |
1142 | ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode") | |
1143 | ;; :mode "\\.grg\\'") | |
1d01c927 | 1144 | |
b57457b2 AB |
1145 | \f |
1146 | ;;; Theme | |
1147 | ||
dca50cf5 AB |
1148 | (add-to-list 'custom-theme-load-path |
1149 | (expand-file-name | |
1150 | (convert-standard-filename "lisp") user-emacs-directory)) | |
b57457b2 AB |
1151 | (load-theme 'tangomod t) |
1152 | ||
1153 | (use-package smart-mode-line | |
1154 | :commands (sml/apply-theme) | |
1155 | :demand | |
1156 | :config | |
8f2b3cb6 AB |
1157 | ;; thanks, but no thnaks; don't make fixed-width fills. |
1158 | (defun sml/fill-for-buffer-identification () "") | |
0f4b61b6 | 1159 | (setq sml/theme 'tangomod) |
26906e22 AB |
1160 | (sml/setup) |
1161 | (smart-mode-line-enable)) | |
b57457b2 | 1162 | |
cce35aca AB |
1163 | (use-package doom-modeline |
1164 | :disabled | |
1165 | :demand | |
1166 | :hook (after-init . doom-modeline-init) | |
1167 | :custom | |
1168 | (doom-modeline-buffer-file-name-style 'relative-to-project)) | |
1169 | ||
96611976 | 1170 | (use-package doom-themes) |
eb42934e | 1171 | |
96611976 | 1172 | (use-package moody |
d4afaf1b | 1173 | :disabled |
eb42934e AB |
1174 | :demand |
1175 | :config | |
96611976 | 1176 | (setq x-underline-at-descent-line t) |
eb42934e AB |
1177 | (let ((line (face-attribute 'mode-line :underline))) |
1178 | (set-face-attribute 'mode-line nil :overline line) | |
1179 | (set-face-attribute 'mode-line-inactive nil :overline line) | |
1180 | (set-face-attribute 'mode-line-inactive nil :underline line) | |
1181 | (set-face-attribute 'mode-line nil :box nil) | |
1182 | (set-face-attribute 'mode-line-inactive nil :box nil) | |
958286c5 | 1183 | (set-face-attribute 'mode-line-inactive nil :background "#e1e1e1")) ; d3d7cf |
eb42934e AB |
1184 | (moody-replace-mode-line-buffer-identification) |
1185 | (moody-replace-vc-mode)) | |
b57457b2 | 1186 | |
0b085e06 AB |
1187 | (use-package mini-modeline |
1188 | :disabled | |
1189 | :demand | |
1190 | :config (mini-modeline-mode)) | |
1191 | ||
dca50cf5 | 1192 | (defvar b/org-mode-font-lock-keywords |
b57457b2 AB |
1193 | '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)" |
1194 | (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive | |
1195 | (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind | |
96611976 AB |
1196 | (4 '(:foreground "#c5c8c6") t))) ; title |
1197 | "For use with the `doom-tomorrow-night' theme.") | |
b57457b2 | 1198 | |
dca50cf5 | 1199 | (defun b/lights-on () |
b57457b2 AB |
1200 | "Enable my favourite light theme." |
1201 | (interactive) | |
1202 | (mapc #'disable-theme custom-enabled-themes) | |
96611976 | 1203 | (load-theme 'tangomod t) |
22fff83b AB |
1204 | (when (featurep 'smart-mode-line) |
1205 | (sml/apply-theme 'tangomod)) | |
96611976 | 1206 | (font-lock-remove-keywords |
e6c67861 | 1207 | 'org-mode b/org-mode-font-lock-keywords) |
d7e02391 AB |
1208 | (when (featurep 'erc-hl-nicks) |
1209 | (erc-hl-nicks-reset-face-table)) | |
e6c67861 AB |
1210 | (when (featurep 'exwm-systemtray) |
1211 | (exwm-systemtray--refresh))) | |
b57457b2 | 1212 | |
dca50cf5 | 1213 | (defun b/lights-off () |
b57457b2 AB |
1214 | "Go dark." |
1215 | (interactive) | |
1216 | (mapc #'disable-theme custom-enabled-themes) | |
96611976 | 1217 | (load-theme 'doom-one t) |
22fff83b AB |
1218 | (when (featurep 'smart-mode-line) |
1219 | (sml/apply-theme 'automatic)) | |
96611976 | 1220 | (font-lock-add-keywords |
e6c67861 | 1221 | 'org-mode b/org-mode-font-lock-keywords t) |
d7e02391 AB |
1222 | (when (featurep 'erc-hl-nicks) |
1223 | (erc-hl-nicks-reset-face-table)) | |
e6c67861 AB |
1224 | (when (featurep 'exwm-systemtray) |
1225 | (exwm-systemtray--refresh))) | |
b57457b2 AB |
1226 | |
1227 | (bind-keys | |
2e81c51a AB |
1228 | ("C-c t d" . b/lights-off) |
1229 | ("C-c t l" . b/lights-on)) | |
b57457b2 AB |
1230 | |
1231 | \f | |
1232 | ;;; Emacs enhancements & auxiliary packages | |
1233 | ||
dca50cf5 | 1234 | (use-package man |
41d290a2 AB |
1235 | :config (setq Man-width 80)) |
1236 | ||
1237 | (use-package which-key | |
1238 | :defer 0.4 | |
1239 | :config | |
1240 | (which-key-add-key-based-replacements | |
1241 | ;; prefixes for global prefixes and minor modes | |
1242 | "C-c @" "outline" | |
1243 | "C-c !" "flycheck" | |
b549b760 | 1244 | "C-x RET" "coding system" |
41d290a2 | 1245 | "C-x 8" "unicode" |
b549b760 | 1246 | "C-x @" "event modifiers" |
41d290a2 AB |
1247 | "C-x a" "abbrev/expand" |
1248 | "C-x r" "rectangle/register/bookmark" | |
b549b760 | 1249 | "C-x t" "tabs" |
41d290a2 | 1250 | "C-x v" "version control" |
b549b760 AB |
1251 | "C-x X" "edebug" |
1252 | "C-x C-a" "edebug" | |
1253 | "C-x C-k" "kmacro" | |
41d290a2 | 1254 | ;; prefixes for my personal bindings |
b549b760 | 1255 | "C-c &" "yasnippet" |
41d290a2 AB |
1256 | "C-c a" "applications" |
1257 | "C-c a e" "erc" | |
1258 | "C-c a o" "org" | |
1259 | "C-c a s" "shells" | |
2e81c51a | 1260 | "C-c b" "buffers" |
41d290a2 AB |
1261 | "C-c c" "compile-and-comments" |
1262 | "C-c e" "eval" | |
1263 | "C-c f" "files" | |
1264 | "C-c F" "frames" | |
ef6c487c | 1265 | "C-c g" "magit" |
41d290a2 AB |
1266 | "C-S-h" "help(ful)" |
1267 | "C-c m" "multiple-cursors" | |
47904cb7 AB |
1268 | "C-c p" "projectile" |
1269 | "C-c p s" "projectile/search" | |
1270 | "C-c p x" "projectile/execute" | |
1271 | "C-c p 4" "projectile/other-window" | |
41d290a2 | 1272 | "C-c q" "boxquote" |
2e81c51a AB |
1273 | "C-c t" "themes" |
1274 | ;; "s-O" "outline" | |
ef6c487c | 1275 | ) |
41d290a2 AB |
1276 | |
1277 | ;; prefixes for major modes | |
1278 | (which-key-add-major-mode-key-based-replacements 'message-mode | |
7cc51891 | 1279 | "C-c f n" "footnote") |
41d290a2 AB |
1280 | (which-key-add-major-mode-key-based-replacements 'org-mode |
1281 | "C-c C-v" "org-babel") | |
41d290a2 AB |
1282 | |
1283 | (which-key-mode) | |
1284 | :custom | |
1285 | (which-key-add-column-padding 5) | |
1286 | (which-key-max-description-length 32)) | |
1287 | ||
b57457b2 | 1288 | (use-package crux ; results in Waiting for git... [2 times] |
41d290a2 | 1289 | :defer 0.4 |
2a816b71 | 1290 | :bind (("C-c d" . crux-duplicate-current-line-or-region) |
ba45b932 | 1291 | ("C-c M-d" . crux-duplicate-and-comment-current-line-or-region) |
205870c7 AB |
1292 | ("C-c f C" . crux-copy-file-preserve-attributes) |
1293 | ("C-c f D" . crux-delete-file-and-buffer) | |
1294 | ("C-c f R" . crux-rename-file-and-buffer) | |
41d290a2 AB |
1295 | ("C-c j" . crux-top-join-line) |
1296 | ("C-S-j" . crux-top-join-line))) | |
1297 | ||
5b10d879 AB |
1298 | (use-package mwim |
1299 | :bind (("C-a" . mwim-beginning-of-code-or-line) | |
1300 | ("C-e" . mwim-end-of-code-or-line) | |
1301 | ("<home>" . mwim-beginning-of-line-or-code) | |
1302 | ("<end>" . mwim-end-of-line-or-code))) | |
41d290a2 AB |
1303 | |
1304 | (use-package projectile | |
ccade202 | 1305 | :disabled |
26906e22 | 1306 | :defer 0.5 |
47904cb7 | 1307 | :bind-keymap ("C-c p" . projectile-command-map) |
41d290a2 AB |
1308 | :config |
1309 | (projectile-mode) | |
1310 | ||
dca50cf5 | 1311 | (defun b/projectile-mode-line-fun () |
26906e22 AB |
1312 | "Report project name and type in the modeline." |
1313 | (let ((project-name (projectile-project-name)) | |
1314 | (project-type (projectile-project-type))) | |
1315 | (format "%s%s" | |
1316 | projectile-mode-line-prefix | |
1317 | (if project-type | |
1318 | (format ":%s" project-type) | |
1319 | "")))) | |
dca50cf5 | 1320 | (setq projectile-mode-line-function 'b/projectile-mode-line-fun) |
26906e22 | 1321 | |
41d290a2 AB |
1322 | (defun my-projectile-invalidate-cache (&rest _args) |
1323 | ;; ignore the args to `magit-checkout' | |
1324 | (projectile-invalidate-cache nil)) | |
1325 | ||
1326 | (eval-after-load 'magit-branch | |
1327 | '(progn | |
1328 | (advice-add 'magit-checkout | |
1329 | :after #'my-projectile-invalidate-cache) | |
1330 | (advice-add 'magit-branch-and-checkout | |
1331 | :after #'my-projectile-invalidate-cache))) | |
54209e74 | 1332 | :custom |
295b1b10 | 1333 | (projectile-completion-system 'ivy) |
54209e74 | 1334 | (projectile-mode-line-prefix " proj")) |
41d290a2 AB |
1335 | |
1336 | (use-package helpful | |
1337 | :defer 0.6 | |
1338 | :bind | |
1339 | (("C-S-h c" . helpful-command) | |
1340 | ("C-S-h f" . helpful-callable) ; helpful-function | |
1341 | ("C-S-h v" . helpful-variable) | |
1342 | ("C-S-h k" . helpful-key) | |
1343 | ("C-S-h p" . helpful-at-point))) | |
1344 | ||
5b10d879 AB |
1345 | (use-package unkillable-scratch |
1346 | :defer 0.6 | |
1347 | :config | |
1348 | (unkillable-scratch 1) | |
1349 | :custom | |
1350 | (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))) | |
41d290a2 | 1351 | |
5b10d879 AB |
1352 | ;; ,---- |
1353 | ;; | make pretty boxed quotes like this | |
1354 | ;; `---- | |
1355 | (use-package boxquote | |
1356 | :defer 0.6 | |
1357 | :bind | |
1358 | (:prefix-map b/boxquote-prefix-map | |
1359 | :prefix "C-c q" | |
1360 | ("b" . boxquote-buffer) | |
1361 | ("B" . boxquote-insert-buffer) | |
1362 | ("d" . boxquote-defun) | |
1363 | ("F" . boxquote-insert-file) | |
1364 | ("hf" . boxquote-describe-function) | |
1365 | ("hk" . boxquote-describe-key) | |
1366 | ("hv" . boxquote-describe-variable) | |
1367 | ("hw" . boxquote-where-is) | |
1368 | ("k" . boxquote-kill) | |
1369 | ("p" . boxquote-paragraph) | |
1370 | ("q" . boxquote-boxquote) | |
1371 | ("r" . boxquote-region) | |
1372 | ("s" . boxquote-shell-command) | |
1373 | ("t" . boxquote-text) | |
1374 | ("T" . boxquote-title) | |
1375 | ("u" . boxquote-unbox) | |
1376 | ("U" . boxquote-unbox-region) | |
1377 | ("y" . boxquote-yank) | |
1378 | ("M-q" . boxquote-fill-paragraph) | |
1379 | ("M-w" . boxquote-kill-ring-save))) | |
41d290a2 AB |
1380 | |
1381 | (use-package orgalist | |
3619fcff AB |
1382 | ;; breaks auto-fill-mode, showing this error: |
1383 | ;; orgalist--boundaries: Lisp nesting exceeds ‘max-lisp-eval-depth’ | |
1384 | :disabled | |
41d290a2 AB |
1385 | :after message |
1386 | :hook (message-mode . orgalist-mode)) | |
1387 | ||
b57457b2 | 1388 | ;; highlight TODOs in buffers |
41d290a2 AB |
1389 | (use-package hl-todo |
1390 | :defer 0.5 | |
1391 | :config | |
1392 | (global-hl-todo-mode)) | |
1393 | ||
41d290a2 | 1394 | (use-package multi-term |
cce35aca | 1395 | :disabled |
41d290a2 | 1396 | :defer 0.6 |
fb078e63 AB |
1397 | :bind (("C-c a s m m" . multi-term) |
1398 | ("C-c a s m d" . multi-term-dedicated-toggle) | |
1399 | ("C-c a s m p" . multi-term-prev) | |
1400 | ("C-c a s m n" . multi-term-next) | |
41d290a2 | 1401 | :map term-mode-map |
0af1e91a | 1402 | ("C-c C-j" . term-char-mode)) |
41d290a2 | 1403 | :config |
96c704d7 AB |
1404 | (setq multi-term-program "screen" |
1405 | multi-term-program-switches (concat "-c" | |
1406 | (getenv "XDG_CONFIG_HOME") | |
1407 | "/screen/screenrc") | |
41d290a2 AB |
1408 | ;; TODO: add separate bindings for connecting to existing |
1409 | ;; session vs. always creating a new one | |
1410 | multi-term-dedicated-select-after-open-p t | |
1411 | multi-term-dedicated-window-height 20 | |
1412 | multi-term-dedicated-max-window-height 30 | |
1413 | term-bind-key-alist | |
1414 | '(("C-c C-c" . term-interrupt-subjob) | |
1415 | ("C-c C-e" . term-send-esc) | |
0af1e91a | 1416 | ("C-c C-j" . term-line-mode) |
41d290a2 | 1417 | ("C-k" . kill-line) |
fb078e63 AB |
1418 | ;; ("C-y" . term-paste) |
1419 | ("C-y" . term-send-raw) | |
41d290a2 AB |
1420 | ("M-f" . term-send-forward-word) |
1421 | ("M-b" . term-send-backward-word) | |
1422 | ("M-p" . term-send-up) | |
1423 | ("M-n" . term-send-down) | |
fb078e63 AB |
1424 | ("M-j" . term-send-raw-meta) |
1425 | ("M-y" . term-send-raw-meta) | |
1426 | ("M-/" . term-send-raw-meta) | |
1427 | ("M-0" . term-send-raw-meta) | |
1428 | ("M-1" . term-send-raw-meta) | |
1429 | ("M-2" . term-send-raw-meta) | |
1430 | ("M-3" . term-send-raw-meta) | |
1431 | ("M-4" . term-send-raw-meta) | |
1432 | ("M-5" . term-send-raw-meta) | |
1433 | ("M-6" . term-send-raw-meta) | |
1434 | ("M-7" . term-send-raw-meta) | |
1435 | ("M-8" . term-send-raw-meta) | |
1436 | ("M-9" . term-send-raw-meta) | |
41d290a2 AB |
1437 | ("<C-backspace>" . term-send-backward-kill-word) |
1438 | ("<M-DEL>" . term-send-backward-kill-word) | |
1439 | ("M-d" . term-send-delete-word) | |
1440 | ("M-," . term-send-raw) | |
1441 | ("M-." . comint-dynamic-complete)) | |
1442 | term-unbind-key-alist | |
fb078e63 AB |
1443 | '("C-z" "C-x" "C-c" "C-h" |
1444 | ;; "C-y" | |
1445 | "<ESC>"))) | |
41d290a2 AB |
1446 | |
1447 | (use-package page-break-lines | |
b57457b2 | 1448 | :defer 0.5 |
2f5d8190 AB |
1449 | :custom |
1450 | (page-break-lines-max-width fill-column) | |
41d290a2 AB |
1451 | :config |
1452 | (global-page-break-lines-mode)) | |
1453 | ||
1454 | (use-package expand-region | |
1455 | :bind ("C-=" . er/expand-region)) | |
1456 | ||
1457 | (use-package multiple-cursors | |
1458 | :bind | |
1459 | (("C-S-<mouse-1>" . mc/add-cursor-on-click) | |
dca50cf5 | 1460 | (:prefix-map b/mc-prefix-map |
41d290a2 AB |
1461 | :prefix "C-c m" |
1462 | ("c" . mc/edit-lines) | |
1463 | ("n" . mc/mark-next-like-this) | |
1464 | ("p" . mc/mark-previous-like-this) | |
1060413b | 1465 | ("a" . mc/mark-all-like-this)))) |
41d290a2 | 1466 | |
41d290a2 AB |
1467 | (use-package yasnippet |
1468 | :defer 0.6 | |
1469 | :config | |
1470 | (defconst yas-verbosity-cur yas-verbosity) | |
1471 | (setq yas-verbosity 2) | |
476f6228 | 1472 | (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t) |
41d290a2 AB |
1473 | (yas-reload-all) |
1474 | (setq yas-verbosity yas-verbosity-cur) | |
5b185efa AB |
1475 | |
1476 | (defun b/yas--maybe-expand-key-filter (cmd) | |
1477 | (when (and (yas--maybe-expand-key-filter cmd) | |
1478 | (not (bound-and-true-p git-commit-mode))) | |
1479 | cmd)) | |
1480 | (defconst b/yas-maybe-expand | |
1481 | '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter)) | |
1482 | (define-key yas-minor-mode-map | |
1483 | (kbd "SPC") b/yas-maybe-expand) | |
1484 | ||
476f6228 | 1485 | (yas-global-mode)) |
41d290a2 | 1486 | |
33273849 | 1487 | (use-package debbugs |
ba45b932 AB |
1488 | :bind |
1489 | (("C-c D d" . debbugs-gnu) | |
8cee0db4 | 1490 | ("C-c D b" . debbugs-gnu-bugs) |
ba45b932 AB |
1491 | ("C-c D e" . |
1492 | (lambda () | |
d6c37a13 | 1493 | (interactive) ; bug-gnu-emacs |
ba45b932 AB |
1494 | (setq debbugs-gnu-current-suppress t) |
1495 | (debbugs-gnu debbugs-gnu-default-severities '("emacs")))) | |
d6c37a13 | 1496 | ("C-c D g" . ; bug-gnuzilla |
ba45b932 AB |
1497 | (lambda () |
1498 | (interactive) | |
1499 | (setq debbugs-gnu-current-suppress t) | |
64b53575 | 1500 | (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla")))) |
d6c37a13 AB |
1501 | ("C-c D G b" . ; bug-guix |
1502 | (lambda () | |
1503 | (interactive) | |
1504 | (setq debbugs-gnu-current-suppress t) | |
1505 | (debbugs-gnu debbugs-gnu-default-severities '("guix")))) | |
1506 | ("C-c D G p" . ; guix-patches | |
64b53575 AB |
1507 | (lambda () |
1508 | (interactive) | |
1509 | (setq debbugs-gnu-current-suppress t) | |
d6c37a13 | 1510 | (debbugs-gnu debbugs-gnu-default-severities '("guix-patches")))))) |
41d290a2 AB |
1511 | |
1512 | (use-package org-ref | |
1513 | :init | |
dca50cf5 | 1514 | (b/setq-every '("~/usr/org/references.bib") |
41d290a2 AB |
1515 | reftex-default-bibliography |
1516 | org-ref-default-bibliography) | |
1517 | (setq | |
1518 | org-ref-bibliography-notes "~/usr/org/notes.org" | |
1519 | org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")) | |
1520 | ||
2f5d8190 AB |
1521 | ;; (use-package fill-column-indicator) |
1522 | ||
47904cb7 | 1523 | (use-package window |
ed8c4fa9 | 1524 | :bind |
edb03389 AB |
1525 | (("C-c w e" . (lambda () |
1526 | (interactive) | |
1527 | (split-window-right) | |
1528 | (other-window 1) | |
1529 | (erc-switch-to-buffer))) | |
1530 | ("C-c w s l" . (lambda () | |
1531 | (interactive) | |
1532 | (split-window-right) | |
1533 | (other-window 1))) | |
1534 | ("C-c w s j" . (lambda () | |
1535 | (interactive) | |
1536 | (split-window-below) | |
1537 | (other-window 1))) | |
446cb096 | 1538 | ("C-c w q" . quit-window)) |
92df6c4f AB |
1539 | :custom |
1540 | (split-width-threshold 150)) | |
ed8c4fa9 | 1541 | |
47904cb7 | 1542 | (use-package windmove |
ed8c4fa9 AB |
1543 | :defer 0.6 |
1544 | :bind | |
2e81c51a AB |
1545 | (("C-c w h" . windmove-left) |
1546 | ("C-c w j" . windmove-down) | |
1547 | ("C-c w k" . windmove-up) | |
1548 | ("C-c w l" . windmove-right) | |
1549 | ("C-c w H" . windmove-swap-states-left) | |
1550 | ("C-c w J" . windmove-swap-states-down) | |
1551 | ("C-c w K" . windmove-swap-states-up) | |
1552 | ("C-c w L" . windmove-swap-states-right))) | |
ed8c4fa9 | 1553 | |
05068e71 AB |
1554 | (use-package pass |
1555 | :commands pass | |
1556 | :bind ("C-c a p" . pass) | |
1557 | :hook (pass-mode . View-exit)) | |
1558 | ||
b188e798 AB |
1559 | (use-package pdf-tools |
1560 | :defer 0.5 | |
1561 | :bind (:map pdf-view-mode-map | |
0365678c AB |
1562 | ("<C-XF86Back>" . pdf-history-backward) |
1563 | ("<mouse-8>" . pdf-history-backward) | |
1564 | ("<drag-mouse-8>" . pdf-history-backward) | |
1565 | ("<C-XF86Forward>" . pdf-history-forward) | |
1566 | ("<mouse-9>" . pdf-history-forward) | |
1567 | ("<drag-mouse-9>" . pdf-history-forward) | |
4fa43cd8 AB |
1568 | ("M-RET" . image-previous-line) |
1569 | ("C-s" . isearch-forward) | |
1570 | ("s s" . isearch-forward)) | |
822ac360 AB |
1571 | :config (pdf-tools-install nil t) |
1572 | :custom (pdf-view-resize-factor 1.05)) | |
b188e798 | 1573 | |
62a2088e | 1574 | (use-package org-pdftools |
47904cb7 | 1575 | :disabled |
62a2088e AB |
1576 | :straight (:host github :repo "fuxialexander/org-pdftools") |
1577 | :demand | |
1578 | :after org | |
1579 | :config | |
1580 | (with-eval-after-load 'org | |
1581 | (require 'org-pdftools))) | |
1582 | ||
9de75957 AB |
1583 | (use-package biblio) |
1584 | ||
47904cb7 | 1585 | (use-package reftex |
9a5ffb33 AB |
1586 | :hook (latex-mode . reftex-mode)) |
1587 | ||
47904cb7 | 1588 | (use-package reftex-cite |
9a5ffb33 AB |
1589 | :after reftex |
1590 | :disabled ; enable to disable | |
1591 | ; reftex-cite's default choice | |
1592 | ; of previous word | |
1593 | :config | |
1594 | (defun reftex-get-bibkey-default () | |
1595 | "If the cursor is in a citation macro, return the word before the macro." | |
1596 | (let* ((macro (reftex-what-macro 1))) | |
1597 | (save-excursion | |
1598 | (when (and macro (string-match "cite" (car macro))) | |
1599 | (goto-char (cdr macro))) | |
1600 | (reftex-this-word))))) | |
1601 | ||
d141ce11 AB |
1602 | (use-package minions |
1603 | :demand | |
1604 | :config (minions-mode)) | |
1605 | ||
fa9943dc | 1606 | (use-package dmenu |
fa9943dc | 1607 | :custom |
fa9943dc AB |
1608 | (dmenu-prompt-string "run: ") |
1609 | (dmenu-save-file (b/var "dmenu-items"))) | |
1610 | ||
996bebf6 AB |
1611 | (use-package eosd |
1612 | ;; TODO: fix build by properly building the eosd-pixbuf.c module | |
1613 | ;; e.g. see https://github.com/raxod502/straight.el/issues/386 | |
1614 | :disabled | |
1615 | :straight (:host github :repo "clarete/eosd") | |
1616 | :demand | |
1617 | :after exwm | |
1618 | :config | |
1619 | (eosd-start)) | |
1620 | ||
3280b75e AB |
1621 | (use-package scpaste |
1622 | :disabled | |
1623 | :config | |
1624 | (setq scpaste-http-destination "https://p.bndl.org" | |
1625 | scpaste-scp-destination "nix:/var/www/p.bndl.org")) | |
1626 | ||
9ed5410e | 1627 | (use-package eww |
03745e6e | 1628 | :bind ("C-c a e w" . eww) |
9ed5410e AB |
1629 | :custom |
1630 | (eww-download-directory (file-name-as-directory | |
1631 | (getenv "XDG_DOWNLOAD_DIR")))) | |
1632 | ||
b57457b2 AB |
1633 | \f |
1634 | ;;; Email (with Gnus) | |
1635 | ||
dca50cf5 | 1636 | (defvar b/maildir (expand-file-name "~/mail/")) |
41d290a2 | 1637 | (with-eval-after-load 'recentf |
dca50cf5 | 1638 | (add-to-list 'recentf-exclude b/maildir)) |
41d290a2 AB |
1639 | |
1640 | (setq | |
dca50cf5 | 1641 | b/gnus-init-file (b/etc "gnus") |
41d290a2 AB |
1642 | mail-user-agent 'gnus-user-agent |
1643 | read-mail-command 'gnus) | |
1644 | ||
47904cb7 | 1645 | (use-package gnus |
b1ed18e4 | 1646 | :bind (("s-m" . gnus-plugged) |
2e81c51a | 1647 | ("s-M" . gnus-unplugged) |
b1ed18e4 | 1648 | ("C-c a m" . gnus-plugged) |
2e81c51a | 1649 | ("C-c a M" . gnus-unplugged)) |
41d290a2 AB |
1650 | :init |
1651 | (setq | |
1652 | gnus-select-method '(nnnil "") | |
1653 | gnus-secondary-select-methods | |
d4cc5497 | 1654 | '((nnimap "shemshak" |
14bd6398 AB |
1655 | (nnimap-stream plain) |
1656 | (nnimap-address "127.0.0.1") | |
1657 | (nnimap-server-port 143) | |
1658 | (nnimap-authenticator plain) | |
1659 | (nnimap-user "amin@shemshak.local")) | |
2e9074a4 | 1660 | (nnimap "gnu" |
14bd6398 AB |
1661 | (nnimap-stream plain) |
1662 | (nnimap-address "127.0.0.1") | |
1663 | (nnimap-server-port 143) | |
1664 | (nnimap-authenticator plain) | |
0a929da7 | 1665 | (nnimap-user "bandali@gnu.local") |
14bd6398 AB |
1666 | (nnimap-inbox "INBOX") |
1667 | (nnimap-split-methods 'nnimap-split-fancy) | |
1668 | (nnimap-split-fancy (| | |
1669 | ;; (: gnus-registry-split-fancy-with-parent) | |
1670 | ;; (: gnus-group-split-fancy "INBOX" t "INBOX") | |
1671 | ;; gnu | |
1672 | (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1") | |
46d707ed AB |
1673 | ;; gnus |
1674 | (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1") | |
4319a2ff AB |
1675 | ;; libreplanet |
1676 | (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1") | |
14bd6398 AB |
1677 | ;; *.lists.sr.ht, omitting one dot if present |
1678 | ;; add more \\.?\\([^.]*\\) if needed | |
1679 | (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3") | |
1680 | ;; webmasters | |
1681 | (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters") | |
1682 | ;; other | |
1683 | (list ".*atreus.freelists.org" "l.atreus") | |
1684 | (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec") | |
1685 | ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d | |
1686 | (list ".*haskell-cafe.haskell.org" "l.haskell-cafe") | |
1687 | ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u | |
1688 | ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u | |
1689 | ;; ---------------------------------- | |
1690 | ;; legend: (u)nsubscribed | (d)ead | |
1691 | ;; ---------------------------------- | |
1692 | ;; otherwise, leave mail in INBOX | |
1693 | "INBOX"))) | |
727d14d3 | 1694 | (nnimap "uw" |
41d290a2 AB |
1695 | (nnimap-stream plain) |
1696 | (nnimap-address "127.0.0.1") | |
1697 | (nnimap-server-port 143) | |
1698 | (nnimap-authenticator plain) | |
f0d99991 AB |
1699 | (nnimap-user "abandali@uw.local") |
1700 | (nnimap-inbox "INBOX") | |
1701 | (nnimap-split-methods 'nnimap-split-fancy) | |
1702 | (nnimap-split-fancy (| | |
29e42dc1 | 1703 | ;; (: gnus-registry-split-fancy-with-parent) |
5b8a18a4 | 1704 | ;; se212-f19 |
90dc3a58 AB |
1705 | ("subject" "SE\\s-?212" "course.se212-f19") |
1706 | (from "SE\\s-?212" "course.se212-f19") | |
f0d99991 AB |
1707 | ;; catch-all |
1708 | "INBOX"))) | |
727d14d3 | 1709 | (nnimap "csc" |
41d290a2 AB |
1710 | (nnimap-stream plain) |
1711 | (nnimap-address "127.0.0.1") | |
1712 | (nnimap-server-port 143) | |
1713 | (nnimap-authenticator plain) | |
727d14d3 | 1714 | (nnimap-user "abandali@csc.uw.local"))) |
95ec8c25 | 1715 | gnus-message-archive-group "nnimap+gnu:INBOX" |
41d290a2 | 1716 | gnus-parameters |
859ba2a0 AB |
1717 | '(("l\\.atreus" |
1718 | (to-address . "atreus@freelists.org") | |
1719 | (to-list . "atreus@freelists.org")) | |
1720 | ("l\\.deepspec" | |
41d290a2 | 1721 | (to-address . "deepspec@lists.cs.princeton.edu") |
778202b8 AB |
1722 | (to-list . "deepspec@lists.cs.princeton.edu") |
1723 | (list-identifier . "\\[deepspec\\]")) | |
cb4015f6 | 1724 | ("l\\.emacs-devel" |
74fd778e AB |
1725 | (to-address . "emacs-devel@gnu.org") |
1726 | (to-list . "emacs-devel@gnu.org")) | |
cb4015f6 | 1727 | ("l\\.help-gnu-emacs" |
74fd778e AB |
1728 | (to-address . "help-gnu-emacs@gnu.org") |
1729 | (to-list . "help-gnu-emacs@gnu.org")) | |
cb4015f6 | 1730 | ("l\\.info-gnu-emacs" |
74fd778e AB |
1731 | (to-address . "info-gnu-emacs@gnu.org") |
1732 | (to-list . "info-gnu-emacs@gnu.org")) | |
cb4015f6 | 1733 | ("l\\.emacs-orgmode" |
41d290a2 | 1734 | (to-address . "emacs-orgmode@gnu.org") |
778202b8 AB |
1735 | (to-list . "emacs-orgmode@gnu.org") |
1736 | (list-identifier . "\\[O\\]")) | |
cb4015f6 | 1737 | ("l\\.emacs-tangents" |
40b9eac1 AB |
1738 | (to-address . "emacs-tangents@gnu.org") |
1739 | (to-list . "emacs-tangents@gnu.org")) | |
69e4b016 AB |
1740 | ("l\\.emacsconf-committee" |
1741 | (to-address . "emacsconf-committee@gnu.org") | |
1742 | (to-list . "emacsconf-committee@gnu.org")) | |
cb4015f6 | 1743 | ("l\\.emacsconf-discuss" |
41d290a2 AB |
1744 | (to-address . "emacsconf-discuss@gnu.org") |
1745 | (to-list . "emacsconf-discuss@gnu.org")) | |
cb4015f6 | 1746 | ("l\\.emacsconf-register" |
690a977d AB |
1747 | (to-address . "emacsconf-register@gnu.org") |
1748 | (to-list . "emacsconf-register@gnu.org")) | |
cb4015f6 | 1749 | ("l\\.emacsconf-submit" |
690a977d AB |
1750 | (to-address . "emacsconf-submit@gnu.org") |
1751 | (to-list . "emacsconf-submit@gnu.org")) | |
cb4015f6 | 1752 | ("l\\.fencepost-users" |
41d290a2 | 1753 | (to-address . "fencepost-users@gnu.org") |
778202b8 AB |
1754 | (to-list . "fencepost-users@gnu.org") |
1755 | (list-identifier . "\\[Fencepost-users\\]")) | |
e7a169d1 AB |
1756 | ("l\\.gnewsense-art" |
1757 | (to-address . "gnewsense-art@nongnu.org") | |
1758 | (to-list . "gnewsense-art@nongnu.org") | |
1759 | (list-identifier . "\\[gNewSense-art\\]")) | |
1760 | ("l\\.gnewsense-dev" | |
1761 | (to-address . "gnewsense-dev@nongnu.org") | |
1762 | (to-list . "gnewsense-dev@nongnu.org") | |
1763 | (list-identifier . "\\[Gnewsense-dev\\]")) | |
7f3d862f | 1764 | ("l\\.gnewsense-users" |
e7a169d1 AB |
1765 | (to-address . "gnewsense-users@nongnu.org") |
1766 | (to-list . "gnewsense-users@nongnu.org") | |
1767 | (list-identifier . "\\[gNewSense-users\\]")) | |
cb4015f6 | 1768 | ("l\\.gnunet-developers" |
41d290a2 | 1769 | (to-address . "gnunet-developers@gnu.org") |
778202b8 AB |
1770 | (to-list . "gnunet-developers@gnu.org") |
1771 | (list-identifier . "\\[GNUnet-developers\\]")) | |
cb4015f6 | 1772 | ("l\\.help-gnunet" |
74fd778e AB |
1773 | (to-address . "help-gnunet@gnu.org") |
1774 | (to-list . "help-gnunet@gnu.org") | |
1775 | (list-identifier . "\\[Help-gnunet\\]")) | |
cb4015f6 | 1776 | ("l\\.bug-gnuzilla" |
74fd778e AB |
1777 | (to-address . "bug-gnuzilla@gnu.org") |
1778 | (to-list . "bug-gnuzilla@gnu.org") | |
1779 | (list-identifier . "\\[Bug-gnuzilla\\]")) | |
cb4015f6 | 1780 | ("l\\.gnuzilla-dev" |
74fd778e AB |
1781 | (to-address . "gnuzilla-dev@gnu.org") |
1782 | (to-list . "gnuzilla-dev@gnu.org") | |
1783 | (list-identifier . "\\[Gnuzilla-dev\\]")) | |
cb4015f6 | 1784 | ("l\\.guile-devel" |
41d290a2 AB |
1785 | (to-address . "guile-devel@gnu.org") |
1786 | (to-list . "guile-devel@gnu.org")) | |
cb4015f6 | 1787 | ("l\\.guile-user" |
29e42dc1 AB |
1788 | (to-address . "guile-user@gnu.org") |
1789 | (to-list . "guile-user@gnu.org")) | |
cb4015f6 | 1790 | ("l\\.guix-devel" |
41d290a2 AB |
1791 | (to-address . "guix-devel@gnu.org") |
1792 | (to-list . "guix-devel@gnu.org")) | |
cb4015f6 | 1793 | ("l\\.help-guix" |
837a23a5 AB |
1794 | (to-address . "help-guix@gnu.org") |
1795 | (to-list . "help-guix@gnu.org")) | |
cb4015f6 | 1796 | ("l\\.info-guix" |
74fd778e AB |
1797 | (to-address . "info-guix@gnu.org") |
1798 | (to-list . "info-guix@gnu.org")) | |
cb4015f6 | 1799 | ("l\\.savannah-hackers-public" |
6f25cef1 AB |
1800 | (to-address . "savannah-hackers-public@gnu.org") |
1801 | (to-list . "savannah-hackers-public@gnu.org")) | |
cb4015f6 | 1802 | ("l\\.savannah-users" |
6f25cef1 AB |
1803 | (to-address . "savannah-users@gnu.org") |
1804 | (to-list . "savannah-users@gnu.org")) | |
cb4015f6 | 1805 | ("l\\.www-commits" |
74fd778e AB |
1806 | (to-address . "www-commits@gnu.org") |
1807 | (to-list . "www-commits@gnu.org")) | |
cb4015f6 | 1808 | ("l\\.www-discuss" |
74fd778e AB |
1809 | (to-address . "www-discuss@gnu.org") |
1810 | (to-list . "www-discuss@gnu.org")) | |
cb4015f6 | 1811 | ("l\\.haskell-art" |
41d290a2 | 1812 | (to-address . "haskell-art@we.lurk.org") |
778202b8 AB |
1813 | (to-list . "haskell-art@we.lurk.org") |
1814 | (list-identifier . "\\[haskell-art\\]")) | |
cb4015f6 | 1815 | ("l\\.haskell-cafe" |
41d290a2 | 1816 | (to-address . "haskell-cafe@haskell.org") |
778202b8 AB |
1817 | (to-list . "haskell-cafe@haskell.org") |
1818 | (list-identifier . "\\[Haskell-cafe\\]")) | |
74fd778e | 1819 | ("l\\.notmuch" |
41d290a2 AB |
1820 | (to-address . "notmuch@notmuchmail.org") |
1821 | (to-list . "notmuch@notmuchmail.org")) | |
cb4015f6 | 1822 | ("l\\.parabola-dev" |
41d290a2 | 1823 | (to-address . "dev@lists.parabola.nu") |
778202b8 AB |
1824 | (to-list . "dev@lists.parabola.nu") |
1825 | (list-identifier . "\\[Dev\\]")) | |
74fd778e | 1826 | ("l\\.~bandali\\.public-inbox" |
41d290a2 AB |
1827 | (to-address . "~bandali/public-inbox@lists.sr.ht") |
1828 | (to-list . "~bandali/public-inbox@lists.sr.ht")) | |
7c281dfc AB |
1829 | ("l\\.~sircmpwn\\.free-writers-club" |
1830 | (to-address . "~sircmpwn/free-writers-club@lists.sr.ht") | |
1831 | (to-list . "~sircmpwn/free-writers-club@lists.sr.ht")) | |
cb4015f6 | 1832 | ("l\\.~sircmpwn\\.srht-admins" |
41d290a2 AB |
1833 | (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") |
1834 | (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) | |
cb4015f6 | 1835 | ("l\\.~sircmpwn\\.srht-announce" |
41d290a2 AB |
1836 | (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") |
1837 | (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) | |
cb4015f6 | 1838 | ("l\\.~sircmpwn\\.srht-dev" |
41d290a2 AB |
1839 | (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") |
1840 | (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) | |
cb4015f6 | 1841 | ("l\\.~sircmpwn\\.srht-discuss" |
41d290a2 AB |
1842 | (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") |
1843 | (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) | |
74fd778e AB |
1844 | ("webmasters" |
1845 | (to-address . "webmasters@gnu.org") | |
1846 | (to-list . "webmasters@gnu.org")) | |
41d290a2 AB |
1847 | ("gnu.*" |
1848 | (gcc-self . t)) | |
205cc04b | 1849 | ("l\\." |
262483ba AB |
1850 | (subscribed . t)) |
1851 | ("nnimap\\+uw:.*" | |
1852 | (gcc-self . t))) | |
41d290a2 | 1853 | gnus-large-newsgroup 50 |
dca50cf5 | 1854 | gnus-home-directory (b/var "gnus/") |
41d290a2 AB |
1855 | gnus-directory (concat gnus-home-directory "news/") |
1856 | message-directory (concat gnus-home-directory "mail/") | |
1857 | nndraft-directory (concat gnus-home-directory "drafts/") | |
1858 | gnus-save-newsrc-file nil | |
1859 | gnus-read-newsrc-file nil | |
1860 | gnus-interactive-exit nil | |
1861 | gnus-gcc-mark-as-read t) | |
1862 | :config | |
f02d2b28 | 1863 | (when (version< emacs-version "27") |
47904cb7 AB |
1864 | (with-eval-after-load 'nnmail |
1865 | (add-to-list | |
1866 | 'nnmail-split-abbrev-alist | |
1867 | '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop") | |
1868 | t))) | |
f02d2b28 | 1869 | |
29e42dc1 | 1870 | ;; (gnus-registry-initialize) |
7f88c321 | 1871 | |
41d290a2 AB |
1872 | (with-eval-after-load 'recentf |
1873 | (add-to-list 'recentf-exclude gnus-home-directory))) | |
1874 | ||
47904cb7 | 1875 | (use-package gnus-art |
41d290a2 AB |
1876 | :config |
1877 | (setq | |
7e1cad06 | 1878 | gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)") |
e1f6f6a2 AB |
1879 | gnus-sorted-header-list '("^From:" |
1880 | "^X-RT-Originator" | |
1881 | "^Newsgroups:" | |
1882 | "^Subject:" | |
1883 | "^Date:" | |
1884 | "^Envelope-To:" | |
1885 | "^Followup-To:" | |
1886 | "^Reply-To:" | |
1887 | "^Organization:" | |
1888 | "^Summary:" | |
1889 | "^Abstract:" | |
1890 | "^Keywords:" | |
1891 | "^To:" | |
1892 | "^[BGF]?Cc:" | |
1893 | "^Posted-To:" | |
1894 | "^Mail-Copies-To:" | |
1895 | "^Mail-Followup-To:" | |
1896 | "^Apparently-To:" | |
1897 | "^Resent-From:" | |
1898 | "^User-Agent:" | |
1899 | "^X-detected-operating-system:" | |
1900 | "^Message-ID:" | |
c247fbc8 | 1901 | ;; "^References:" |
e1f6f6a2 AB |
1902 | "^List-Id:" |
1903 | "^Gnus-Warning:") | |
1904 | gnus-visible-headers (mapconcat 'identity | |
1905 | gnus-sorted-header-list | |
1906 | "\\|") | |
41d290a2 AB |
1907 | ;; local-lapsed article dates |
1908 | ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11 | |
1909 | gnus-article-date-headers '(user-defined) | |
1910 | gnus-article-time-format | |
1911 | (lambda (time) | |
1912 | (let* ((date (format-time-string "%a, %d %b %Y %T %z" time)) | |
1913 | (local (article-make-date-line date 'local)) | |
1914 | (combined-lapsed (article-make-date-line date | |
1915 | 'combined-lapsed)) | |
1916 | (lapsed (progn | |
1917 | (string-match " (.+" combined-lapsed) | |
1918 | (match-string 0 combined-lapsed)))) | |
1919 | (concat local lapsed)))) | |
1920 | (bind-keys | |
1921 | :map gnus-article-mode-map | |
1922 | ("M-L" . org-store-link))) | |
1923 | ||
47904cb7 | 1924 | (use-package gnus-sum |
41d290a2 | 1925 | :bind (:map gnus-summary-mode-map |
dca50cf5 | 1926 | :prefix-map b/gnus-summary-prefix-map |
41d290a2 AB |
1927 | :prefix "v" |
1928 | ("r" . gnus-summary-reply) | |
1929 | ("w" . gnus-summary-wide-reply) | |
1930 | ("v" . gnus-summary-show-raw-article)) | |
1931 | :config | |
1932 | (bind-keys | |
1933 | :map gnus-summary-mode-map | |
1934 | ("M-L" . org-store-link)) | |
1bd1c701 AB |
1935 | :hook (gnus-summary-mode . b/no-mouse-autoselect-window) |
1936 | :custom | |
1937 | (gnus-thread-sort-functions '(gnus-thread-sort-by-number | |
1938 | gnus-thread-sort-by-subject | |
1939 | gnus-thread-sort-by-date))) | |
41d290a2 | 1940 | |
47904cb7 | 1941 | (use-package gnus-msg |
41d290a2 | 1942 | :config |
639bdc53 AB |
1943 | (defvar b/shemshak-signature "Amin Bandali |
1944 | https://shemshak.org/~amin") | |
dca50cf5 | 1945 | (defvar b/uw-signature "Amin Bandali, MMath Student |
4d19e255 | 1946 | Cheriton School of Computer Science |
e0e5275d | 1947 | University of Waterloo |
5b740018 | 1948 | https://bandali.eu.org") |
dca50cf5 | 1949 | (defvar b/csc-signature "Amin Bandali |
7f8a1011 | 1950 | System Administrator, Systems Committee |
dc12958b AB |
1951 | Computer Science Club, University of Waterloo |
1952 | https://csclub.uwaterloo.ca/~abandali") | |
e9abd82c AB |
1953 | (setq gnus-message-replysign t |
1954 | gnus-posting-styles | |
41d290a2 | 1955 | '((".*" |
33b1a7ea | 1956 | (address "bandali@gnu.org")) |
639bdc53 AB |
1957 | ("nnimap\\+gnu:l\\..*" |
1958 | (signature nil)) | |
466bb3e0 AB |
1959 | ("nnimap\\+gnu:.*" |
1960 | (organization "GNU")) | |
639bdc53 AB |
1961 | ((header "subject" "ThankCRM") |
1962 | (to "webmasters-comment@gnu.org") | |
1963 | (body "") | |
1964 | (eval (setq b/message-cite-say-hi nil))) | |
95ec8c25 | 1965 | ("nnimap\\+shemshak:.*" |
4ed3a945 | 1966 | (address "amin@shemshak.org") |
41d290a2 | 1967 | (body "\nBest,\n") |
639bdc53 | 1968 | (signature b/shemshak-signature) |
95ec8c25 | 1969 | (gcc "nnimap+shemshak:Sent") |
dca50cf5 | 1970 | (eval (setq b/message-cite-say-hi t))) |
63c1969d | 1971 | ("nnimap\\+uw:.*" |
e7125caf | 1972 | (address "bandali@uwaterloo.ca") |
639bdc53 | 1973 | (body "\nBest,\n") |
dca50cf5 | 1974 | (signature b/uw-signature)) |
262483ba | 1975 | ("nnimap\\+uw:INBOX" |
63c1969d AB |
1976 | (gcc "\"nnimap+uw:Sent Items\"")) |
1977 | ("nnimap\\+csc:.*" | |
e93437ba | 1978 | (address "bandali@csclub.uwaterloo.ca") |
dca50cf5 | 1979 | (signature b/csc-signature) |
0567bcba | 1980 | (gcc "nnimap+csc:Sent")))) |
bfda730d AB |
1981 | :hook (gnus-message-setup . (lambda () |
1982 | (unless (mml-secure-is-encrypted-p) | |
1983 | (mml-secure-message-sign))))) | |
41d290a2 | 1984 | |
47904cb7 | 1985 | (use-package gnus-topic |
41d290a2 AB |
1986 | :hook (gnus-group-mode . gnus-topic-mode) |
1987 | :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) | |
1988 | ||
47904cb7 | 1989 | (use-package gnus-agent |
41d290a2 AB |
1990 | :config |
1991 | (setq gnus-agent-synchronize-flags 'ask) | |
1992 | :hook (gnus-group-mode . gnus-agent-mode)) | |
1993 | ||
47904cb7 | 1994 | (use-package gnus-group |
41d290a2 AB |
1995 | :config |
1996 | (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) | |
1997 | ||
082360a8 AB |
1998 | (comment |
1999 | ;; problematic with ebdb's popup, *EBDB-Gnus* | |
47904cb7 | 2000 | (use-package gnus-win |
082360a8 AB |
2001 | :config |
2002 | (setq gnus-use-full-window nil))) | |
f485f78e | 2003 | |
47904cb7 | 2004 | (use-package gnus-dired |
348511ef AB |
2005 | :commands gnus-dired-mode |
2006 | :init | |
2007 | (add-hook 'dired-mode-hook 'gnus-dired-mode)) | |
2008 | ||
6ca3a7b1 | 2009 | (comment |
47904cb7 | 2010 | (use-package gnus-utils |
6ca3a7b1 AB |
2011 | :custom |
2012 | (gnus-completing-read-function 'gnus-ido-completing-read))) | |
6eb104ff | 2013 | |
47904cb7 | 2014 | (use-package mm-decode |
41d290a2 | 2015 | :config |
7e1cad06 AB |
2016 | (setq mm-discouraged-alternatives '("text/html" "text/richtext") |
2017 | mm-decrypt-option 'known | |
2018 | mm-verify-option 'known)) | |
41d290a2 | 2019 | |
47904cb7 | 2020 | (use-package mm-uu |
bb00c3f9 | 2021 | :config |
946188e1 AB |
2022 | (when (version< "27" emacs-version) |
2023 | (set-face-attribute 'mm-uu-extract nil :extend t)) | |
1fe01703 AB |
2024 | :custom |
2025 | (mm-uu-diff-groups-regexp | |
2026 | "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)")) | |
2027 | ||
47904cb7 | 2028 | (use-package sendmail |
41d290a2 | 2029 | :config |
8f8d4c32 | 2030 | (setq sendmail-program (executable-find "msmtp") |
41d290a2 AB |
2031 | ;; message-sendmail-extra-arguments '("-v" "-d") |
2032 | mail-specify-envelope-from t | |
2033 | mail-envelope-from 'header)) | |
2034 | ||
47904cb7 | 2035 | (use-package message |
bc2f85e1 | 2036 | :bind (:map message-mode-map ("<C-return>" . b/insert-asterism)) |
41d290a2 AB |
2037 | :config |
2038 | ;; redefine for a simplified In-Reply-To header | |
2039 | ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67) | |
2040 | (defun message-make-in-reply-to () | |
2041 | "Return the In-Reply-To header for this message." | |
2042 | (when message-reply-headers | |
2043 | (let ((from (mail-header-from message-reply-headers)) | |
63102057 | 2044 | (msg-id (mail-header-id message-reply-headers))) |
41d290a2 AB |
2045 | (when from |
2046 | msg-id)))) | |
2047 | ||
dca50cf5 | 2048 | (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:") |
41d290a2 AB |
2049 | (defconst message-cite-style-bandali |
2050 | '((message-cite-function 'message-cite-original) | |
2051 | (message-citation-line-function 'message-insert-formatted-citation-line) | |
2052 | (message-cite-reply-position 'traditional) | |
2053 | (message-yank-prefix "> ") | |
2054 | (message-yank-cited-prefix ">") | |
2055 | (message-yank-empty-prefix ">") | |
2056 | (message-citation-line-format | |
dca50cf5 AB |
2057 | (if b/message-cite-say-hi |
2058 | (concat "Hi %F,\n\n" b/message-cite-style-format) | |
2059 | b/message-cite-style-format))) | |
41d290a2 AB |
2060 | "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.") |
2061 | (setq ;; message-cite-style 'message-cite-style-bandali | |
2062 | message-kill-buffer-on-exit t | |
2063 | message-send-mail-function 'message-send-mail-with-sendmail | |
2064 | message-sendmail-envelope-from 'header | |
2065 | message-subscribed-address-functions | |
2066 | '(gnus-find-subscribed-addresses) | |
2067 | message-dont-reply-to-names | |
0a929da7 | 2068 | "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)") |
6eb104ff | 2069 | ;; (require 'company-ebdb) |
41d290a2 AB |
2070 | :hook (;; (message-setup . mml-secure-message-sign-pgpmime) |
2071 | (message-mode . flyspell-mode) | |
2072 | (message-mode . (lambda () | |
a1e77a3d AB |
2073 | ;; (setq-local fill-column b/fill-column |
2074 | ;; message-fill-column b/fill-column) | |
41d290a2 AB |
2075 | (make-local-variable 'company-idle-delay) |
2076 | (setq company-idle-delay 0.2)))) | |
2077 | ;; :custom-face | |
2078 | ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold)))) | |
2079 | ;; (message-header-to ((t (:foreground "#111" :weight normal)))) | |
2080 | ;; (message-header-cc ((t (:foreground "#333" :weight normal)))) | |
db1cc59c AB |
2081 | :custom |
2082 | (message-elide-ellipsis "[...]\n")) | |
41d290a2 | 2083 | |
47904cb7 | 2084 | (use-package mml) |
54209e74 | 2085 | |
47904cb7 | 2086 | (use-package mml-sec |
54209e74 AB |
2087 | :custom |
2088 | (mml-secure-openpgp-encrypt-to-self t) | |
2089 | (mml-secure-openpgp-sign-with-sender t)) | |
41d290a2 | 2090 | |
47904cb7 | 2091 | (use-package footnote |
41d290a2 AB |
2092 | :after message |
2093 | ;; :config | |
2094 | ;; (setq footnote-start-tag "" | |
2095 | ;; footnote-end-tag "" | |
2096 | ;; footnote-style 'unicode) | |
2097 | :bind | |
2098 | (:map message-mode-map | |
dca50cf5 | 2099 | :prefix-map b/footnote-prefix-map |
7cc51891 | 2100 | :prefix "C-c f n" |
41d290a2 AB |
2101 | ("a" . footnote-add-footnote) |
2102 | ("b" . footnote-back-to-message) | |
2103 | ("c" . footnote-cycle-style) | |
2104 | ("d" . footnote-delete-footnote) | |
2105 | ("g" . footnote-goto-footnote) | |
2106 | ("r" . footnote-renumber-footnotes) | |
2107 | ("s" . footnote-set-style))) | |
2108 | ||
d6cdd1fd AB |
2109 | (use-package ebdb |
2110 | :demand | |
2111 | :after gnus | |
2112 | :bind (:map gnus-group-mode-map ("e" . ebdb)) | |
2113 | :config | |
2114 | (setq ebdb-sources (b/var "ebdb")) | |
2115 | (with-eval-after-load 'swiper | |
2116 | (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) | |
41d290a2 | 2117 | |
47904cb7 | 2118 | (use-package ebdb-com |
d6cdd1fd | 2119 | :after ebdb) |
6eb104ff | 2120 | |
47904cb7 | 2121 | (use-package ebdb-complete |
d6cdd1fd AB |
2122 | :after ebdb |
2123 | :config | |
2124 | ;; (setq ebdb-complete-mail 'capf) | |
2125 | (ebdb-complete-enable)) | |
6eb104ff | 2126 | |
47904cb7 | 2127 | (use-package ebdb-message |
d6cdd1fd AB |
2128 | :demand |
2129 | :after ebdb) | |
41d290a2 | 2130 | |
d6cdd1fd AB |
2131 | ;; (use-package company-ebdb |
2132 | ;; :config | |
2133 | ;; (defun company-ebdb--post-complete (_) nil)) | |
5b10d879 | 2134 | |
47904cb7 | 2135 | (use-package ebdb-gnus |
d6cdd1fd AB |
2136 | :after ebdb |
2137 | :custom | |
2138 | (ebdb-gnus-window-size 0.3)) | |
41d290a2 | 2139 | |
47904cb7 | 2140 | (use-package ebdb-mua |
d6cdd1fd AB |
2141 | :demand |
2142 | :after ebdb | |
2143 | :custom (ebdb-mua-pop-up t)) | |
fa3741c7 | 2144 | |
d6cdd1fd AB |
2145 | ;; (use-package ebdb-message |
2146 | ;; :after ebdb) | |
41d290a2 | 2147 | |
d6cdd1fd AB |
2148 | ;; (use-package ebdb-vcard |
2149 | ;; :after ebdb) | |
41d290a2 | 2150 | |
5b10d879 | 2151 | (use-package message-x) |
41d290a2 | 2152 | |
b57457b2 AB |
2153 | (comment |
2154 | (use-package message-x | |
2155 | :custom | |
2156 | (message-x-completion-alist | |
2157 | (quote | |
2158 | (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address) | |
2159 | ((if | |
2160 | (boundp | |
2161 | (quote message-newgroups-header-regexp)) | |
2162 | message-newgroups-header-regexp message-newsgroups-header-regexp) | |
2163 | . message-expand-group)))))) | |
2164 | ||
2165 | (comment | |
2166 | (use-package gnus-harvest | |
2167 | :commands gnus-harvest-install | |
2168 | :demand t | |
2169 | :config | |
2170 | (if (featurep 'message-x) | |
2171 | (gnus-harvest-install 'message-x) | |
2172 | (gnus-harvest-install)))) | |
2173 | ||
47904cb7 | 2174 | (use-package gnus-article-treat-patch |
a5cf4300 AB |
2175 | :disabled |
2176 | :demand | |
2177 | :load-path "lisp/" | |
2178 | :config | |
35684c66 AB |
2179 | ;; note: be sure to customize faces with `:foreground "white"' when |
2180 | ;; using a theme with a white/light background :) | |
a5cf4300 AB |
2181 | (setq ft/gnus-article-patch-conditions |
2182 | '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@"))) | |
2183 | ||
b57457b2 | 2184 | \f |
e3e5e846 | 2185 | ;;; IRC (with ERC and ZNC) |
b57457b2 | 2186 | |
47904cb7 | 2187 | (use-package erc |
e38333d9 | 2188 | :bind (("C-c b b" . erc-switch-to-buffer) |
96840c88 AB |
2189 | :map erc-mode-map |
2190 | ("M-a" . erc-track-switch-buffer)) | |
2191 | :custom | |
96840c88 AB |
2192 | (erc-join-buffer 'bury) |
2193 | (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) | |
2194 | (erc-nick "bandali") | |
4d5a11b3 | 2195 | (erc-prompt "erc>") |
96840c88 AB |
2196 | (erc-rename-buffers t) |
2197 | (erc-server-reconnect-attempts 5) | |
2198 | (erc-server-reconnect-timeout 3) | |
96840c88 | 2199 | :config |
96840c88 AB |
2200 | (defun erc-cmd-OPME () |
2201 | "Request chanserv to op me." | |
2202 | (erc-message "PRIVMSG" | |
2203 | (format "chanserv op %s %s" | |
2204 | (erc-default-target) | |
2205 | (erc-current-nick)) nil)) | |
2206 | (defun erc-cmd-DEOPME () | |
2207 | "Deop myself from current channel." | |
2208 | (erc-cmd-DEOP (format "%s" (erc-current-nick)))) | |
2209 | (add-to-list 'erc-modules 'keep-place) | |
2210 | (add-to-list 'erc-modules 'notifications) | |
b7d4b4b3 | 2211 | (add-to-list 'erc-modules 'smiley) |
96840c88 | 2212 | (add-to-list 'erc-modules 'spelling) |
5b10d879 | 2213 | (add-to-list 'erc-modules 'scrolltoplace) |
cb058d21 | 2214 | (erc-update-modules)) |
96840c88 | 2215 | |
47904cb7 | 2216 | (use-package erc-fill |
e3e5e846 AB |
2217 | :after erc |
2218 | :custom | |
92df6c4f | 2219 | (erc-fill-column 77) |
e3e5e846 AB |
2220 | (erc-fill-function 'erc-fill-static) |
2221 | (erc-fill-static-center 18)) | |
2222 | ||
47904cb7 | 2223 | (use-package erc-pcomplete |
e3e5e846 AB |
2224 | :after erc |
2225 | :custom | |
0562e97e | 2226 | (erc-pcomplete-nick-postfix ", ")) |
e3e5e846 | 2227 | |
47904cb7 | 2228 | (use-package erc-track |
e3e5e846 | 2229 | :after erc |
2e81c51a AB |
2230 | :bind (("C-c a e t d" . erc-track-disable) |
2231 | ("C-c a e t e" . erc-track-enable)) | |
e3e5e846 | 2232 | :custom |
2384d161 | 2233 | (erc-track-enable-keybindings nil) |
e3e5e846 AB |
2234 | (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" |
2235 | "324" "329" "332" "333" "353" "477")) | |
7ac2eb50 | 2236 | (erc-track-position-in-mode-line t) |
e3e5e846 AB |
2237 | (erc-track-priority-faces-only 'all) |
2238 | (erc-track-shorten-function nil)) | |
2239 | ||
96840c88 AB |
2240 | (use-package erc-hl-nicks |
2241 | :after erc) | |
2242 | ||
5b10d879 AB |
2243 | (use-package erc-scrolltoplace |
2244 | :after erc) | |
96840c88 | 2245 | |
925481f2 AB |
2246 | (use-package znc |
2247 | :bind (("C-c a e e" . znc-erc) | |
2248 | ("C-c a e a" . znc-all)) | |
2249 | :config | |
2250 | (let ((pwd (let ((auth (auth-source-search :host "znca"))) | |
2251 | (cond | |
2252 | ((null auth) (error "Couldn't find znca's authinfo")) | |
2253 | (t (funcall (plist-get (car auth) :secret))))))) | |
2254 | (setq znc-servers | |
2255 | `(("znc.shemshak.org" 1337 t | |
2256 | ((freenode "amin/freenode" ,pwd))) | |
925481f2 AB |
2257 | ("znc.shemshak.org" 1337 t |
2258 | ((oftc "amin/oftc" ,pwd))))))) | |
41d290a2 | 2259 | |
b57457b2 AB |
2260 | \f |
2261 | ;;; Post initialization | |
2262 | ||
8b1a2f32 | 2263 | ) |
41d290a2 AB |
2264 | (message "Loading %s...done (%.3fs)" user-init-file |
2265 | (float-time (time-subtract (current-time) | |
dca50cf5 | 2266 | b/before-user-init-time))) |
41d290a2 AB |
2267 | |
2268 | ;;; init.el ends here |