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
210 (set-fontset-font t
'arabic
"Vazir")
214 (dolist (ft (fontset-list))
218 (font-spec :name
"Source Code Pro" :size
14))
222 (font-spec :name
"DejaVu Sans Mono")
229 ;; :name "Symbola monospacified for DejaVu Sans Mono")
235 ;; (font-spec :name "DejaVu Sans Mono")
241 (font-spec :name
"DejaVu Sans Mono" :size
14)
245 ;;;; Elisp-level customizations
251 ;; don't need to see the startup echo area message
252 (advice-add #'display-startup-echo-area-message
:override
#'ignore
)
254 ;; i want *scratch* as my startup buffer
255 (initial-buffer-choice t
)
256 ;; i don't need the default hint
257 (initial-scratch-message nil
)
258 ;; use customizable text-mode as major mode for *scratch*
259 ;; (initial-major-mode 'text-mode)
260 ;; inhibit buffer list when more than 2 files are loaded
261 (inhibit-startup-buffer-menu t
)
262 ;; don't need to see the startup screen or echo area message
263 (inhibit-startup-screen t
)
264 (inhibit-startup-echo-area-message user-login-name
))
270 ;; backups (C-h v make-backup-files RET)
271 (backup-by-copying t
)
273 (delete-old-versions t
)
276 (auto-save-file-name-transforms
277 `((".*" ,(b/var
"auto-save/") t
)))
279 ;; insert newline at the end of files
280 (require-final-newline t
)
282 ;; open read-only file buffers in view-mode
283 ;; (enables niceties like `q' for quit)
286 ;; disable disabled commands
287 (setq disabled-command-function nil
)
289 ;; lazy-person-friendly yes/no prompts
290 (defalias 'yes-or-no-p
#'y-or-n-p
)
292 ;; enable automatic reloading of changed buffers and files
293 (use-package autorevert
296 (global-auto-revert-mode 1)
298 (auto-revert-verbose nil
)
299 (global-auto-revert-non-file-buffers nil
))
301 ;; time and battery in mode-line
307 (display-time-default-load-average nil
)
308 (display-time-format " %a %b %-e %-l:%M%P")
309 (display-time-mail-icon '(image :type xpm
:file
"gnus/gnus-pointer.xpm" :ascent center
))
310 (display-time-use-mail-icon t
))
315 (display-battery-mode)
317 (battery-mode-line-format "%p%% %t"))
323 ;; (fringe-mode '(3 . 1))
329 ;; enable winner-mode (C-h f winner-mode RET)
334 ;; don't display *compilation* buffer on success. based on
335 ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
336 ;; instead of the now obsolete `flet'.
337 (defun b/compilation-finish-function
(buffer outstr
)
338 (unless (string-match "finished" outstr
)
339 (switch-to-buffer-other-window buffer
))
342 (setq compilation-finish-functions
#'b
/compilation-finish-function
)
346 (defadvice compilation-start
347 (around inhibit-display
348 (command &optional mode name-function highlight-regexp
))
349 (if (not (string-match "^\\(find\\|grep\\)" command
))
350 (cl-letf (((symbol-function 'display-buffer
) #'ignore
))
351 (save-window-excursion ad-do-it
))
353 (ad-activate 'compilation-start
))
357 ;; allow scrolling in Isearch
358 (isearch-allow-scroll t
)
359 ;; search for non-ASCII characters: i’d like non-ASCII characters such
360 ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII
361 ;; counterpart. shoutout to
362 ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html
363 (search-default-mode #'char-fold-to-regexp
))
365 ;; uncomment to extend the above behaviour to query-replace
369 (replace-char-fold t
)))
372 :bind
("C-x v C-=" . vc-ediff
))
377 (vc-git-print-log-follow t
))
380 :config
(add-hook 'ediff-after-quit-hook-internal
'winner-undo
)
381 :custom
((ediff-window-setup-function 'ediff-setup-windows-plain
)
382 (ediff-split-window-function 'split-window-horizontally
)))
384 (use-package face-remap
386 ;; gentler font resizing
387 (text-scale-mode-step 1.05))
392 (setq mouse-wheel-scroll-amount
'(1 ((shift) .
1)) ; one line at a time
393 mouse-wheel-progressive-speed nil
; don't accelerate scrolling
394 mouse-wheel-follow-mouse t
)) ; scroll window under mouse
396 (use-package pixel-scroll
398 :config
(pixel-scroll-mode 1))
400 (use-package epg-config
402 ;; ask for GPG passphrase in minibuffer
403 ;; this will fail if gpg>=2.1 is not available
404 (setq epg-pinentry-mode
'loopback
)
406 (epg-gpg-program (executable-find "gpg")))
411 (use-package pinentry
414 :after
(epa epg server
)
416 ;; workaround for systemd-based distros:
417 ;; (setq pinentry--socket-dir server-socket-dir)
420 (use-package auth-source
422 (auth-sources '("~/.authinfo.gpg"))
423 (authinfo-hidden (regexp-opt '("password" "client-secret" "token"))))
429 ("C-a" . b
/move-indentation-or-beginning-of-line
)
431 ("C-c d" . b
/duplicate-line-or-region
)
433 ("C-c e b" . eval-buffer
)
434 ("C-c e e" . eval-last-sexp
)
435 ("C-c e p" . pp-macroexpand-last-sexp
)
436 ("C-c e r" . eval-region
)
438 ("C-c e i" . emacs-init-time
)
439 ("C-c e u" . emacs-uptime
)
440 ("C-c e v" . emacs-version
)
442 ("C-c f ." . find-file
)
443 ("C-c f d" . find-name-dired
)
444 ("C-c f l" . find-library
)
446 ("C-c F m" . make-frame-command
)
447 ("C-c F d" . delete-frame
)
449 ("C-S-h C" . describe-char
)
450 ("C-S-h F" . describe-face
)
452 ("C-S-j" . b
/join-line-top
)
454 ("C-c x" . execute-extended-command
)
456 ("C-x k" . b
/kill-current-buffer
)
457 ("C-x K" . kill-buffer
)
458 ("C-x s" . save-buffer
)
459 ("C-x S" . save-some-buffers
)
461 :map emacs-lisp-mode-map
462 ("<C-return>" . b
/add-elisp-section
))
464 (when (display-graphic-p)
465 (unbind-key "C-z" global-map
))
468 ;; for back and forward mouse keys
469 ("<XF86Back>" . previous-buffer
)
470 ("<mouse-8>" . previous-buffer
)
471 ;; ("<drag-mouse-8>" . previous-buffer)
472 ("<XF86Forward>" . next-buffer
)
473 ("<mouse-9>" . next-buffer
)
474 ;; ("<drag-mouse-9>" . next-buffer)
475 ;; ("<drag-mouse-2>" . kill-this-buffer)
476 ;; ("<drag-mouse-3>" . switch-to-buffer)
480 ;;; Essential packages
483 (require 'bandali-exwm
))
485 (require 'bandali-org
)
487 (require 'bandali-theme
)
489 ;; *the* right way to do git
491 :bind
(("C-x g" . magit-status
)
492 ("C-c g g" . magit-status
)
493 ("C-c g b" . magit-blame-addition
)
494 ("C-c g l" . magit-log-buffer-file
))
496 (declare-function magit-add-section-hook
"magit-section"
497 (hook function
&optional at append local
))
498 (magit-add-section-hook 'magit-status-sections-hook
499 'magit-insert-modules
500 'magit-insert-stashes
502 ;; (magit-add-section-hook 'magit-status-sections-hook
503 ;; 'magit-insert-ignored-files
504 ;; 'magit-insert-untracked-files
506 (setq magit-repository-directories
'(("~/.emacs.d/" .
0)
508 (nconc magit-section-initial-visibility-alist
509 '(([unpulled status
] . show
)
510 ([unpushed status
] . show
)))
511 (declare-function magit-display-buffer-fullframe-status-v1
"magit-mode" (buffer))
513 (magit-diff-refine-hunk t
)
514 (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1
)
515 ;; (magit-completing-read-function 'magit-ido-completing-read)
516 :custom-face
(magit-diff-file-heading ((t (:weight normal
)))))
518 (use-package magit-extras
521 (setq magit-pop-revision-stack-format
522 (pcase-let ((`(,pt
,_eob
,index-regexp
)
523 (default-value 'magit-pop-revision-stack-format
)))
524 `(,pt
"[%N: %h]: %ci\n %s
525 https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=%H"
528 ;; recently opened files
532 (add-to-list 'recentf-keep
'file-remote-p
)
536 (recentf-max-saved-items 2000))
538 ;; needed for history for counsel
544 ;; (require 'bandali-ido)
545 (require 'bandali-ivy
)
547 (require 'bandali-eshell
)
548 ;; (require 'bandali-multi-term)
550 (require 'bandali-ibuffer
)
554 :hook
(prog-mode . outline-minor-mode
)
557 outline-minor-mode-map
558 ("<s-tab>" . outline-toggle-children
)
559 ("M-p" . outline-previous-visible-heading
)
560 ("M-n" . outline-next-visible-heading
)
561 :prefix-map b
/outline-prefix-map
563 ("TAB" . outline-toggle-children
)
564 ("a" . outline-hide-body
)
565 ("H" . outline-hide-body
)
566 ("S" . outline-show-all
)
567 ("h" . outline-hide-subtree
)
568 ("s" . outline-show-subtree
))
570 (when (featurep 'which-key
)
571 (which-key-add-key-based-replacements
575 (require 'bandali-dired
)
580 ("p" . backward-button
)
581 ("n" . forward-button
))
583 (temp-buffer-resize-mode)
584 (setq help-window-select t
))
588 (add-to-list 'tramp-default-proxies-alist
'(nil "\\`root\\'" "/ssh:%h:"))
589 (add-to-list 'tramp-default-proxies-alist
'("localhost" nil nil
))
590 (add-to-list 'tramp-default-proxies-alist
591 (list (regexp-quote (system-name)) nil nil
)))
593 (use-package doc-view
594 :bind
(:map doc-view-mode-map
595 ("M-RET" . image-previous-line
)))
601 ;; Email (with Gnus, message, and EBDB)
602 (require 'bandali-gnus
)
603 (use-package sendmail
605 (setq sendmail-program
(executable-find "msmtp")
606 ;; message-sendmail-extra-arguments '("-v" "-d")
607 mail-specify-envelope-from t
608 mail-envelope-from
'header
))
609 (require 'bandali-message
)
610 (require 'bandali-ebdb
)
612 ;; IRC (with ERC and ZNC)
613 (require 'bandali-erc
)
617 (setq scpaste-http-destination
"https://p.bndl.org"
618 scpaste-scp-destination
"p:~"))
623 ;; highlight uncommitted changes in the left fringe
628 (setq diff-hl-draw-borders nil
)
629 (global-diff-hl-mode)
631 ((magit-pre-refresh . diff-hl-magit-pre-refresh
)
632 (magit-post-refresh . diff-hl-magit-post-refresh
)))
634 ;; display Lisp objects at point in the echo area
636 :when
(version< "25" emacs-version
)
637 :config
(global-eldoc-mode))
639 ;; highlight matching parens
642 :config
(show-paren-mode))
644 (use-package elec-pair
647 :config
(electric-pair-mode))
650 :config
(column-number-mode)
652 ;; Save what I copy into clipboard from other applications into Emacs'
653 ;; kill-ring, which would allow me to still be able to easily access
654 ;; it in case I kill (cut or copy) something else inside Emacs before
655 ;; yanking (pasting) what I'd originally intended to.
656 (save-interprogram-paste-before-kill t
))
658 ;; save minibuffer history
659 (use-package savehist
663 (add-to-list 'savehist-additional-variables
'kill-ring
))
665 ;; automatically save place in files
666 (use-package saveplace
667 :when
(version< "25" emacs-version
)
668 :config
(save-place-mode))
670 (use-package prog-mode
671 :config
(global-prettify-symbols-mode)
672 (defun indicate-buffer-boundaries-left ()
673 (setq indicate-buffer-boundaries
'left
))
674 (add-hook 'prog-mode-hook
#'indicate-buffer-boundaries-left
))
676 (use-package text-mode
677 :bind
(:map text-mode-map
("C-*" . b
/insert-asterism
))
678 :hook
((text-mode . indicate-buffer-boundaries-left
)
679 (text-mode . flyspell-mode
)))
681 (use-package conf-mode
684 (use-package sh-script
685 :mode
("\\.bashrc$" . sh-mode
))
690 (:map company-active-map
691 ([tab] . company-complete-common-or-cycle)
692 ([escape] . company-abort)
693 ("C-p" . company-select-previous-or-abort)
694 ("C-n" . company-select-next-or-abort))
696 (company-minimum-prefix-length 1)
697 (company-selection-wrap-around t)
698 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
699 (company-dabbrev-downcase nil)
700 (company-dabbrev-ignore-case nil)
702 ;; (global-company-mode t)
705 (use-package flycheck
708 :hook (prog-mode . flycheck-mode)
710 (:map flycheck-mode-map
711 ("M-P" . flycheck-previous-error)
712 ("M-N" . flycheck-next-error))
714 ;; Use the load-path from running Emacs when checking elisp files
715 (setq flycheck-emacs-lisp-load-path 'inherit)
717 ;; Only flycheck when I actually save the buffer
718 (setq flycheck-check-syntax-automatically '(mode-enabled save))
719 :custom (flycheck-mode-line-prefix "flyc"))
721 ;; (use-package flyspell)
723 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
728 ;; ’ can be part of a word
729 (setq ispell-local-dictionary-alist
730 `((nil "[[:alpha:]]" "[^[:alpha:]]"
731 "['\x2019]" nil ("-B") nil utf-8))
732 ispell-program-name (executable-find "hunspell"))
733 ;; don't send ’ to the subprocess
734 (defun endless/replace-apostrophe (args)
735 (cons (replace-regexp-in-string
738 (advice-add #'ispell-send-string :filter-args
739 #'endless/replace-apostrophe)
741 ;; convert ' back to ’ from the subprocess
742 (defun endless/replace-quote (args)
743 (if (not (derived-mode-p 'org-mode))
745 (cons (replace-regexp-in-string
748 (advice-add #'ispell-parse-output :filter-args
749 #'endless/replace-quote))
752 :hook (text-mode . abbrev-mode))
755 ;;; Programming modes
757 (use-package lisp-mode
759 (defun indent-spaces-mode ()
760 (setq indent-tabs-mode nil))
761 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
763 (use-package alloy-mode
764 :mode "\\.\\(als\\|dsh\\)\\'"
766 (setq alloy-basic-offset 2)
767 ;; (defun b/alloy-simple-indent (start end)
769 ;; ;; (if (region-active-p)
770 ;; ;; (indent-rigidly start end alloy-basic-offset)
772 ;; ;; (indent-rigidly (line-beginning-position)
773 ;; ;; (line-end-position)
774 ;; ;; alloy-basic-offset)))
775 ;; (indent-to (+ (current-column) alloy-basic-offset)))
776 :bind (:map alloy-mode-map
777 ("RET" . electric-newline-and-maybe-indent)
778 ;; ("TAB" . b/alloy-simple-indent)
779 ("TAB" . indent-for-tab-command))
780 :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil))))
782 (use-package lean-mode
785 :init (eval-when-compile (defvar lean-mode-map))
786 :bind (:map lean-mode-map
787 ("S-SPC" . company-complete))
789 (require 'lean-input)
790 (setq default-input-method "Lean"
791 lean-input-tweak-all '(lean-input-compose
792 (lean-input-prepend "/")
793 (lean-input-nonempty))
794 lean-input-user-translations '(("/" "/")))
797 (use-package sgml-mode
799 (setq sgml-basic-offset 0))
801 (use-package css-mode
803 (setq css-indent-offset 2))
808 (use-package geiser-guile
811 (setq geiser-guile-load-path "~/src/git/guix"))
822 (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit))))
827 (font-latex-fontify-sectioning 'color))
829 (use-package tex-mode
832 (lambda (p) (string-match "^---?" (car p)))
833 tex--prettify-symbols-alist)
834 :hook ((tex-mode . auto-fill-mode)
835 (tex-mode . flyspell-mode)))
837 ;; (use-package george-mode
838 ;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode")
839 ;; :mode "\\.grg\\'")
842 ;;; Emacs enhancements & auxiliary packages
845 :config (setq Man-width 80))
847 (use-package which-key
850 (which-key-add-key-based-replacements
851 ;; prefixes for global prefixes and minor modes
853 "C-x RET" "coding system"
855 "C-x @" "event modifiers"
856 "C-x a" "abbrev/expand"
857 "C-x r" "rectangle/register/bookmark"
859 "C-x v" "version control"
863 ;; prefixes for my personal bindings
865 "C-c a" "applications"
870 "C-c c" "compile-and-comments"
879 ;; prefixes for major modes
880 (which-key-add-major-mode-key-based-replacements 'org-mode
881 "C-c C-v" "org-babel")
885 (which-key-add-column-padding 5)
886 (which-key-idle-delay 10000)
887 (which-key-idle-secondary-delay 0.05)
888 (which-key-max-description-length 32)
889 (which-key-show-early-on-C-h t))
891 ;; (require 'bandali-projectile)
897 (("C-S-h c" . helpful-command)
898 ("C-S-h f" . helpful-callable) ; helpful-function
899 ("C-S-h v" . helpful-variable)
900 ("C-S-h k" . helpful-key)
901 ("C-S-h p" . helpful-at-point)))
903 (use-package unkillable-scratch
906 (unkillable-scratch 1)
908 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
911 ;; | make pretty boxed quotes like this
913 (use-package boxquote
917 b/boxquote-prefix-map
919 ("b" . boxquote-buffer)
920 ("B" . boxquote-insert-buffer)
921 ("d" . boxquote-defun)
922 ("F" . boxquote-insert-file)
923 ("hf" . boxquote-describe-function)
924 ("hk" . boxquote-describe-key)
925 ("hv" . boxquote-describe-variable)
926 ("hw" . boxquote-where-is)
927 ("k" . boxquote-kill)
928 ("p" . boxquote-paragraph)
929 ("q" . boxquote-boxquote)
930 ("r" . boxquote-region)
931 ("s" . boxquote-shell-command)
932 ("t" . boxquote-text)
933 ("T" . boxquote-title)
934 ("u" . boxquote-unbox)
935 ("U" . boxquote-unbox-region)
936 ("y" . boxquote-yank)
937 ("M-q" . boxquote-fill-paragraph)
938 ("M-w" . boxquote-kill-ring-save)))
941 ;; highlight TODOs in buffers
944 (global-hl-todo-mode))
946 (use-package page-break-lines
949 (page-break-lines-max-width fill-column)
951 (global-page-break-lines-mode))
953 (use-package expand-region
954 :bind ("C-=" . er/expand-region))
956 (require 'bandali-yasnippet)
960 (("C-c D d" . debbugs-gnu)
961 ("C-c D b" . debbugs-gnu-bugs)
964 (interactive) ; bug-gnu-emacs
965 (setq debbugs-gnu-current-suppress t)
966 (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
967 ("C-c D g" . ; bug-gnuzilla
970 (setq debbugs-gnu-current-suppress t)
971 (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
972 ("C-c D G b" . ; bug-guix
975 (setq debbugs-gnu-current-suppress t)
976 (debbugs-gnu debbugs-gnu-default-severities '("guix"))))
977 ("C-c D G p" . ; guix-patches
980 (setq debbugs-gnu-current-suppress t)
981 (debbugs-gnu debbugs-gnu-default-severities '("guix-patches"))))))
987 (b/setq-every '("~/usr/org/references.bib")
988 reftex-default-bibliography
989 org-ref-default-bibliography)
991 org-ref-bibliography-notes "~/usr/org/notes.org"
992 org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
994 ;; (use-package fill-column-indicator)
998 (("C-c w s l" . (lambda ()
1000 (split-window-right)
1002 ("C-c w s j" . (lambda ()
1004 (split-window-below)
1006 ("C-c w q" . quit-window))
1008 (split-width-threshold 150))
1010 (use-package windmove
1013 (("C-c w h" . windmove-left)
1014 ("C-c w j" . windmove-down)
1015 ("C-c w k" . windmove-up)
1016 ("C-c w l" . windmove-right)
1017 ("C-c w H" . windmove-swap-states-left)
1018 ("C-c w J" . windmove-swap-states-down)
1019 ("C-c w K" . windmove-swap-states-up)
1020 ("C-c w L" . windmove-swap-states-right)))
1024 :bind ("C-c a p" . pass)
1025 :hook (pass-mode . View-exit))
1027 (use-package pdf-tools
1029 :bind (:map pdf-view-mode-map
1030 ("<C-XF86Back>" . pdf-history-backward)
1031 ("<mouse-8>" . pdf-history-backward)
1032 ("<drag-mouse-8>" . pdf-history-backward)
1033 ("<C-XF86Forward>" . pdf-history-forward)
1034 ("<mouse-9>" . pdf-history-forward)
1035 ("<drag-mouse-9>" . pdf-history-forward)
1036 ("M-RET" . image-previous-line)
1037 ("C-s" . isearch-forward)
1038 ("s s" . isearch-forward))
1039 :config (pdf-tools-install nil t)
1040 :custom (pdf-view-resize-factor 1.05))
1042 (use-package org-pdftools
1044 :straight (:host github :repo "fuxialexander/org-pdftools")
1048 (with-eval-after-load 'org
1049 (require 'org-pdftools)))
1051 (use-package biblio)
1054 :hook (latex-mode . reftex-mode))
1056 (use-package reftex-cite
1058 :disabled ; enable to disable
1059 ; reftex-cite's default choice
1062 (defun reftex-get-bibkey-default ()
1063 "If the cursor is in a citation macro, return the word before the macro."
1064 (let* ((macro (reftex-what-macro 1)))
1066 (when (and macro (string-match "cite" (car macro)))
1067 (goto-char (cdr macro)))
1068 (reftex-this-word)))))
1072 (dmenu-prompt-string "run: ")
1073 (dmenu-save-file (b/var "dmenu-items")))
1076 ;; TODO: fix build by properly building the eosd-pixbuf.c module
1077 ;; e.g. see https://github.com/raxod502/straight.el/issues/386
1079 :straight (:host github :repo "clarete/eosd")
1086 :bind ("C-c a e w" . eww)
1088 (eww-download-directory (file-name-as-directory
1089 (getenv "XDG_DOWNLOAD_DIR"))))
1092 ;;; Post initialization
1095 (message "Loading %s...done (%.3fs)" user-init-file
1096 (float-time (time-subtract (current-time)
1097 b/before-user-init-time)))
1099 ;;; init.el ends here