Commit | Line | Data |
---|---|---|
33b1a7ea | 1 | ;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*- |
41d290a2 | 2 | |
4c05c418 | 3 | ;; Copyright (C) 2018-2020 Amin Bandali <bandali@gnu.org> |
41d290a2 AB |
4 | |
5 | ;; This program is free software: you can redistribute it and/or modify | |
6 | ;; it under the terms of the GNU General Public License as published by | |
7 | ;; the Free Software Foundation, either version 3 of the License, or | |
8 | ;; (at your option) any later version. | |
9 | ||
10 | ;; This program is distributed in the hope that it will be useful, | |
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | ;; GNU General Public License for more details. | |
14 | ||
15 | ;; You should have received a copy of the GNU General Public License | |
16 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | |
17 | ||
18 | ;;; Commentary: | |
19 | ||
33b1a7ea | 20 | ;; GNU Emacs configuration of Amin Bandali, computer scientist, |
92ad9675 | 21 | ;; Free Software activist, and GNU maintainer & webmaster. Packages |
f7910e3d | 22 | ;; are installed through using Borg for a fully reproducible setup. |
b57457b2 AB |
23 | |
24 | ;; Over the years, I've taken inspiration from configurations of many | |
25 | ;; great people. Some that I can remember off the top of my head are: | |
26 | ;; | |
27 | ;; - https://github.com/dieggsy/dotfiles | |
28 | ;; - https://github.com/dakra/dmacs | |
29 | ;; - http://pages.sachachua.com/.emacs.d/Sacha.html | |
30 | ;; - https://github.com/dakrone/eos | |
31 | ;; - http://doc.rix.si/cce/cce.html | |
32 | ;; - https://github.com/jwiegley/dot-emacs | |
33 | ;; - https://github.com/wasamasa/dotemacs | |
34 | ;; - https://github.com/hlissner/doom-emacs | |
41d290a2 | 35 | |
49e9503b AB |
36 | ;;; Code: |
37 | ||
b57457b2 AB |
38 | ;;; Emacs initialization |
39 | ||
dca50cf5 | 40 | (defvar b/before-user-init-time (current-time) |
41d290a2 | 41 | "Value of `current-time' when Emacs begins loading `user-init-file'.") |
83364e5b AB |
42 | (defvar b/emacs-initialized nil |
43 | "Whether Emacs has been initialized.") | |
8b1a2f32 AB |
44 | (defvar b/exwm-p (string= (system-name) "chaman") |
45 | "Whether or not we will be using `exwm'.") | |
83364e5b AB |
46 | |
47 | (when (not (bound-and-true-p b/emacs-initialized)) | |
48 | (message "Loading Emacs...done (%.3fs)" | |
49 | (float-time (time-subtract b/before-user-init-time | |
50 | before-init-time)))) | |
41d290a2 | 51 | |
b57457b2 AB |
52 | ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' |
53 | ;; during startup to reduce garbage collection frequency. clearing | |
54 | ;; `file-name-handler-alist' seems to help reduce startup time too. | |
dca50cf5 AB |
55 | (defvar b/gc-cons-threshold gc-cons-threshold) |
56 | (defvar b/gc-cons-percentage gc-cons-percentage) | |
57 | (defvar b/file-name-handler-alist file-name-handler-alist) | |
bc58e70a | 58 | (setq gc-cons-threshold (* 30 1024 1024) ; 30 MiB |
41d290a2 AB |
59 | gc-cons-percentage 0.6 |
60 | file-name-handler-alist nil | |
61 | ;; sidesteps a bug when profiling with esup | |
62 | esup-child-profile-require-level 0) | |
63 | ||
b57457b2 | 64 | ;; set them back to their defaults once we're done initializing |
dca50cf5 | 65 | (defun b/post-init () |
83364e5b AB |
66 | "My post-initialize function, run after loading `user-init-file'." |
67 | (setq b/emacs-initialized t | |
68 | gc-cons-threshold b/gc-cons-threshold | |
69 | gc-cons-percentage b/gc-cons-percentage | |
e8a3b8f7 | 70 | file-name-handler-alist b/file-name-handler-alist) |
8b1a2f32 AB |
71 | (when b/exwm-p |
72 | (with-eval-after-load 'exwm-workspace | |
73 | (setq-default | |
74 | mode-line-format | |
75 | (append | |
76 | mode-line-format | |
77 | '((:eval | |
78 | (format | |
79 | "[%s]" (number-to-string | |
80 | exwm-workspace-current-index))))))))) | |
dca50cf5 | 81 | (add-hook 'after-init-hook #'b/post-init) |
41d290a2 | 82 | |
b57457b2 | 83 | ;; increase number of lines kept in *Messages* log |
41d290a2 AB |
84 | (setq message-log-max 20000) |
85 | ||
b57457b2 AB |
86 | ;; optionally, uncomment to supress some byte-compiler warnings |
87 | ;; (see C-h v byte-compile-warnings RET for more info) | |
41d290a2 AB |
88 | ;; (setq byte-compile-warnings |
89 | ;; '(not free-vars unresolved noruntime lexical make-local)) | |
90 | ||
b57457b2 AB |
91 | \f |
92 | ;;; whoami | |
93 | ||
41d290a2 | 94 | (setq user-full-name "Amin Bandali" |
33b1a7ea | 95 | user-mail-address "bandali@gnu.org") |
41d290a2 | 96 | |
b57457b2 | 97 | \f |
33273849 AB |
98 | ;;; Package management |
99 | ||
032726b6 AB |
100 | (progn ; `borg' |
101 | (add-to-list 'load-path | |
102 | (expand-file-name "lib/borg" user-emacs-directory)) | |
103 | (require 'borg) | |
104 | (borg-initialize) | |
105 | (setq borg-rewrite-urls-alist | |
106 | '(("git@github.com:" . "https://github.com/") | |
107 | ("git@gitlab.com:" . "https://gitlab.com/")))) | |
33273849 AB |
108 | |
109 | ;; use-package | |
41d290a2 AB |
110 | (if nil ; set to t when need to debug init |
111 | (progn | |
112 | (setq use-package-verbose t | |
113 | use-package-expand-minimally nil | |
114 | use-package-compute-statistics t | |
115 | debug-on-error t) | |
116 | (require 'use-package)) | |
117 | (setq use-package-verbose nil | |
118 | use-package-expand-minimally t)) | |
119 | ||
120 | (setq use-package-always-defer t) | |
121 | (require 'bind-key) | |
122 | ||
b57457b2 AB |
123 | \f |
124 | ;;; Initial setup | |
125 | ||
126 | ;; keep ~/.emacs.d clean | |
1060413b AB |
127 | (use-package no-littering |
128 | :demand | |
129 | :config | |
130 | (defalias 'b/etc 'no-littering-expand-etc-file-name) | |
131 | (defalias 'b/var 'no-littering-expand-var-file-name)) | |
41d290a2 | 132 | |
032726b6 AB |
133 | (use-package auto-compile |
134 | :demand | |
135 | :config | |
136 | (auto-compile-on-load-mode) | |
137 | (auto-compile-on-save-mode) | |
138 | (setq auto-compile-display-buffer nil) | |
139 | (setq auto-compile-mode-line-counter t) | |
140 | (setq auto-compile-source-recreate-deletes-dest t) | |
141 | (setq auto-compile-toggle-deletes-nonlib-dest t) | |
142 | (setq auto-compile-update-autoloads t)) | |
143 | ||
b57457b2 | 144 | ;; separate custom file (don't want it mixing with init.el) |
47904cb7 | 145 | (use-package custom |
60ff805e | 146 | :no-require |
41d290a2 | 147 | :config |
dca50cf5 | 148 | (setq custom-file (b/etc "custom.el")) |
41d290a2 AB |
149 | (when (file-exists-p custom-file) |
150 | (load custom-file)) | |
b57457b2 | 151 | ;; while at it, treat themes as safe |
60ff805e AB |
152 | (setf custom-safe-themes t) |
153 | ;; only one custom theme at a time | |
154 | (comment | |
155 | (defadvice load-theme (before clear-previous-themes activate) | |
156 | "Clear existing theme settings instead of layering them" | |
157 | (mapc #'disable-theme custom-enabled-themes)))) | |
41d290a2 | 158 | |
b57457b2 | 159 | ;; load the secrets file if it exists, otherwise show a warning |
dca50cf5 AB |
160 | (comment |
161 | (with-demoted-errors | |
162 | (load (b/etc "secrets")))) | |
41d290a2 | 163 | |
b57457b2 AB |
164 | ;; start up emacs server. see |
165 | ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server | |
47904cb7 | 166 | (use-package server |
f7910e3d | 167 | :defer 0.5 |
2087ae39 AB |
168 | :config |
169 | (declare-function server-edit "server") | |
170 | (bind-key "C-c F D" 'server-edit) | |
171 | (declare-function server-running-p "server") | |
172 | (or (server-running-p) (server-mode))) | |
41d290a2 | 173 | |
60ff805e | 174 | \f |
60ff805e AB |
175 | ;;; Defaults |
176 | ||
177 | ;;;; C-level customizations | |
178 | ||
179 | (setq | |
180 | ;; minibuffer | |
181 | enable-recursive-minibuffers t | |
182 | resize-mini-windows t | |
183 | ;; more useful frame titles | |
184 | frame-title-format '("" invocation-name " - " | |
185 | (:eval | |
186 | (if (buffer-file-name) | |
187 | (abbreviate-file-name (buffer-file-name)) | |
188 | "%b"))) | |
189 | ;; i don't feel like jumping out of my chair every now and again; so | |
190 | ;; don't BEEP! at me, emacs | |
191 | ring-bell-function 'ignore | |
192 | ;; better scrolling | |
193 | ;; scroll-margin 1 | |
194 | ;; scroll-conservatively 10000 | |
195 | scroll-step 1 | |
bdd3a0bb | 196 | scroll-conservatively 101 |
60ff805e AB |
197 | scroll-preserve-screen-position 1 |
198 | ;; focus follows mouse | |
39cc9c96 | 199 | mouse-autoselect-window t) |
60ff805e AB |
200 | |
201 | (setq-default | |
202 | ;; always use space for indentation | |
203 | indent-tabs-mode nil | |
204 | tab-width 4 | |
205 | ;; cursor shape | |
567440fa | 206 | cursor-type t) |
60ff805e | 207 | |
b57457b2 AB |
208 | ;; unicode support |
209 | (comment | |
210 | (dolist (ft (fontset-list)) | |
211 | (set-fontset-font | |
212 | ft | |
213 | 'unicode | |
214 | (font-spec :name "Source Code Pro" :size 14)) | |
215 | (set-fontset-font | |
216 | ft | |
217 | 'unicode | |
218 | (font-spec :name "DejaVu Sans Mono") | |
219 | nil | |
220 | 'append) | |
221 | ;; (set-fontset-font | |
222 | ;; ft | |
223 | ;; 'unicode | |
224 | ;; (font-spec | |
225 | ;; :name "Symbola monospacified for DejaVu Sans Mono") | |
226 | ;; nil | |
227 | ;; 'append) | |
228 | ;; (set-fontset-font | |
229 | ;; ft | |
230 | ;; #x2115 ; ℕ | |
231 | ;; (font-spec :name "DejaVu Sans Mono") | |
232 | ;; nil | |
233 | ;; 'append) | |
234 | (set-fontset-font | |
235 | ft | |
236 | (cons ?Α ?ω) | |
237 | (font-spec :name "DejaVu Sans Mono" :size 14) | |
238 | nil | |
239 | 'prepend))) | |
240 | ||
60ff805e | 241 | ;;;; Elisp-level customizations |
41d290a2 | 242 | |
47904cb7 | 243 | (use-package startup |
60ff805e AB |
244 | :no-require |
245 | :demand | |
41d290a2 | 246 | :config |
60ff805e AB |
247 | ;; don't need to see the startup echo area message |
248 | (advice-add #'display-startup-echo-area-message :override #'ignore) | |
249 | :custom | |
250 | ;; i want *scratch* as my startup buffer | |
251 | (initial-buffer-choice t) | |
252 | ;; i don't need the default hint | |
253 | (initial-scratch-message nil) | |
254 | ;; use customizable text-mode as major mode for *scratch* | |
2568a634 | 255 | ;; (initial-major-mode 'text-mode) |
60ff805e AB |
256 | ;; inhibit buffer list when more than 2 files are loaded |
257 | (inhibit-startup-buffer-menu t) | |
258 | ;; don't need to see the startup screen or echo area message | |
259 | (inhibit-startup-screen t) | |
260 | (inhibit-startup-echo-area-message user-login-name)) | |
41d290a2 | 261 | |
47904cb7 | 262 | (use-package files |
60ff805e AB |
263 | :no-require |
264 | :demand | |
9fc30d4c | 265 | :custom |
60ff805e AB |
266 | ;; backups (C-h v make-backup-files RET) |
267 | (backup-by-copying t) | |
268 | (version-control t) | |
269 | (delete-old-versions t) | |
41d290a2 | 270 | |
60ff805e AB |
271 | ;; auto-save |
272 | (auto-save-file-name-transforms | |
273 | `((".*" ,(b/var "auto-save/") t))) | |
41d290a2 | 274 | |
60ff805e AB |
275 | ;; insert newline at the end of files |
276 | (require-final-newline t) | |
b57457b2 | 277 | |
60ff805e AB |
278 | ;; open read-only file buffers in view-mode |
279 | ;; (enables niceties like `q' for quit) | |
280 | (view-read-only t)) | |
41d290a2 | 281 | |
60ff805e AB |
282 | ;; disable disabled commands |
283 | (setq disabled-command-function nil) | |
41d290a2 | 284 | |
60ff805e AB |
285 | ;; lazy-person-friendly yes/no prompts |
286 | (defalias 'yes-or-no-p #'y-or-n-p) | |
b57457b2 | 287 | |
60ff805e | 288 | ;; enable automatic reloading of changed buffers and files |
47904cb7 | 289 | (use-package autorevert |
60ff805e AB |
290 | :demand |
291 | :config | |
292 | (global-auto-revert-mode 1) | |
293 | :custom | |
294 | (auto-revert-verbose nil) | |
295 | (global-auto-revert-non-file-buffers nil)) | |
b57457b2 AB |
296 | |
297 | ;; time and battery in mode-line | |
47904cb7 | 298 | (use-package time |
e4902e0b | 299 | :demand |
64938292 AB |
300 | :config |
301 | (display-time-mode) | |
302 | :custom | |
303 | (display-time-default-load-average nil) | |
f7910e3d | 304 | (display-time-format " %a %b %-e %-l:%M%P") |
ad61316b AB |
305 | (display-time-mail-icon '(image :type xpm :file "gnus/gnus-pointer.xpm" :ascent center)) |
306 | (display-time-use-mail-icon t)) | |
64938292 | 307 | |
47904cb7 | 308 | (use-package battery |
e4902e0b | 309 | :demand |
64938292 AB |
310 | :config |
311 | (display-battery-mode) | |
312 | :custom | |
f7910e3d | 313 | (battery-mode-line-format "%p%% %t")) |
b57457b2 | 314 | |
47904cb7 | 315 | (use-package fringe |
60ff805e AB |
316 | :demand |
317 | :config | |
318 | ;; smaller fringe | |
319 | ;; (fringe-mode '(3 . 1)) | |
320 | (fringe-mode nil)) | |
41d290a2 | 321 | |
47904cb7 | 322 | (use-package winner |
60ff805e AB |
323 | :demand |
324 | :config | |
325 | ;; enable winner-mode (C-h f winner-mode RET) | |
326 | (winner-mode 1)) | |
41d290a2 | 327 | |
47904cb7 | 328 | (use-package compile |
60ff805e AB |
329 | :config |
330 | ;; don't display *compilation* buffer on success. based on | |
331 | ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf' | |
332 | ;; instead of the now obsolete `flet'. | |
dca50cf5 | 333 | (defun b/compilation-finish-function (buffer outstr) |
41d290a2 AB |
334 | (unless (string-match "finished" outstr) |
335 | (switch-to-buffer-other-window buffer)) | |
336 | t) | |
337 | ||
dca50cf5 | 338 | (setq compilation-finish-functions #'b/compilation-finish-function) |
41d290a2 AB |
339 | |
340 | (require 'cl-macs) | |
341 | ||
342 | (defadvice compilation-start | |
343 | (around inhibit-display | |
344 | (command &optional mode name-function highlight-regexp)) | |
345 | (if (not (string-match "^\\(find\\|grep\\)" command)) | |
346 | (cl-letf (((symbol-function 'display-buffer) #'ignore)) | |
347 | (save-window-excursion ad-do-it)) | |
348 | ad-do-it)) | |
349 | (ad-activate 'compilation-start)) | |
350 | ||
47904cb7 | 351 | (use-package isearch |
60ff805e AB |
352 | :custom |
353 | ;; allow scrolling in Isearch | |
354 | (isearch-allow-scroll t) | |
355 | ;; search for non-ASCII characters: i’d like non-ASCII characters such | |
356 | ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII | |
357 | ;; counterpart. shoutout to | |
358 | ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html | |
359 | (search-default-mode #'char-fold-to-regexp)) | |
360 | ||
361 | ;; uncomment to extend the above behaviour to query-replace | |
362 | (comment | |
47904cb7 | 363 | (use-package replace |
60ff805e AB |
364 | :custom |
365 | (replace-char-fold t))) | |
b9901074 | 366 | |
47904cb7 | 367 | (use-package vc |
b1a5d811 AB |
368 | :bind ("C-x v C-=" . vc-ediff)) |
369 | ||
47904cb7 | 370 | (use-package vc-git |
e59c8878 AB |
371 | :after vc |
372 | :custom | |
373 | (vc-git-print-log-follow t)) | |
374 | ||
47904cb7 | 375 | (use-package ediff |
b1a5d811 AB |
376 | :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) |
377 | :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) | |
378 | (ediff-split-window-function 'split-window-horizontally))) | |
379 | ||
47904cb7 | 380 | (use-package face-remap |
60ff805e AB |
381 | :custom |
382 | ;; gentler font resizing | |
383 | (text-scale-mode-step 1.05)) | |
384 | ||
47904cb7 | 385 | (use-package mwheel |
60ff805e AB |
386 | :defer 0.4 |
387 | :config | |
388 | (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)) ; one line at a time | |
389 | mouse-wheel-progressive-speed nil ; don't accelerate scrolling | |
390 | mouse-wheel-follow-mouse t)) ; scroll window under mouse | |
391 | ||
47904cb7 | 392 | (use-package pixel-scroll |
60ff805e AB |
393 | :defer 0.4 |
394 | :config (pixel-scroll-mode 1)) | |
395 | ||
47904cb7 | 396 | (use-package epg-config |
a89c8bd8 AB |
397 | :config |
398 | ;; ask for GPG passphrase in minibuffer | |
399 | ;; this will fail if gpg>=2.1 is not available | |
97141042 | 400 | (setq epg-pinentry-mode 'loopback) |
60ff805e | 401 | :custom |
47904cb7 | 402 | (epg-gpg-program (executable-find "gpg"))) |
1d405cde | 403 | |
47904cb7 AB |
404 | (use-package epg |
405 | :after epg-config) | |
406 | ||
a89c8bd8 | 407 | (use-package pinentry |
8b1a2f32 | 408 | :disabled |
a89c8bd8 AB |
409 | :demand |
410 | :after (epa epg server) | |
411 | :config | |
412 | ;; workaround for systemd-based distros: | |
413 | ;; (setq pinentry--socket-dir server-socket-dir) | |
414 | (pinentry-start)) | |
415 | ||
47904cb7 | 416 | (use-package auth-source |
b98dbb3d AB |
417 | :custom |
418 | (auth-sources '("~/.authinfo.gpg")) | |
419 | (authinfo-hidden (regexp-opt '("password" "client-secret" "token")))) | |
420 | ||
b57457b2 AB |
421 | \f |
422 | ;;; General bindings | |
423 | ||
41d290a2 | 424 | (bind-keys |
c64e010d | 425 | ("C-a" . b/move-indentation-or-beginning-of-line) |
41d290a2 | 426 | ("C-c a i" . ielm) |
ad1f9d99 | 427 | ("C-c d" . b/duplicate-line-or-region) |
41d290a2 AB |
428 | |
429 | ("C-c e b" . eval-buffer) | |
2a816b71 | 430 | ("C-c e e" . eval-last-sexp) |
12ff40a3 | 431 | ("C-c e p" . pp-macroexpand-last-sexp) |
41d290a2 AB |
432 | ("C-c e r" . eval-region) |
433 | ||
434 | ("C-c e i" . emacs-init-time) | |
435 | ("C-c e u" . emacs-uptime) | |
dca50cf5 | 436 | ("C-c e v" . emacs-version) |
41d290a2 | 437 | |
567440fa AB |
438 | ("C-c f ." . find-file) |
439 | ("C-c f d" . find-name-dired) | |
440 | ("C-c f l" . find-library) | |
441 | ||
41d290a2 AB |
442 | ("C-c F m" . make-frame-command) |
443 | ("C-c F d" . delete-frame) | |
41d290a2 | 444 | |
41d290a2 AB |
445 | ("C-S-h C" . describe-char) |
446 | ("C-S-h F" . describe-face) | |
447 | ||
e5c2d147 AB |
448 | ("C-S-j" . b/join-line-top) |
449 | ||
567440fa AB |
450 | ("C-c x" . execute-extended-command) |
451 | ||
a5cc22f4 | 452 | ("C-x k" . b/kill-current-buffer) |
41d290a2 | 453 | ("C-x K" . kill-buffer) |
2a816b71 AB |
454 | ("C-x s" . save-buffer) |
455 | ("C-x S" . save-some-buffers) | |
41d290a2 | 456 | |
b57457b2 | 457 | :map emacs-lisp-mode-map |
dca50cf5 | 458 | ("<C-return>" . b/add-elisp-section)) |
41d290a2 AB |
459 | |
460 | (when (display-graphic-p) | |
461 | (unbind-key "C-z" global-map)) | |
462 | ||
500004f4 AB |
463 | (bind-keys |
464 | ;; for back and forward mouse keys | |
0365678c | 465 | ("<XF86Back>" . previous-buffer) |
500004f4 | 466 | ("<mouse-8>" . previous-buffer) |
4bdfe6ab | 467 | ;; ("<drag-mouse-8>" . previous-buffer) |
0365678c | 468 | ("<XF86Forward>" . next-buffer) |
500004f4 | 469 | ("<mouse-9>" . next-buffer) |
4bdfe6ab AB |
470 | ;; ("<drag-mouse-9>" . next-buffer) |
471 | ;; ("<drag-mouse-2>" . kill-this-buffer) | |
472 | ;; ("<drag-mouse-3>" . switch-to-buffer) | |
473 | ) | |
500004f4 | 474 | |
b57457b2 AB |
475 | \f |
476 | ;;; Essential packages | |
477 | ||
8b1a2f32 AB |
478 | (when b/exwm-p |
479 | (require 'bandali-exwm)) | |
33273849 | 480 | |
f7910e3d | 481 | (require 'bandali-org) |
41d290a2 | 482 | |
9c48decc AB |
483 | (require 'bandali-theme) |
484 | ||
b57457b2 | 485 | ;; *the* right way to do git |
41d290a2 | 486 | (use-package magit |
2a816b71 AB |
487 | :bind (("C-x g" . magit-status) |
488 | ("C-c g g" . magit-status) | |
ef6c487c AB |
489 | ("C-c g b" . magit-blame-addition) |
490 | ("C-c g l" . magit-log-buffer-file)) | |
41d290a2 | 491 | :config |
2087ae39 AB |
492 | (declare-function magit-add-section-hook "magit-section" |
493 | (hook function &optional at append local)) | |
41d290a2 AB |
494 | (magit-add-section-hook 'magit-status-sections-hook |
495 | 'magit-insert-modules | |
496 | 'magit-insert-stashes | |
497 | 'append) | |
3b3615f5 AB |
498 | ;; (magit-add-section-hook 'magit-status-sections-hook |
499 | ;; 'magit-insert-ignored-files | |
500 | ;; 'magit-insert-untracked-files | |
501 | ;; 'append) | |
8a2e0eef | 502 | (setq magit-repository-directories '(("~/.emacs.d/" . 0) |
81ea6e55 | 503 | ("~/src/git/" . 2))) |
41d290a2 AB |
504 | (nconc magit-section-initial-visibility-alist |
505 | '(([unpulled status] . show) | |
506 | ([unpushed status] . show))) | |
2087ae39 | 507 | (declare-function magit-display-buffer-fullframe-status-v1 "magit-mode" (buffer)) |
3fffeb0a AB |
508 | :custom |
509 | (magit-diff-refine-hunk t) | |
510 | (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) | |
6ca3a7b1 | 511 | ;; (magit-completing-read-function 'magit-ido-completing-read) |
41d290a2 AB |
512 | :custom-face (magit-diff-file-heading ((t (:weight normal))))) |
513 | ||
b57457b2 | 514 | ;; recently opened files |
47904cb7 | 515 | (use-package recentf |
41d290a2 | 516 | :defer 0.2 |
6b09fc8a AB |
517 | :config |
518 | (add-to-list 'recentf-keep 'file-remote-p) | |
6eb104ff AB |
519 | :config |
520 | (recentf-mode) | |
dca50cf5 | 521 | :custom |
1060413b | 522 | (recentf-max-saved-items 2000)) |
41d290a2 | 523 | |
679463c6 | 524 | ;; needed for history for counsel |
6eb104ff AB |
525 | (use-package amx |
526 | :defer 0.3 | |
527 | :config | |
528 | (amx-mode)) | |
529 | ||
679463c6 AB |
530 | ;; (require 'bandali-ido) |
531 | (require 'bandali-ivy) | |
41d290a2 | 532 | |
679463c6 | 533 | (require 'bandali-eshell) |
1eb20313 | 534 | ;; (require 'bandali-multi-term) |
41d290a2 | 535 | |
679463c6 | 536 | (require 'bandali-ibuffer) |
41d290a2 | 537 | |
47904cb7 | 538 | (use-package outline |
2e81c51a | 539 | :disabled |
41d290a2 AB |
540 | :hook (prog-mode . outline-minor-mode) |
541 | :bind | |
542 | (:map | |
543 | outline-minor-mode-map | |
544 | ("<s-tab>" . outline-toggle-children) | |
545 | ("M-p" . outline-previous-visible-heading) | |
546 | ("M-n" . outline-next-visible-heading) | |
dca50cf5 | 547 | :prefix-map b/outline-prefix-map |
ed8c4fa9 | 548 | :prefix "s-O" |
41d290a2 AB |
549 | ("TAB" . outline-toggle-children) |
550 | ("a" . outline-hide-body) | |
551 | ("H" . outline-hide-body) | |
552 | ("S" . outline-show-all) | |
553 | ("h" . outline-hide-subtree) | |
1eb20313 AB |
554 | ("s" . outline-show-subtree)) |
555 | :config | |
556 | (when (featurep 'which-key) | |
557 | (which-key-add-key-based-replacements | |
558 | "C-c @" "outline" | |
559 | "s-O" "outline"))) | |
41d290a2 | 560 | |
679463c6 | 561 | (require 'bandali-dired) |
41d290a2 | 562 | |
47904cb7 | 563 | (use-package help |
6b09fc8a AB |
564 | :bind |
565 | (:map help-mode-map | |
566 | ("p" . backward-button) | |
567 | ("n" . forward-button)) | |
41d290a2 AB |
568 | :config |
569 | (temp-buffer-resize-mode) | |
570 | (setq help-window-select t)) | |
571 | ||
47904cb7 | 572 | (use-package tramp |
41d290a2 AB |
573 | :config |
574 | (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) | |
575 | (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) | |
576 | (add-to-list 'tramp-default-proxies-alist | |
577 | (list (regexp-quote (system-name)) nil nil))) | |
578 | ||
47904cb7 | 579 | (use-package doc-view |
41d290a2 AB |
580 | :bind (:map doc-view-mode-map |
581 | ("M-RET" . image-previous-line))) | |
582 | ||
e2178fd3 | 583 | ;; Email (with Gnus, message, and EBDB) |
2087ae39 | 584 | (require 'bandali-gnus) |
2087ae39 AB |
585 | (use-package sendmail |
586 | :config | |
587 | (setq sendmail-program (executable-find "msmtp") | |
588 | ;; message-sendmail-extra-arguments '("-v" "-d") | |
589 | mail-specify-envelope-from t | |
590 | mail-envelope-from 'header)) | |
2087ae39 | 591 | (require 'bandali-message) |
e2178fd3 | 592 | (require 'bandali-ebdb) |
2087ae39 | 593 | |
39c1c073 AB |
594 | ;; IRC (with ERC and ZNC) |
595 | (require 'bandali-erc) | |
596 | ||
2331b5a0 AB |
597 | (use-package scpaste |
598 | :config | |
599 | (setq scpaste-http-destination "https://p.bndl.org" | |
600 | scpaste-scp-destination "p:~")) | |
601 | ||
b57457b2 AB |
602 | \f |
603 | ;;; Editing | |
5750405c | 604 | |
b57457b2 | 605 | ;; highlight uncommitted changes in the left fringe |
41d290a2 | 606 | (use-package diff-hl |
df1c9bc8 | 607 | :defer 0.6 |
41d290a2 AB |
608 | :config |
609 | (setq diff-hl-draw-borders nil) | |
610 | (global-diff-hl-mode) | |
5750405c AB |
611 | :hook |
612 | ((magit-pre-refresh . diff-hl-magit-pre-refresh) | |
613 | (magit-post-refresh . diff-hl-magit-post-refresh))) | |
41d290a2 | 614 | |
b57457b2 | 615 | ;; display Lisp objects at point in the echo area |
47904cb7 | 616 | (use-package eldoc |
41d290a2 AB |
617 | :when (version< "25" emacs-version) |
618 | :config (global-eldoc-mode)) | |
619 | ||
b57457b2 | 620 | ;; highlight matching parens |
47904cb7 | 621 | (use-package paren |
41d290a2 AB |
622 | :demand |
623 | :config (show-paren-mode)) | |
624 | ||
47904cb7 | 625 | (use-package elec-pair |
40eddfea AB |
626 | :demand |
627 | :config (electric-pair-mode)) | |
628 | ||
47904cb7 | 629 | (use-package simple |
60ff805e AB |
630 | :config (column-number-mode) |
631 | :custom | |
632 | ;; Save what I copy into clipboard from other applications into Emacs' | |
633 | ;; kill-ring, which would allow me to still be able to easily access | |
634 | ;; it in case I kill (cut or copy) something else inside Emacs before | |
635 | ;; yanking (pasting) what I'd originally intended to. | |
636 | (save-interprogram-paste-before-kill t)) | |
41d290a2 | 637 | |
b57457b2 | 638 | ;; save minibuffer history |
47904cb7 | 639 | (use-package savehist |
1060413b | 640 | :demand |
dca50cf5 AB |
641 | :config |
642 | (savehist-mode) | |
1060413b | 643 | (add-to-list 'savehist-additional-variables 'kill-ring)) |
41d290a2 | 644 | |
b57457b2 | 645 | ;; automatically save place in files |
47904cb7 | 646 | (use-package saveplace |
41d290a2 | 647 | :when (version< "25" emacs-version) |
1060413b | 648 | :config (save-place-mode)) |
41d290a2 | 649 | |
47904cb7 | 650 | (use-package prog-mode |
41d290a2 AB |
651 | :config (global-prettify-symbols-mode) |
652 | (defun indicate-buffer-boundaries-left () | |
653 | (setq indicate-buffer-boundaries 'left)) | |
654 | (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left)) | |
655 | ||
47904cb7 | 656 | (use-package text-mode |
bc2f85e1 | 657 | :bind (:map text-mode-map ("C-*" . b/insert-asterism)) |
93a86536 AB |
658 | :hook ((text-mode . indicate-buffer-boundaries-left) |
659 | (text-mode . flyspell-mode))) | |
41d290a2 | 660 | |
47904cb7 | 661 | (use-package conf-mode |
300b7363 AB |
662 | :mode "\\.*rc$") |
663 | ||
5b990219 AB |
664 | (use-package sh-script |
665 | :mode ("\\.bashrc$" . sh-mode)) | |
300b7363 | 666 | |
41d290a2 | 667 | (use-package company |
ccade202 | 668 | :disabled |
41d290a2 AB |
669 | :bind |
670 | (:map company-active-map | |
671 | ([tab] . company-complete-common-or-cycle) | |
d39234b9 AB |
672 | ([escape] . company-abort) |
673 | ("C-p" . company-select-previous-or-abort) | |
674 | ("C-n" . company-select-next-or-abort)) | |
41d290a2 AB |
675 | :custom |
676 | (company-minimum-prefix-length 1) | |
677 | (company-selection-wrap-around t) | |
678 | (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]") | |
679 | (company-dabbrev-downcase nil) | |
680 | (company-dabbrev-ignore-case nil) | |
6eb104ff AB |
681 | ;; :config |
682 | ;; (global-company-mode t) | |
683 | ) | |
41d290a2 AB |
684 | |
685 | (use-package flycheck | |
fac1032c | 686 | :disabled |
41d290a2 AB |
687 | :defer 0.6 |
688 | :hook (prog-mode . flycheck-mode) | |
689 | :bind | |
690 | (:map flycheck-mode-map | |
691 | ("M-P" . flycheck-previous-error) | |
692 | ("M-N" . flycheck-next-error)) | |
693 | :config | |
694 | ;; Use the load-path from running Emacs when checking elisp files | |
695 | (setq flycheck-emacs-lisp-load-path 'inherit) | |
696 | ||
697 | ;; Only flycheck when I actually save the buffer | |
54209e74 AB |
698 | (setq flycheck-check-syntax-automatically '(mode-enabled save)) |
699 | :custom (flycheck-mode-line-prefix "flyc")) | |
700 | ||
fac1032c | 701 | ;; (use-package flyspell) |
41d290a2 AB |
702 | |
703 | ;; http://endlessparentheses.com/ispell-and-apostrophes.html | |
47904cb7 | 704 | (use-package ispell |
fac1032c | 705 | :disabled |
41d290a2 AB |
706 | :defer 0.6 |
707 | :config | |
708 | ;; ’ can be part of a word | |
709 | (setq ispell-local-dictionary-alist | |
710 | `((nil "[[:alpha:]]" "[^[:alpha:]]" | |
b1ed9ee8 AB |
711 | "['\x2019]" nil ("-B") nil utf-8)) |
712 | ispell-program-name (executable-find "hunspell")) | |
41d290a2 AB |
713 | ;; don't send ’ to the subprocess |
714 | (defun endless/replace-apostrophe (args) | |
715 | (cons (replace-regexp-in-string | |
716 | "’" "'" (car args)) | |
717 | (cdr args))) | |
718 | (advice-add #'ispell-send-string :filter-args | |
719 | #'endless/replace-apostrophe) | |
720 | ||
721 | ;; convert ' back to ’ from the subprocess | |
722 | (defun endless/replace-quote (args) | |
723 | (if (not (derived-mode-p 'org-mode)) | |
724 | args | |
725 | (cons (replace-regexp-in-string | |
726 | "'" "’" (car args)) | |
727 | (cdr args)))) | |
728 | (advice-add #'ispell-parse-output :filter-args | |
729 | #'endless/replace-quote)) | |
730 | ||
47904cb7 | 731 | (use-package abbrev |
1060413b | 732 | :hook (text-mode . abbrev-mode)) |
54209e74 | 733 | |
b57457b2 AB |
734 | \f |
735 | ;;; Programming modes | |
736 | ||
47904cb7 | 737 | (use-package lisp-mode |
41d290a2 | 738 | :config |
41d290a2 AB |
739 | (defun indent-spaces-mode () |
740 | (setq indent-tabs-mode nil)) | |
741 | (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) | |
742 | ||
fac1032c AB |
743 | (use-package alloy-mode |
744 | :mode "\\.\\(als\\|dsh\\)\\'" | |
745 | :config | |
746 | (setq alloy-basic-offset 2) | |
747 | ;; (defun b/alloy-simple-indent (start end) | |
748 | ;; (interactive "r") | |
749 | ;; ;; (if (region-active-p) | |
750 | ;; ;; (indent-rigidly start end alloy-basic-offset) | |
751 | ;; ;; (if (bolp) | |
752 | ;; ;; (indent-rigidly (line-beginning-position) | |
753 | ;; ;; (line-end-position) | |
754 | ;; ;; alloy-basic-offset))) | |
755 | ;; (indent-to (+ (current-column) alloy-basic-offset))) | |
756 | :bind (:map alloy-mode-map | |
757 | ("RET" . electric-newline-and-maybe-indent) | |
758 | ;; ("TAB" . b/alloy-simple-indent) | |
759 | ("TAB" . indent-for-tab-command)) | |
760 | :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil)))) | |
761 | ||
33273849 | 762 | (use-package lean-mode |
46b0569f | 763 | :disabled |
33273849 | 764 | :defer 0.4 |
46b0569f | 765 | :init (eval-when-compile (defvar lean-mode-map)) |
33273849 AB |
766 | :bind (:map lean-mode-map |
767 | ("S-SPC" . company-complete)) | |
768 | :config | |
769 | (require 'lean-input) | |
770 | (setq default-input-method "Lean" | |
771 | lean-input-tweak-all '(lean-input-compose | |
772 | (lean-input-prepend "/") | |
773 | (lean-input-nonempty)) | |
774 | lean-input-user-translations '(("/" "/"))) | |
775 | (lean-input-setup)) | |
776 | ||
47904cb7 | 777 | (use-package sgml-mode |
41d290a2 | 778 | :config |
5dfaee4c | 779 | (setq sgml-basic-offset 0)) |
41d290a2 | 780 | |
47904cb7 | 781 | (use-package css-mode |
41d290a2 AB |
782 | :config |
783 | (setq css-indent-offset 2)) | |
784 | ||
46b0569f AB |
785 | (use-package geiser |
786 | :disabled) | |
41d290a2 | 787 | |
47904cb7 | 788 | (use-package geiser-guile |
46b0569f | 789 | :disabled |
41d290a2 AB |
790 | :config |
791 | (setq geiser-guile-load-path "~/src/git/guix")) | |
792 | ||
46b0569f AB |
793 | (use-package guix |
794 | :disabled) | |
41d290a2 | 795 | |
47904cb7 AB |
796 | (use-package go-mode |
797 | :disabled) | |
99473567 | 798 | |
f704f564 | 799 | (use-package po-mode |
46b0569f | 800 | :disabled |
f704f564 AB |
801 | :hook |
802 | (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit)))) | |
803 | ||
a2feb3de AB |
804 | (use-package auctex |
805 | :disabled | |
806 | :custom | |
807 | (font-latex-fontify-sectioning 'color)) | |
808 | ||
47904cb7 | 809 | (use-package tex-mode |
748bd8ac AB |
810 | :config |
811 | (cl-delete-if | |
812 | (lambda (p) (string-match "^---?" (car p))) | |
0758ec38 AB |
813 | tex--prettify-symbols-alist) |
814 | :hook ((tex-mode . auto-fill-mode) | |
3457307b | 815 | (tex-mode . flyspell-mode))) |
748bd8ac | 816 | |
47904cb7 AB |
817 | ;; (use-package george-mode |
818 | ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode") | |
819 | ;; :mode "\\.grg\\'") | |
1d01c927 | 820 | |
b57457b2 | 821 | \f |
b57457b2 | 822 | ;;; Emacs enhancements & auxiliary packages |
1eb20313 | 823 | |
dca50cf5 | 824 | (use-package man |
41d290a2 AB |
825 | :config (setq Man-width 80)) |
826 | ||
827 | (use-package which-key | |
828 | :defer 0.4 | |
829 | :config | |
830 | (which-key-add-key-based-replacements | |
831 | ;; prefixes for global prefixes and minor modes | |
41d290a2 | 832 | "C-c !" "flycheck" |
b549b760 | 833 | "C-x RET" "coding system" |
41d290a2 | 834 | "C-x 8" "unicode" |
b549b760 | 835 | "C-x @" "event modifiers" |
41d290a2 AB |
836 | "C-x a" "abbrev/expand" |
837 | "C-x r" "rectangle/register/bookmark" | |
b549b760 | 838 | "C-x t" "tabs" |
41d290a2 | 839 | "C-x v" "version control" |
b549b760 AB |
840 | "C-x X" "edebug" |
841 | "C-x C-a" "edebug" | |
842 | "C-x C-k" "kmacro" | |
41d290a2 | 843 | ;; prefixes for my personal bindings |
b549b760 | 844 | "C-c &" "yasnippet" |
41d290a2 AB |
845 | "C-c a" "applications" |
846 | "C-c a e" "erc" | |
847 | "C-c a o" "org" | |
848 | "C-c a s" "shells" | |
2e81c51a | 849 | "C-c b" "buffers" |
41d290a2 AB |
850 | "C-c c" "compile-and-comments" |
851 | "C-c e" "eval" | |
852 | "C-c f" "files" | |
853 | "C-c F" "frames" | |
ef6c487c | 854 | "C-c g" "magit" |
41d290a2 | 855 | "C-S-h" "help(ful)" |
41d290a2 | 856 | "C-c q" "boxquote" |
1eb20313 | 857 | "C-c t" "themes") |
41d290a2 AB |
858 | |
859 | ;; prefixes for major modes | |
41d290a2 AB |
860 | (which-key-add-major-mode-key-based-replacements 'org-mode |
861 | "C-c C-v" "org-babel") | |
41d290a2 AB |
862 | |
863 | (which-key-mode) | |
864 | :custom | |
865 | (which-key-add-column-padding 5) | |
1eb20313 AB |
866 | (which-key-idle-delay 10000) |
867 | (which-key-idle-secondary-delay 0.05) | |
868 | (which-key-max-description-length 32) | |
869 | (which-key-show-early-on-C-h t)) | |
41d290a2 | 870 | |
1eb20313 | 871 | ;; (require 'bandali-projectile) |
41d290a2 AB |
872 | |
873 | (use-package helpful | |
1eb20313 | 874 | :disabled |
41d290a2 AB |
875 | :defer 0.6 |
876 | :bind | |
877 | (("C-S-h c" . helpful-command) | |
878 | ("C-S-h f" . helpful-callable) ; helpful-function | |
879 | ("C-S-h v" . helpful-variable) | |
880 | ("C-S-h k" . helpful-key) | |
881 | ("C-S-h p" . helpful-at-point))) | |
882 | ||
5b10d879 AB |
883 | (use-package unkillable-scratch |
884 | :defer 0.6 | |
885 | :config | |
886 | (unkillable-scratch 1) | |
887 | :custom | |
888 | (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))) | |
41d290a2 | 889 | |
5b10d879 AB |
890 | ;; ,---- |
891 | ;; | make pretty boxed quotes like this | |
892 | ;; `---- | |
893 | (use-package boxquote | |
894 | :defer 0.6 | |
895 | :bind | |
1eb20313 AB |
896 | (:prefix-map |
897 | b/boxquote-prefix-map | |
898 | :prefix "C-c q" | |
899 | ("b" . boxquote-buffer) | |
900 | ("B" . boxquote-insert-buffer) | |
901 | ("d" . boxquote-defun) | |
902 | ("F" . boxquote-insert-file) | |
903 | ("hf" . boxquote-describe-function) | |
904 | ("hk" . boxquote-describe-key) | |
905 | ("hv" . boxquote-describe-variable) | |
906 | ("hw" . boxquote-where-is) | |
907 | ("k" . boxquote-kill) | |
908 | ("p" . boxquote-paragraph) | |
909 | ("q" . boxquote-boxquote) | |
910 | ("r" . boxquote-region) | |
911 | ("s" . boxquote-shell-command) | |
912 | ("t" . boxquote-text) | |
913 | ("T" . boxquote-title) | |
914 | ("u" . boxquote-unbox) | |
915 | ("U" . boxquote-unbox-region) | |
916 | ("y" . boxquote-yank) | |
917 | ("M-q" . boxquote-fill-paragraph) | |
918 | ("M-w" . boxquote-kill-ring-save))) | |
41d290a2 | 919 | |
41d290a2 | 920 | (use-package hl-todo |
1eb20313 | 921 | ;; highlight TODOs in buffers |
41d290a2 AB |
922 | :defer 0.5 |
923 | :config | |
924 | (global-hl-todo-mode)) | |
925 | ||
41d290a2 | 926 | (use-package page-break-lines |
b57457b2 | 927 | :defer 0.5 |
2f5d8190 AB |
928 | :custom |
929 | (page-break-lines-max-width fill-column) | |
41d290a2 AB |
930 | :config |
931 | (global-page-break-lines-mode)) | |
932 | ||
933 | (use-package expand-region | |
934 | :bind ("C-=" . er/expand-region)) | |
935 | ||
1eb20313 AB |
936 | (require 'bandali-yasnippet) |
937 | ||
33273849 | 938 | (use-package debbugs |
ba45b932 AB |
939 | :bind |
940 | (("C-c D d" . debbugs-gnu) | |
8cee0db4 | 941 | ("C-c D b" . debbugs-gnu-bugs) |
ba45b932 AB |
942 | ("C-c D e" . |
943 | (lambda () | |
d6c37a13 | 944 | (interactive) ; bug-gnu-emacs |
ba45b932 AB |
945 | (setq debbugs-gnu-current-suppress t) |
946 | (debbugs-gnu debbugs-gnu-default-severities '("emacs")))) | |
d6c37a13 | 947 | ("C-c D g" . ; bug-gnuzilla |
ba45b932 AB |
948 | (lambda () |
949 | (interactive) | |
950 | (setq debbugs-gnu-current-suppress t) | |
64b53575 | 951 | (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla")))) |
d6c37a13 AB |
952 | ("C-c D G b" . ; bug-guix |
953 | (lambda () | |
954 | (interactive) | |
955 | (setq debbugs-gnu-current-suppress t) | |
956 | (debbugs-gnu debbugs-gnu-default-severities '("guix")))) | |
957 | ("C-c D G p" . ; guix-patches | |
64b53575 AB |
958 | (lambda () |
959 | (interactive) | |
960 | (setq debbugs-gnu-current-suppress t) | |
d6c37a13 | 961 | (debbugs-gnu debbugs-gnu-default-severities '("guix-patches")))))) |
41d290a2 | 962 | |
f0a2dfe1 AB |
963 | (comment |
964 | ||
41d290a2 AB |
965 | (use-package org-ref |
966 | :init | |
dca50cf5 | 967 | (b/setq-every '("~/usr/org/references.bib") |
41d290a2 AB |
968 | reftex-default-bibliography |
969 | org-ref-default-bibliography) | |
970 | (setq | |
971 | org-ref-bibliography-notes "~/usr/org/notes.org" | |
972 | org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")) | |
973 | ||
2f5d8190 AB |
974 | ;; (use-package fill-column-indicator) |
975 | ||
47904cb7 | 976 | (use-package window |
ed8c4fa9 | 977 | :bind |
0b7f98f4 | 978 | (("C-c w s l" . (lambda () |
edb03389 AB |
979 | (interactive) |
980 | (split-window-right) | |
981 | (other-window 1))) | |
982 | ("C-c w s j" . (lambda () | |
983 | (interactive) | |
984 | (split-window-below) | |
985 | (other-window 1))) | |
446cb096 | 986 | ("C-c w q" . quit-window)) |
92df6c4f AB |
987 | :custom |
988 | (split-width-threshold 150)) | |
ed8c4fa9 | 989 | |
47904cb7 | 990 | (use-package windmove |
ed8c4fa9 AB |
991 | :defer 0.6 |
992 | :bind | |
2e81c51a AB |
993 | (("C-c w h" . windmove-left) |
994 | ("C-c w j" . windmove-down) | |
995 | ("C-c w k" . windmove-up) | |
996 | ("C-c w l" . windmove-right) | |
997 | ("C-c w H" . windmove-swap-states-left) | |
998 | ("C-c w J" . windmove-swap-states-down) | |
999 | ("C-c w K" . windmove-swap-states-up) | |
1000 | ("C-c w L" . windmove-swap-states-right))) | |
ed8c4fa9 | 1001 | |
05068e71 AB |
1002 | (use-package pass |
1003 | :commands pass | |
1004 | :bind ("C-c a p" . pass) | |
1005 | :hook (pass-mode . View-exit)) | |
1006 | ||
b188e798 AB |
1007 | (use-package pdf-tools |
1008 | :defer 0.5 | |
1009 | :bind (:map pdf-view-mode-map | |
0365678c AB |
1010 | ("<C-XF86Back>" . pdf-history-backward) |
1011 | ("<mouse-8>" . pdf-history-backward) | |
1012 | ("<drag-mouse-8>" . pdf-history-backward) | |
1013 | ("<C-XF86Forward>" . pdf-history-forward) | |
1014 | ("<mouse-9>" . pdf-history-forward) | |
1015 | ("<drag-mouse-9>" . pdf-history-forward) | |
4fa43cd8 AB |
1016 | ("M-RET" . image-previous-line) |
1017 | ("C-s" . isearch-forward) | |
1018 | ("s s" . isearch-forward)) | |
822ac360 AB |
1019 | :config (pdf-tools-install nil t) |
1020 | :custom (pdf-view-resize-factor 1.05)) | |
b188e798 | 1021 | |
62a2088e | 1022 | (use-package org-pdftools |
47904cb7 | 1023 | :disabled |
62a2088e AB |
1024 | :straight (:host github :repo "fuxialexander/org-pdftools") |
1025 | :demand | |
1026 | :after org | |
1027 | :config | |
1028 | (with-eval-after-load 'org | |
1029 | (require 'org-pdftools))) | |
1030 | ||
9de75957 AB |
1031 | (use-package biblio) |
1032 | ||
47904cb7 | 1033 | (use-package reftex |
9a5ffb33 AB |
1034 | :hook (latex-mode . reftex-mode)) |
1035 | ||
47904cb7 | 1036 | (use-package reftex-cite |
9a5ffb33 AB |
1037 | :after reftex |
1038 | :disabled ; enable to disable | |
1039 | ; reftex-cite's default choice | |
1040 | ; of previous word | |
1041 | :config | |
1042 | (defun reftex-get-bibkey-default () | |
1043 | "If the cursor is in a citation macro, return the word before the macro." | |
1044 | (let* ((macro (reftex-what-macro 1))) | |
1045 | (save-excursion | |
1046 | (when (and macro (string-match "cite" (car macro))) | |
1047 | (goto-char (cdr macro))) | |
1048 | (reftex-this-word))))) | |
1049 | ||
fa9943dc | 1050 | (use-package dmenu |
fa9943dc | 1051 | :custom |
fa9943dc AB |
1052 | (dmenu-prompt-string "run: ") |
1053 | (dmenu-save-file (b/var "dmenu-items"))) | |
1054 | ||
996bebf6 AB |
1055 | (use-package eosd |
1056 | ;; TODO: fix build by properly building the eosd-pixbuf.c module | |
1057 | ;; e.g. see https://github.com/raxod502/straight.el/issues/386 | |
1058 | :disabled | |
1059 | :straight (:host github :repo "clarete/eosd") | |
1060 | :demand | |
1061 | :after exwm | |
1062 | :config | |
1063 | (eosd-start)) | |
1064 | ||
9ed5410e | 1065 | (use-package eww |
03745e6e | 1066 | :bind ("C-c a e w" . eww) |
9ed5410e AB |
1067 | :custom |
1068 | (eww-download-directory (file-name-as-directory | |
1069 | (getenv "XDG_DOWNLOAD_DIR")))) | |
1070 | ||
b57457b2 | 1071 | \f |
b57457b2 AB |
1072 | ;;; Post initialization |
1073 | ||
8b1a2f32 | 1074 | ) |
41d290a2 AB |
1075 | (message "Loading %s...done (%.3fs)" user-init-file |
1076 | (float-time (time-subtract (current-time) | |
dca50cf5 | 1077 | b/before-user-init-time))) |
41d290a2 AB |
1078 | |
1079 | ;;; init.el ends here |