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