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
210 (dolist (ft (fontset-list))
214 (font-spec :name
"Source Code Pro" :size
14))
218 (font-spec :name
"DejaVu Sans Mono")
225 ;; :name "Symbola monospacified for DejaVu Sans Mono")
231 ;; (font-spec :name "DejaVu Sans Mono")
237 (font-spec :name
"DejaVu Sans Mono" :size
14)
241 ;;;; Elisp-level customizations
247 ;; don't need to see the startup echo area message
248 (advice-add #'display-startup-echo-area-message
:override
#'ignore
)
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*
255 ;; (initial-major-mode 'text-mode)
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
))
266 ;; backups (C-h v make-backup-files RET)
267 (backup-by-copying t
)
269 (delete-old-versions t
)
272 (auto-save-file-name-transforms
273 `((".*" ,(b/var
"auto-save/") t
)))
275 ;; insert newline at the end of files
276 (require-final-newline t
)
278 ;; open read-only file buffers in view-mode
279 ;; (enables niceties like `q' for quit)
282 ;; disable disabled commands
283 (setq disabled-command-function nil
)
285 ;; lazy-person-friendly yes/no prompts
286 (defalias 'yes-or-no-p
#'y-or-n-p
)
288 ;; enable automatic reloading of changed buffers and files
289 (use-package autorevert
292 (global-auto-revert-mode 1)
294 (auto-revert-verbose nil
)
295 (global-auto-revert-non-file-buffers nil
))
297 ;; time and battery in mode-line
303 (display-time-default-load-average nil
)
304 (display-time-format " %a %b %-e %-l:%M%P")
305 (display-time-mail-icon '(image :type xpm
:file
"gnus/gnus-pointer.xpm" :ascent center
))
306 (display-time-use-mail-icon t
))
311 (display-battery-mode)
313 (battery-mode-line-format "%p%% %t"))
319 ;; (fringe-mode '(3 . 1))
325 ;; enable winner-mode (C-h f winner-mode RET)
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'.
333 (defun b/compilation-finish-function
(buffer outstr
)
334 (unless (string-match "finished" outstr
)
335 (switch-to-buffer-other-window buffer
))
338 (setq compilation-finish-functions
#'b
/compilation-finish-function
)
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
))
349 (ad-activate 'compilation-start
))
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
))
361 ;; uncomment to extend the above behaviour to query-replace
365 (replace-char-fold t
)))
368 :bind
("C-x v C-=" . vc-ediff
))
373 (vc-git-print-log-follow t
))
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
)))
380 (use-package face-remap
382 ;; gentler font resizing
383 (text-scale-mode-step 1.05))
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
392 (use-package pixel-scroll
394 :config
(pixel-scroll-mode 1))
396 (use-package epg-config
398 ;; ask for GPG passphrase in minibuffer
399 ;; this will fail if gpg>=2.1 is not available
400 (setq epg-pinentry-mode
'loopback
)
402 (epg-gpg-program (executable-find "gpg")))
407 (use-package pinentry
410 :after
(epa epg server
)
412 ;; workaround for systemd-based distros:
413 ;; (setq pinentry--socket-dir server-socket-dir)
416 (use-package auth-source
418 (auth-sources '("~/.authinfo.gpg"))
419 (authinfo-hidden (regexp-opt '("password" "client-secret" "token"))))
425 ("C-a" . b
/move-indentation-or-beginning-of-line
)
427 ("C-c d" . b
/duplicate-line-or-region
)
429 ("C-c e b" . eval-buffer
)
430 ("C-c e e" . eval-last-sexp
)
431 ("C-c e p" . pp-macroexpand-last-sexp
)
432 ("C-c e r" . eval-region
)
434 ("C-c e i" . emacs-init-time
)
435 ("C-c e u" . emacs-uptime
)
436 ("C-c e v" . emacs-version
)
438 ("C-c f ." . find-file
)
439 ("C-c f d" . find-name-dired
)
440 ("C-c f l" . find-library
)
442 ("C-c F m" . make-frame-command
)
443 ("C-c F d" . delete-frame
)
445 ("C-S-h C" . describe-char
)
446 ("C-S-h F" . describe-face
)
448 ("C-S-j" . b
/join-line-top
)
450 ("C-c x" . execute-extended-command
)
452 ("C-x k" . b
/kill-current-buffer
)
453 ("C-x K" . kill-buffer
)
454 ("C-x s" . save-buffer
)
455 ("C-x S" . save-some-buffers
)
457 :map emacs-lisp-mode-map
458 ("<C-return>" . b
/add-elisp-section
))
460 (when (display-graphic-p)
461 (unbind-key "C-z" global-map
))
464 ;; for back and forward mouse keys
465 ("<XF86Back>" . previous-buffer
)
466 ("<mouse-8>" . previous-buffer
)
467 ;; ("<drag-mouse-8>" . previous-buffer)
468 ("<XF86Forward>" . next-buffer
)
469 ("<mouse-9>" . next-buffer
)
470 ;; ("<drag-mouse-9>" . next-buffer)
471 ;; ("<drag-mouse-2>" . kill-this-buffer)
472 ;; ("<drag-mouse-3>" . switch-to-buffer)
476 ;;; Essential packages
479 (require 'bandali-exwm
))
481 (require 'bandali-org
)
483 (require 'bandali-theme
)
485 ;; *the* right way to do git
487 :bind
(("C-x g" . magit-status
)
488 ("C-c g g" . magit-status
)
489 ("C-c g b" . magit-blame-addition
)
490 ("C-c g l" . magit-log-buffer-file
))
492 (declare-function magit-add-section-hook
"magit-section"
493 (hook function
&optional at append local
))
494 (magit-add-section-hook 'magit-status-sections-hook
495 'magit-insert-modules
496 'magit-insert-stashes
498 ;; (magit-add-section-hook 'magit-status-sections-hook
499 ;; 'magit-insert-ignored-files
500 ;; 'magit-insert-untracked-files
502 (setq magit-repository-directories
'(("~/.emacs.d/" .
0)
504 (nconc magit-section-initial-visibility-alist
505 '(([unpulled status
] . show
)
506 ([unpushed status
] . show
)))
507 (declare-function magit-display-buffer-fullframe-status-v1
"magit-mode" (buffer))
509 (magit-diff-refine-hunk t
)
510 (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1
)
511 ;; (magit-completing-read-function 'magit-ido-completing-read)
512 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
514 ;; recently opened files
518 (add-to-list 'recentf-keep
'file-remote-p
)
522 (recentf-max-saved-items 2000))
524 ;; needed for history for counsel
530 ;; (require 'bandali-ido)
531 (require 'bandali-ivy
)
533 (require 'bandali-eshell
)
534 ;; (require 'bandali-multi-term)
536 (require 'bandali-ibuffer
)
540 :hook
(prog-mode . outline-minor-mode
)
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
)
547 :prefix-map b
/outline-prefix-map
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
)
554 ("s" . outline-show-subtree
))
556 (when (featurep 'which-key
)
557 (which-key-add-key-based-replacements
561 (require 'bandali-dired
)
566 ("p" . backward-button
)
567 ("n" . forward-button
))
569 (temp-buffer-resize-mode)
570 (setq help-window-select t
))
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
)))
579 (use-package doc-view
580 :bind
(:map doc-view-mode-map
581 ("M-RET" . image-previous-line
)))
583 ;; Email (with Gnus, message, and EBDB)
584 (require 'bandali-gnus
)
585 (use-package sendmail
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
))
591 (require 'bandali-message
)
592 (require 'bandali-ebdb
)
594 ;; IRC (with ERC and ZNC)
595 (require 'bandali-erc
)
599 (setq scpaste-http-destination
"https://p.bndl.org"
600 scpaste-scp-destination
"p:~"))
605 ;; highlight uncommitted changes in the left fringe
609 (setq diff-hl-draw-borders nil
)
610 (global-diff-hl-mode)
612 ((magit-pre-refresh . diff-hl-magit-pre-refresh
)
613 (magit-post-refresh . diff-hl-magit-post-refresh
)))
615 ;; display Lisp objects at point in the echo area
617 :when
(version< "25" emacs-version
)
618 :config
(global-eldoc-mode))
620 ;; highlight matching parens
623 :config
(show-paren-mode))
625 (use-package elec-pair
627 :config
(electric-pair-mode))
630 :config
(column-number-mode)
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
))
638 ;; save minibuffer history
639 (use-package savehist
643 (add-to-list 'savehist-additional-variables
'kill-ring
))
645 ;; automatically save place in files
646 (use-package saveplace
647 :when
(version< "25" emacs-version
)
648 :config
(save-place-mode))
650 (use-package prog-mode
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
))
656 (use-package text-mode
657 :bind
(:map text-mode-map
("C-*" . b
/insert-asterism
))
658 :hook
((text-mode . indicate-buffer-boundaries-left
)
659 (text-mode . flyspell-mode
)))
661 (use-package conf-mode
664 (use-package sh-script
665 :mode
("\\.bashrc$" . sh-mode
))
670 (:map company-active-map
671 ([tab] . company-complete-common-or-cycle)
672 ([escape] . company-abort)
673 ("C-p" . company-select-previous-or-abort)
674 ("C-n" . company-select-next-or-abort))
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)
682 ;; (global-company-mode t)
685 (use-package flycheck
688 :hook (prog-mode . flycheck-mode)
690 (:map flycheck-mode-map
691 ("M-P" . flycheck-previous-error)
692 ("M-N" . flycheck-next-error))
694 ;; Use the load-path from running Emacs when checking elisp files
695 (setq flycheck-emacs-lisp-load-path 'inherit)
697 ;; Only flycheck when I actually save the buffer
698 (setq flycheck-check-syntax-automatically '(mode-enabled save))
699 :custom (flycheck-mode-line-prefix "flyc"))
701 ;; (use-package flyspell)
703 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
708 ;; ’ can be part of a word
709 (setq ispell-local-dictionary-alist
710 `((nil "[[:alpha:]]" "[^[:alpha:]]"
711 "['\x2019]" nil ("-B") nil utf-8))
712 ispell-program-name (executable-find "hunspell"))
713 ;; don't send ’ to the subprocess
714 (defun endless/replace-apostrophe (args)
715 (cons (replace-regexp-in-string
718 (advice-add #'ispell-send-string :filter-args
719 #'endless/replace-apostrophe)
721 ;; convert ' back to ’ from the subprocess
722 (defun endless/replace-quote (args)
723 (if (not (derived-mode-p 'org-mode))
725 (cons (replace-regexp-in-string
728 (advice-add #'ispell-parse-output :filter-args
729 #'endless/replace-quote))
732 :hook (text-mode . abbrev-mode))
735 ;;; Programming modes
737 (use-package lisp-mode
739 (defun indent-spaces-mode ()
740 (setq indent-tabs-mode nil))
741 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
743 (use-package alloy-mode
744 :mode "\\.\\(als\\|dsh\\)\\'"
746 (setq alloy-basic-offset 2)
747 ;; (defun b/alloy-simple-indent (start end)
749 ;; ;; (if (region-active-p)
750 ;; ;; (indent-rigidly start end alloy-basic-offset)
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))))
762 (use-package lean-mode
765 :init (eval-when-compile (defvar lean-mode-map))
766 :bind (:map lean-mode-map
767 ("S-SPC" . company-complete))
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 '(("/" "/")))
777 (use-package sgml-mode
779 (setq sgml-basic-offset 0))
781 (use-package css-mode
783 (setq css-indent-offset 2))
788 (use-package geiser-guile
791 (setq geiser-guile-load-path "~/src/git/guix"))
802 (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit))))
807 (font-latex-fontify-sectioning 'color))
809 (use-package tex-mode
812 (lambda (p) (string-match "^---?" (car p)))
813 tex--prettify-symbols-alist)
814 :hook ((tex-mode . auto-fill-mode)
815 (tex-mode . flyspell-mode)))
817 ;; (use-package george-mode
818 ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode")
819 ;; :mode "\\.grg\\'")
822 ;;; Emacs enhancements & auxiliary packages
825 :config (setq Man-width 80))
827 (use-package which-key
830 (which-key-add-key-based-replacements
831 ;; prefixes for global prefixes and minor modes
833 "C-x RET" "coding system"
835 "C-x @" "event modifiers"
836 "C-x a" "abbrev/expand"
837 "C-x r" "rectangle/register/bookmark"
839 "C-x v" "version control"
843 ;; prefixes for my personal bindings
845 "C-c a" "applications"
850 "C-c c" "compile-and-comments"
859 ;; prefixes for major modes
860 (which-key-add-major-mode-key-based-replacements 'org-mode
861 "C-c C-v" "org-babel")
865 (which-key-add-column-padding 5)
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))
871 ;; (require 'bandali-projectile)
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)))
883 (use-package unkillable-scratch
886 (unkillable-scratch 1)
888 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
891 ;; | make pretty boxed quotes like this
893 (use-package boxquote
897 b/boxquote-prefix-map
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)))
921 ;; highlight TODOs in buffers
924 (global-hl-todo-mode))
926 (use-package page-break-lines
929 (page-break-lines-max-width fill-column)
931 (global-page-break-lines-mode))
933 (use-package expand-region
934 :bind ("C-=" . er/expand-region))
936 (require 'bandali-yasnippet)
942 (("C-c D d" . debbugs-gnu)
943 ("C-c D b" . debbugs-gnu-bugs)
946 (interactive) ; bug-gnu-emacs
947 (setq debbugs-gnu-current-suppress t)
948 (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
949 ("C-c D g" . ; bug-gnuzilla
952 (setq debbugs-gnu-current-suppress t)
953 (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
954 ("C-c D G b" . ; bug-guix
957 (setq debbugs-gnu-current-suppress t)
958 (debbugs-gnu debbugs-gnu-default-severities '("guix"))))
959 ("C-c D G p" . ; guix-patches
962 (setq debbugs-gnu-current-suppress t)
963 (debbugs-gnu debbugs-gnu-default-severities '("guix-patches"))))))
967 (b/setq-every '("~/usr/org/references.bib")
968 reftex-default-bibliography
969 org-ref-default-bibliography)
971 org-ref-bibliography-notes "~/usr/org/notes.org"
972 org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
974 ;; (use-package fill-column-indicator)
978 (("C-c w s l" . (lambda ()
982 ("C-c w s j" . (lambda ()
986 ("C-c w q" . quit-window))
988 (split-width-threshold 150))
990 (use-package windmove
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)))
1004 :bind ("C-c a p" . pass)
1005 :hook (pass-mode . View-exit))
1007 (use-package pdf-tools
1009 :bind (:map pdf-view-mode-map
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)
1016 ("M-RET" . image-previous-line)
1017 ("C-s" . isearch-forward)
1018 ("s s" . isearch-forward))
1019 :config (pdf-tools-install nil t)
1020 :custom (pdf-view-resize-factor 1.05))
1022 (use-package org-pdftools
1024 :straight (:host github :repo "fuxialexander/org-pdftools")
1028 (with-eval-after-load 'org
1029 (require 'org-pdftools)))
1031 (use-package biblio)
1034 :hook (latex-mode . reftex-mode))
1036 (use-package reftex-cite
1038 :disabled ; enable to disable
1039 ; reftex-cite's default choice
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)))
1046 (when (and macro (string-match "cite" (car macro)))
1047 (goto-char (cdr macro)))
1048 (reftex-this-word)))))
1052 (dmenu-prompt-string "run: ")
1053 (dmenu-save-file (b/var "dmenu-items")))
1056 ;; TODO: fix build by properly building the eosd-pixbuf.c module
1057 ;; e.g. see https://github.com/raxod502/straight.el/issues/386
1059 :straight (:host github :repo "clarete/eosd")
1066 :bind ("C-c a e w" . eww)
1068 (eww-download-directory (file-name-as-directory
1069 (getenv "XDG_DOWNLOAD_DIR"))))
1072 ;;; Post initialization
1075 (message "Loading %s...done (%.3fs)" user-init-file
1076 (float-time (time-subtract (current-time)
1077 b/before-user-init-time)))
1079 ;;; init.el ends here