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