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