1 ;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*-
3 ;; Copyright (C) 2018-2020 Amin Bandali <bandali@gnu.org>
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.
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.
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/>.
20 ;; GNU Emacs configuration of Amin Bandali, computer scientist,
21 ;; Free Software activist, and GNU maintainer & webmaster. Packages
22 ;; are installed through using Borg for a fully reproducible setup.
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:
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
38 ;;; Emacs initialization
40 (defvar b
/before-user-init-time
(current-time)
41 "Value of `current-time' when Emacs begins loading `user-init-file'.")
42 (defvar b
/emacs-initialized nil
43 "Whether Emacs has been initialized.")
44 (defvar b
/exwm-p
(string= (system-name) "chaman")
45 "Whether or not we will be using `exwm'.")
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
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.
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
)
58 (setq gc-cons-threshold
(* 30 1024 1024) ; 30 MiB
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)
64 ;; set them back to their defaults once we're done initializing
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
70 file-name-handler-alist b
/file-name-handler-alist
)
72 (with-eval-after-load 'exwm-workspace
79 "[%s]" (number-to-string
80 exwm-workspace-current-index
)))))))))
81 (add-hook 'after-init-hook
#'b
/post-init
)
83 ;; increase number of lines kept in *Messages* log
84 (setq message-log-max
20000)
86 ;; optionally, uncomment to supress some byte-compiler warnings
87 ;; (see C-h v byte-compile-warnings RET for more info)
88 ;; (setq byte-compile-warnings
89 ;; '(not free-vars unresolved noruntime lexical make-local))
94 (setq user-full-name
"Amin Bandali"
95 user-mail-address
"bandali@gnu.org")
98 ;;; Package management
101 (add-to-list 'load-path
102 (expand-file-name "lib/borg" user-emacs-directory
))
105 (setq borg-rewrite-urls-alist
106 '(("git@github.com:" .
"https://github.com/")
107 ("git@gitlab.com:" .
"https://gitlab.com/"))))
110 (if nil
; set to t when need to debug init
112 (setq use-package-verbose t
113 use-package-expand-minimally nil
114 use-package-compute-statistics t
116 (require 'use-package
))
117 (setq use-package-verbose nil
118 use-package-expand-minimally t
))
120 (setq use-package-always-defer t
)
126 ;; keep ~/.emacs.d clean
127 (use-package no-littering
130 (defalias 'b
/etc
'no-littering-expand-etc-file-name
)
131 (defalias 'b
/var
'no-littering-expand-var-file-name
))
133 (use-package auto-compile
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
))
144 ;; separate custom file (don't want it mixing with init.el)
148 (setq custom-file
(b/etc
"custom.el"))
149 (when (file-exists-p custom-file
)
151 ;; while at it, treat themes as safe
152 (setf custom-safe-themes t
)
153 ;; only one custom theme at a time
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
))))
159 ;; load the secrets file if it exists, otherwise show a warning
162 (load (b/etc
"secrets"))))
164 ;; start up emacs server. see
165 ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server
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)))
177 ;;;; C-level customizations
181 enable-recursive-minibuffers t
182 resize-mini-windows t
183 ;; more useful frame titles
184 frame-title-format
'("" invocation-name
" - "
186 (if (buffer-file-name)
187 (abbreviate-file-name (buffer-file-name))
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
194 ;; scroll-conservatively 10000
196 scroll-conservatively
101
197 scroll-preserve-screen-position
1
198 ;; focus follows mouse
199 mouse-autoselect-window t
)
202 ;; always use space for indentation
205 ;; case-sensitive search (and `dabbrev-expand')
206 ;; case-fold-search nil
212 (dolist (ft (fontset-list))
216 (font-spec :name
"Source Code Pro" :size
14))
220 (font-spec :name
"DejaVu Sans Mono")
227 ;; :name "Symbola monospacified for DejaVu Sans Mono")
233 ;; (font-spec :name "DejaVu Sans Mono")
239 (font-spec :name
"DejaVu Sans Mono" :size
14)
243 ;;;; Elisp-level customizations
249 ;; don't need to see the startup echo area message
250 (advice-add #'display-startup-echo-area-message
:override
#'ignore
)
252 ;; i want *scratch* as my startup buffer
253 (initial-buffer-choice t
)
254 ;; i don't need the default hint
255 (initial-scratch-message nil
)
256 ;; use customizable text-mode as major mode for *scratch*
257 ;; (initial-major-mode 'text-mode)
258 ;; inhibit buffer list when more than 2 files are loaded
259 (inhibit-startup-buffer-menu t
)
260 ;; don't need to see the startup screen or echo area message
261 (inhibit-startup-screen t
)
262 (inhibit-startup-echo-area-message user-login-name
))
268 ;; backups (C-h v make-backup-files RET)
269 (backup-by-copying t
)
271 (delete-old-versions t
)
274 (auto-save-file-name-transforms
275 `((".*" ,(b/var
"auto-save/") t
)))
277 ;; insert newline at the end of files
278 (require-final-newline t
)
280 ;; open read-only file buffers in view-mode
281 ;; (enables niceties like `q' for quit)
284 ;; disable disabled commands
285 (setq disabled-command-function nil
)
287 ;; lazy-person-friendly yes/no prompts
288 (defalias 'yes-or-no-p
#'y-or-n-p
)
290 ;; enable automatic reloading of changed buffers and files
291 (use-package autorevert
294 (global-auto-revert-mode 1)
296 (auto-revert-verbose nil
)
297 (global-auto-revert-non-file-buffers nil
))
299 ;; time and battery in mode-line
305 (display-time-default-load-average nil
)
306 (display-time-format " %a %b %-e %-l:%M%P")
307 (display-time-mail-icon '(image :type xpm
:file
"gnus/gnus-pointer.xpm" :ascent center
))
308 (display-time-use-mail-icon t
))
313 (display-battery-mode)
315 (battery-mode-line-format "%p%% %t"))
321 ;; (fringe-mode '(3 . 1))
327 ;; enable winner-mode (C-h f winner-mode RET)
332 ;; don't display *compilation* buffer on success. based on
333 ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
334 ;; instead of the now obsolete `flet'.
335 (defun b/compilation-finish-function
(buffer outstr
)
336 (unless (string-match "finished" outstr
)
337 (switch-to-buffer-other-window buffer
))
340 (setq compilation-finish-functions
#'b
/compilation-finish-function
)
344 (defadvice compilation-start
345 (around inhibit-display
346 (command &optional mode name-function highlight-regexp
))
347 (if (not (string-match "^\\(find\\|grep\\)" command
))
348 (cl-letf (((symbol-function 'display-buffer
) #'ignore
))
349 (save-window-excursion ad-do-it
))
351 (ad-activate 'compilation-start
))
355 ;; allow scrolling in Isearch
356 (isearch-allow-scroll t
)
357 ;; search for non-ASCII characters: i’d like non-ASCII characters such
358 ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII
359 ;; counterpart. shoutout to
360 ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html
361 (search-default-mode #'char-fold-to-regexp
))
363 ;; uncomment to extend the above behaviour to query-replace
367 (replace-char-fold t
)))
370 :bind
("C-x v C-=" . vc-ediff
))
375 (vc-git-print-log-follow t
))
378 :config
(add-hook 'ediff-after-quit-hook-internal
'winner-undo
)
379 :custom
((ediff-window-setup-function 'ediff-setup-windows-plain
)
380 (ediff-split-window-function 'split-window-horizontally
)))
382 (use-package face-remap
384 ;; gentler font resizing
385 (text-scale-mode-step 1.05))
390 (setq mouse-wheel-scroll-amount
'(1 ((shift) .
1)) ; one line at a time
391 mouse-wheel-progressive-speed nil
; don't accelerate scrolling
392 mouse-wheel-follow-mouse t
)) ; scroll window under mouse
394 (use-package pixel-scroll
396 :config
(pixel-scroll-mode 1))
398 (use-package epg-config
400 ;; ask for GPG passphrase in minibuffer
401 ;; this will fail if gpg>=2.1 is not available
402 (setq epg-pinentry-mode
'loopback
)
404 (epg-gpg-program (executable-find "gpg")))
409 (use-package pinentry
412 :after
(epa epg server
)
414 ;; workaround for systemd-based distros:
415 ;; (setq pinentry--socket-dir server-socket-dir)
418 (use-package auth-source
420 (auth-sources '("~/.authinfo.gpg"))
421 (authinfo-hidden (regexp-opt '("password" "client-secret" "token"))))
427 ("C-a" . b
/move-indentation-or-beginning-of-line
)
429 ("C-c d" . b
/duplicate-line-or-region
)
431 ("C-c e b" . eval-buffer
)
432 ("C-c e e" . eval-last-sexp
)
433 ("C-c e p" . pp-macroexpand-last-sexp
)
434 ("C-c e r" . eval-region
)
436 ("C-c e i" . emacs-init-time
)
437 ("C-c e u" . emacs-uptime
)
438 ("C-c e v" . emacs-version
)
440 ("C-c f ." . find-file
)
441 ("C-c f d" . find-name-dired
)
442 ("C-c f l" . find-library
)
444 ("C-c F m" . make-frame-command
)
445 ("C-c F d" . delete-frame
)
447 ("C-S-h C" . describe-char
)
448 ("C-S-h F" . describe-face
)
450 ("C-S-j" . b
/join-line-top
)
452 ("C-c x" . execute-extended-command
)
454 ("C-x k" . b
/kill-current-buffer
)
455 ("C-x K" . kill-buffer
)
456 ("C-x s" . save-buffer
)
457 ("C-x S" . save-some-buffers
)
459 :map emacs-lisp-mode-map
460 ("<C-return>" . b
/add-elisp-section
))
462 (when (display-graphic-p)
463 (unbind-key "C-z" global-map
))
466 ;; for back and forward mouse keys
467 ("<XF86Back>" . previous-buffer
)
468 ("<mouse-8>" . previous-buffer
)
469 ;; ("<drag-mouse-8>" . previous-buffer)
470 ("<XF86Forward>" . next-buffer
)
471 ("<mouse-9>" . next-buffer
)
472 ;; ("<drag-mouse-9>" . next-buffer)
473 ;; ("<drag-mouse-2>" . kill-this-buffer)
474 ;; ("<drag-mouse-3>" . switch-to-buffer)
478 ;;; Essential packages
481 (require 'bandali-exwm
))
483 (require 'bandali-org
)
485 (require 'bandali-theme
)
487 ;; *the* right way to do git
489 :bind
(("C-x g" . magit-status
)
490 ("C-c g g" . magit-status
)
491 ("C-c g b" . magit-blame-addition
)
492 ("C-c g l" . magit-log-buffer-file
))
494 (declare-function magit-add-section-hook
"magit-section"
495 (hook function
&optional at append local
))
496 (magit-add-section-hook 'magit-status-sections-hook
497 'magit-insert-modules
498 'magit-insert-stashes
500 ;; (magit-add-section-hook 'magit-status-sections-hook
501 ;; 'magit-insert-ignored-files
502 ;; 'magit-insert-untracked-files
504 (setq magit-repository-directories
'(("~/.emacs.d/" .
0)
506 (nconc magit-section-initial-visibility-alist
507 '(([unpulled status
] . show
)
508 ([unpushed status
] . show
)))
509 (declare-function magit-display-buffer-fullframe-status-v1
"magit-mode" (buffer))
511 (magit-diff-refine-hunk t
)
512 (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1
)
513 ;; (magit-completing-read-function 'magit-ido-completing-read)
514 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
516 ;; recently opened files
520 (add-to-list 'recentf-keep
'file-remote-p
)
524 (recentf-max-saved-items 2000))
526 ;; needed for history for counsel
532 ;; (require 'bandali-ido)
533 (require 'bandali-ivy
)
535 (require 'bandali-eshell
)
536 ;; (require 'bandali-multi-term)
538 (require 'bandali-ibuffer
)
542 :hook
(prog-mode . outline-minor-mode
)
545 outline-minor-mode-map
546 ("<s-tab>" . outline-toggle-children
)
547 ("M-p" . outline-previous-visible-heading
)
548 ("M-n" . outline-next-visible-heading
)
549 :prefix-map b
/outline-prefix-map
551 ("TAB" . outline-toggle-children
)
552 ("a" . outline-hide-body
)
553 ("H" . outline-hide-body
)
554 ("S" . outline-show-all
)
555 ("h" . outline-hide-subtree
)
556 ("s" . outline-show-subtree
))
558 (when (featurep 'which-key
)
559 (which-key-add-key-based-replacements
563 (require 'bandali-dired
)
568 ("p" . backward-button
)
569 ("n" . forward-button
))
571 (temp-buffer-resize-mode)
572 (setq help-window-select t
))
576 (add-to-list 'tramp-default-proxies-alist
'(nil "\\`root\\'" "/ssh:%h:"))
577 (add-to-list 'tramp-default-proxies-alist
'("localhost" nil nil
))
578 (add-to-list 'tramp-default-proxies-alist
579 (list (regexp-quote (system-name)) nil nil
)))
581 (use-package doc-view
582 :bind
(:map doc-view-mode-map
583 ("M-RET" . image-previous-line
)))
585 ;; Email (with Gnus, message, and EBDB)
586 (require 'bandali-gnus
)
587 (use-package sendmail
589 (setq sendmail-program
(executable-find "msmtp")
590 ;; message-sendmail-extra-arguments '("-v" "-d")
591 mail-specify-envelope-from t
592 mail-envelope-from
'header
))
593 (require 'bandali-message
)
594 (require 'bandali-ebdb
)
596 ;; IRC (with ERC and ZNC)
597 (require 'bandali-erc
)
601 (setq scpaste-http-destination
"https://p.bndl.org"
602 scpaste-scp-destination
"p:~"))
607 ;; highlight uncommitted changes in the left fringe
612 (setq diff-hl-draw-borders nil
)
613 (global-diff-hl-mode)
615 ((magit-pre-refresh . diff-hl-magit-pre-refresh
)
616 (magit-post-refresh . diff-hl-magit-post-refresh
)))
618 ;; display Lisp objects at point in the echo area
620 :when
(version< "25" emacs-version
)
621 :config
(global-eldoc-mode))
623 ;; highlight matching parens
626 :config
(show-paren-mode))
628 (use-package elec-pair
630 :config
(electric-pair-mode))
633 :config
(column-number-mode)
635 ;; Save what I copy into clipboard from other applications into Emacs'
636 ;; kill-ring, which would allow me to still be able to easily access
637 ;; it in case I kill (cut or copy) something else inside Emacs before
638 ;; yanking (pasting) what I'd originally intended to.
639 (save-interprogram-paste-before-kill t
))
641 ;; save minibuffer history
642 (use-package savehist
646 (add-to-list 'savehist-additional-variables
'kill-ring
))
648 ;; automatically save place in files
649 (use-package saveplace
650 :when
(version< "25" emacs-version
)
651 :config
(save-place-mode))
653 (use-package prog-mode
654 :config
(global-prettify-symbols-mode)
655 (defun indicate-buffer-boundaries-left ()
656 (setq indicate-buffer-boundaries
'left
))
657 (add-hook 'prog-mode-hook
#'indicate-buffer-boundaries-left
))
659 (use-package text-mode
660 :bind
(:map text-mode-map
("C-*" . b
/insert-asterism
))
661 :hook
((text-mode . indicate-buffer-boundaries-left
)
662 (text-mode . flyspell-mode
)))
664 (use-package conf-mode
667 (use-package sh-script
668 :mode
("\\.bashrc$" . sh-mode
))
673 (:map company-active-map
674 ([tab] . company-complete-common-or-cycle)
675 ([escape] . company-abort)
676 ("C-p" . company-select-previous-or-abort)
677 ("C-n" . company-select-next-or-abort))
679 (company-minimum-prefix-length 1)
680 (company-selection-wrap-around t)
681 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
682 (company-dabbrev-downcase nil)
683 (company-dabbrev-ignore-case nil)
685 ;; (global-company-mode t)
688 (use-package flycheck
691 :hook (prog-mode . flycheck-mode)
693 (:map flycheck-mode-map
694 ("M-P" . flycheck-previous-error)
695 ("M-N" . flycheck-next-error))
697 ;; Use the load-path from running Emacs when checking elisp files
698 (setq flycheck-emacs-lisp-load-path 'inherit)
700 ;; Only flycheck when I actually save the buffer
701 (setq flycheck-check-syntax-automatically '(mode-enabled save))
702 :custom (flycheck-mode-line-prefix "flyc"))
704 ;; (use-package flyspell)
706 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
711 ;; ’ can be part of a word
712 (setq ispell-local-dictionary-alist
713 `((nil "[[:alpha:]]" "[^[:alpha:]]"
714 "['\x2019]" nil ("-B") nil utf-8))
715 ispell-program-name (executable-find "hunspell"))
716 ;; don't send ’ to the subprocess
717 (defun endless/replace-apostrophe (args)
718 (cons (replace-regexp-in-string
721 (advice-add #'ispell-send-string :filter-args
722 #'endless/replace-apostrophe)
724 ;; convert ' back to ’ from the subprocess
725 (defun endless/replace-quote (args)
726 (if (not (derived-mode-p 'org-mode))
728 (cons (replace-regexp-in-string
731 (advice-add #'ispell-parse-output :filter-args
732 #'endless/replace-quote))
735 :hook (text-mode . abbrev-mode))
738 ;;; Programming modes
740 (use-package lisp-mode
742 (defun indent-spaces-mode ()
743 (setq indent-tabs-mode nil))
744 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
746 (use-package alloy-mode
747 :mode "\\.\\(als\\|dsh\\)\\'"
749 (setq alloy-basic-offset 2)
750 ;; (defun b/alloy-simple-indent (start end)
752 ;; ;; (if (region-active-p)
753 ;; ;; (indent-rigidly start end alloy-basic-offset)
755 ;; ;; (indent-rigidly (line-beginning-position)
756 ;; ;; (line-end-position)
757 ;; ;; alloy-basic-offset)))
758 ;; (indent-to (+ (current-column) alloy-basic-offset)))
759 :bind (:map alloy-mode-map
760 ("RET" . electric-newline-and-maybe-indent)
761 ;; ("TAB" . b/alloy-simple-indent)
762 ("TAB" . indent-for-tab-command))
763 :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil))))
765 (use-package lean-mode
768 :init (eval-when-compile (defvar lean-mode-map))
769 :bind (:map lean-mode-map
770 ("S-SPC" . company-complete))
772 (require 'lean-input)
773 (setq default-input-method "Lean"
774 lean-input-tweak-all '(lean-input-compose
775 (lean-input-prepend "/")
776 (lean-input-nonempty))
777 lean-input-user-translations '(("/" "/")))
780 (use-package sgml-mode
782 (setq sgml-basic-offset 0))
784 (use-package css-mode
786 (setq css-indent-offset 2))
791 (use-package geiser-guile
794 (setq geiser-guile-load-path "~/src/git/guix"))
805 (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit))))
810 (font-latex-fontify-sectioning 'color))
812 (use-package tex-mode
815 (lambda (p) (string-match "^---?" (car p)))
816 tex--prettify-symbols-alist)
817 :hook ((tex-mode . auto-fill-mode)
818 (tex-mode . flyspell-mode)))
820 ;; (use-package george-mode
821 ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode")
822 ;; :mode "\\.grg\\'")
825 ;;; Emacs enhancements & auxiliary packages
828 :config (setq Man-width 80))
830 (use-package which-key
833 (which-key-add-key-based-replacements
834 ;; prefixes for global prefixes and minor modes
836 "C-x RET" "coding system"
838 "C-x @" "event modifiers"
839 "C-x a" "abbrev/expand"
840 "C-x r" "rectangle/register/bookmark"
842 "C-x v" "version control"
846 ;; prefixes for my personal bindings
848 "C-c a" "applications"
853 "C-c c" "compile-and-comments"
862 ;; prefixes for major modes
863 (which-key-add-major-mode-key-based-replacements 'org-mode
864 "C-c C-v" "org-babel")
868 (which-key-add-column-padding 5)
869 (which-key-idle-delay 10000)
870 (which-key-idle-secondary-delay 0.05)
871 (which-key-max-description-length 32)
872 (which-key-show-early-on-C-h t))
874 ;; (require 'bandali-projectile)
880 (("C-S-h c" . helpful-command)
881 ("C-S-h f" . helpful-callable) ; helpful-function
882 ("C-S-h v" . helpful-variable)
883 ("C-S-h k" . helpful-key)
884 ("C-S-h p" . helpful-at-point)))
886 (use-package unkillable-scratch
889 (unkillable-scratch 1)
891 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
894 ;; | make pretty boxed quotes like this
896 (use-package boxquote
900 b/boxquote-prefix-map
902 ("b" . boxquote-buffer)
903 ("B" . boxquote-insert-buffer)
904 ("d" . boxquote-defun)
905 ("F" . boxquote-insert-file)
906 ("hf" . boxquote-describe-function)
907 ("hk" . boxquote-describe-key)
908 ("hv" . boxquote-describe-variable)
909 ("hw" . boxquote-where-is)
910 ("k" . boxquote-kill)
911 ("p" . boxquote-paragraph)
912 ("q" . boxquote-boxquote)
913 ("r" . boxquote-region)
914 ("s" . boxquote-shell-command)
915 ("t" . boxquote-text)
916 ("T" . boxquote-title)
917 ("u" . boxquote-unbox)
918 ("U" . boxquote-unbox-region)
919 ("y" . boxquote-yank)
920 ("M-q" . boxquote-fill-paragraph)
921 ("M-w" . boxquote-kill-ring-save)))
924 ;; highlight TODOs in buffers
927 (global-hl-todo-mode))
929 (use-package page-break-lines
932 (page-break-lines-max-width fill-column)
934 (global-page-break-lines-mode))
936 (use-package expand-region
937 :bind ("C-=" . er/expand-region))
939 (require 'bandali-yasnippet)
943 (("C-c D d" . debbugs-gnu)
944 ("C-c D b" . debbugs-gnu-bugs)
947 (interactive) ; bug-gnu-emacs
948 (setq debbugs-gnu-current-suppress t)
949 (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
950 ("C-c D g" . ; bug-gnuzilla
953 (setq debbugs-gnu-current-suppress t)
954 (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
955 ("C-c D G b" . ; bug-guix
958 (setq debbugs-gnu-current-suppress t)
959 (debbugs-gnu debbugs-gnu-default-severities '("guix"))))
960 ("C-c D G p" . ; guix-patches
963 (setq debbugs-gnu-current-suppress t)
964 (debbugs-gnu debbugs-gnu-default-severities '("guix-patches"))))))
970 (b/setq-every '("~/usr/org/references.bib")
971 reftex-default-bibliography
972 org-ref-default-bibliography)
974 org-ref-bibliography-notes "~/usr/org/notes.org"
975 org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
977 ;; (use-package fill-column-indicator)
981 (("C-c w s l" . (lambda ()
985 ("C-c w s j" . (lambda ()
989 ("C-c w q" . quit-window))
991 (split-width-threshold 150))
993 (use-package windmove
996 (("C-c w h" . windmove-left)
997 ("C-c w j" . windmove-down)
998 ("C-c w k" . windmove-up)
999 ("C-c w l" . windmove-right)
1000 ("C-c w H" . windmove-swap-states-left)
1001 ("C-c w J" . windmove-swap-states-down)
1002 ("C-c w K" . windmove-swap-states-up)
1003 ("C-c w L" . windmove-swap-states-right)))
1007 :bind ("C-c a p" . pass)
1008 :hook (pass-mode . View-exit))
1010 (use-package pdf-tools
1012 :bind (:map pdf-view-mode-map
1013 ("<C-XF86Back>" . pdf-history-backward)
1014 ("<mouse-8>" . pdf-history-backward)
1015 ("<drag-mouse-8>" . pdf-history-backward)
1016 ("<C-XF86Forward>" . pdf-history-forward)
1017 ("<mouse-9>" . pdf-history-forward)
1018 ("<drag-mouse-9>" . pdf-history-forward)
1019 ("M-RET" . image-previous-line)
1020 ("C-s" . isearch-forward)
1021 ("s s" . isearch-forward))
1022 :config (pdf-tools-install nil t)
1023 :custom (pdf-view-resize-factor 1.05))
1025 (use-package org-pdftools
1027 :straight (:host github :repo "fuxialexander/org-pdftools")
1031 (with-eval-after-load 'org
1032 (require 'org-pdftools)))
1034 (use-package biblio)
1037 :hook (latex-mode . reftex-mode))
1039 (use-package reftex-cite
1041 :disabled ; enable to disable
1042 ; reftex-cite's default choice
1045 (defun reftex-get-bibkey-default ()
1046 "If the cursor is in a citation macro, return the word before the macro."
1047 (let* ((macro (reftex-what-macro 1)))
1049 (when (and macro (string-match "cite" (car macro)))
1050 (goto-char (cdr macro)))
1051 (reftex-this-word)))))
1055 (dmenu-prompt-string "run: ")
1056 (dmenu-save-file (b/var "dmenu-items")))
1059 ;; TODO: fix build by properly building the eosd-pixbuf.c module
1060 ;; e.g. see https://github.com/raxod502/straight.el/issues/386
1062 :straight (:host github :repo "clarete/eosd")
1069 :bind ("C-c a e w" . eww)
1071 (eww-download-directory (file-name-as-directory
1072 (getenv "XDG_DOWNLOAD_DIR"))))
1075 ;;; Post initialization
1078 (message "Loading %s...done (%.3fs)" user-init-file
1079 (float-time (time-subtract (current-time)
1080 b/before-user-init-time)))
1082 ;;; init.el ends here