emacs/init.el

1373 lines
53 KiB
EmacsLisp
Raw Normal View History

2022-01-05 03:13:22 +00:00
;;; init.el --- Emacs initiation file -*- lexical-binding: t -*-
2021-09-05 04:51:36 +00:00
;; Author: Case Duckworth <acdw@acdw.net>
2021-03-01 05:58:57 +00:00
;; Created: Sometime during Covid-19, 2020
2021-02-26 17:31:50 +00:00
;; Keywords: configuration
2021-03-08 04:14:38 +00:00
;; URL: https://tildegit.org/acdw/emacs
;; Bankruptcy: 8
2021-03-16 16:16:21 +00:00
;;; License:
2021-09-05 04:51:36 +00:00
;; Everyone is permitted to do whatever they like with this software
;; without limitation. This software comes without any warranty
;; whatsoever, but with two pieces of advice:
2021-09-25 19:03:00 +00:00
;; - Be kind to yourself.
2021-03-01 05:58:57 +00:00
;; - Make good choices.
2021-03-16 16:16:21 +00:00
2021-09-25 19:03:00 +00:00
;;; Code:
(let ((early-features `((early-init . ,(locate-user-emacs-file "early-init"))
acdw private +key)))
(dolist (feature early-features)
(require (or (car-safe feature) feature) (cdr-safe feature) :noerror)))
2022-01-04 20:39:54 +00:00
(setup (:require +casing)
(+casing-mode +1))
2022-01-04 20:39:54 +00:00
2021-12-06 04:37:11 +00:00
(setup (:require +emacs)
;; +emacs.el contains super-basic defaults that are basically necessary for
;; good functioning. In this block, I add extra things or more "experimental"
;; ones that might not belong in a separate file.
2022-01-04 06:40:11 +00:00
(:also-load +lisp)
2022-01-03 21:17:18 +00:00
(:option truncate-string-ellipsis "")
;; Bindings
2021-12-31 03:14:06 +00:00
(:global "C-x C-k" #'kill-current-buffer
2021-12-30 04:55:55 +00:00
"C-x 4 n" #'clone-buffer
"C-c v" #'visible-mode
"C-M-;" #'+lisp-comment-or-uncomment-sexp
2022-01-06 21:47:42 +00:00
"M-j" nil
"C-x o" (lambda () (interactive) (switch-to-buffer nil))
"C-x C-o" #'+open-paragraph
2022-01-07 04:55:26 +00:00
"C-w" #'+kill-word-backward-or-region
"C-x C-1" #'delete-other-windows
"C-x 2" #'+split-window-below-then
"C-x C-2" #'+split-window-below-then
"C-x 3" #'+split-window-right-then
"C-x C-3" #'+split-window-right-then)
2021-12-06 04:37:11 +00:00
;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
(global-set-key (kbd "C-h") 'delete-backward-char)
2021-12-29 04:15:12 +00:00
(keyboard-translate ?\C-h ?\C-?)
2022-01-06 21:47:42 +00:00
;; Hooks
;; Advice
2021-12-30 18:27:39 +00:00
;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hph14un/
(define-advice keyboard-escape-quit (:around (fn &rest r))
"Don't close splits on `keyboard-escape-quit'."
(let ((buffer-quit-function #'ignore))
2021-12-30 18:27:39 +00:00
(apply fn r))))
(setup (:require +init)
2021-12-30 04:55:55 +00:00
(:bind "C-c s" #'+init-sort-then-save)
2021-12-29 00:20:07 +00:00
(:hook #'+init-add-setup-to-imenu))
2022-01-05 17:23:47 +00:00
(setup (:require +lookup)
(+lookup-mode +1))
2022-01-05 17:23:47 +00:00
2021-12-06 04:37:41 +00:00
(setup (:require auth-source)
2022-01-04 04:32:10 +00:00
(:option auth-sources (list (private/ "authinfo"))))
2021-12-06 04:37:41 +00:00
(setup (:require auto-insert)
(setf (alist-get '("lisp/.*\\.el\\'" . "+Emacs lisp")
auto-insert-alist nil nil #'equal)
`(nil ";;; " (file-name-nondirectory (buffer-file-name))
(make-string (max 2 (- fill-column (current-column) 27)) 32)
"-*- lexical-binding: t; -*-" '(setq lexical-binding t)
,(concat "\n\n;;; Commentary:"
"\n\n;; ") _
,(concat "\n\n;;; Code:"
"\n\n"
"\n\n(provide '")
(file-name-base (buffer-file-name))
,(concat ")" "\n;;; ")
(file-name-nondirectory (buffer-file-name)) " ends here\n"))
(auto-insert-mode +1))
2022-01-04 21:30:33 +00:00
(setup (:require cus-edit)
;; I don't use Custom to actually /make/ any customizations, but it's handy to
;; (A) see what options are available and (B) persist some changes across
;; restarts, for example, `safe-local-variables'.
(:require +cus-edit)
(:option custom-file (private/ "custom.el")
custom-magic-show nil
custom-magic-show-button t
custom-raised-buttons nil
custom-unlispify-tag-names nil
custom-variable-default-form 'lisp)
(dolist (var '(safe-local-variable-values
warning-suppress-types))
(add-to-list '+custom-variable-allowlist var))
2022-01-06 00:39:08 +00:00
(+custom-load-ignoring-most-customizations)
2022-01-04 21:30:33 +00:00
(advice-add #'custom-buffer-create-internal :after #'+cus-edit-expand-widgets)
(:with-mode Custom-mode
(:local-set imenu-generic-expression +cus-edit-imenu-generic-expression)))
(setup (:require goto-addr)
(if (fboundp #'global-goto-address-mode)
(global-goto-address-mode)
(add-hook 'after-change-major-mode-hook #'goto-address-mode)))
2021-12-06 04:37:41 +00:00
(setup (:require pulse)
(:also-load +pulse)
(:option pulse-flag nil
pulse-delay 0.5
2021-12-30 04:55:55 +00:00
pulse-iterations 1)
2022-01-03 21:17:33 +00:00
(+ensure-after-init #'+pulse-location-mode))
2021-12-06 04:37:41 +00:00
2021-12-29 04:15:12 +00:00
(setup (:require reading)
2021-12-31 03:14:06 +00:00
(:global "C-c C-r" #'reading-mode))
2021-12-26 19:03:24 +00:00
2022-01-06 21:47:09 +00:00
(setup (:require user-save)
(user-save-mode +1))
(setup +key
(+ensure-after-init #'+key-global-mode))
(setup abbrev
(:option abbrev-file-name (sync/ "abbrev.el")
save-abbrevs 'silent)
(:hook-into text-mode
circe-chat-mode))
(setup autorevert
(:option global-auto-revert-non-file-buffers t
auto-revert-verbose nil)
(global-auto-revert-mode +1))
(setup browse-url
(:require +browse-url)
2021-12-31 21:46:16 +00:00
(:option
browse-url-browser-function #'eww-browse-url
2022-01-03 21:18:05 +00:00
+browse-url-browser-function browse-url-browser-function
2021-12-31 21:46:16 +00:00
browse-url-secondary-browser-function (if (executable-find "firefox")
#'browse-url-firefox
#'browse-url-default-browser)
browse-url-new-window-flag nil
browse-url-firefox-arguments '("--new-tab")
browse-url-firefox-new-window-is-tab t)
;; Set up external browsing URLs.
2022-01-04 20:41:46 +00:00
(add-to-list '+custom-variable-allowlist
'+browse-url-secondary-browser-regexps)
(dolist (domain '("github.com" "twitch.tv"
"gitlab.com"
"google.com"
"imgur.com"
"pixelfed" "instagram.com" "bibliogram.art"
"reddit.com" "teddit.net"
"tildes.net"
"taskiq"
"twitter.com" "nitter.net"
2022-01-05 05:57:39 +00:00
"streamable.com"
"hetzner.cloud"))
2022-01-04 20:41:46 +00:00
(add-to-list '+browse-url-secondary-browser-regexps domain))
;; Set up URL handlers.
(+browse-url-set-handlers
(list
(cons (rx ; images
"." (or "jpeg" "jpg" "png") eos)
(lambda (&rest args)
(apply
2021-12-30 04:55:55 +00:00
(cond ((executable-find "mpv") #'+browse-image-with-mpv)
(t #'eww-browse-url))
args)))
(cons (rx ; videos
(or "youtube.com" "youtu.be" "yewtu.be"
2022-01-05 05:57:39 +00:00
(seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos)))
(lambda (&rest args)
(apply (if (executable-find "mpv")
2021-12-30 04:55:55 +00:00
#'+browse-url-with-mpv
browse-url-secondary-browser-function)
args)))
2022-01-03 21:18:05 +00:00
(cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
browse-url-secondary-browser-function)
(cons "." ; everything else
2022-01-04 04:32:20 +00:00
+browse-url-browser-function)))
;; Transform URLs before passing to `browse-url'
(:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
"youtu.be"))
2021-12-20 04:11:39 +00:00
. "//yewtu.be")
("twitter\\.com"
. "nitter.net")
("instagram\\.com"
. "bibilogram.art")
(,(rx (or "reddit.com"
"old.reddit.com"))
. "teddit.net")
("medium\\.com"
. "scribe.rip")))
(+browse-url-transform-url-global-mode +1))
2021-07-01 00:34:06 +00:00
(setup calendar
(require '_location)
(:option calendar-location-name _location-name
calendar-latitude _location-latitude
2022-01-03 21:18:33 +00:00
calendar-longitude _location-longitude
diary-file (private/ "diary")))
2021-12-31 05:07:58 +00:00
(setup compile
(:option compilation-always-kill t
compilation-ask-about-save nil
compilation-scroll-output t))
2021-09-04 15:38:06 +00:00
(setup dired
(:also-load dired-x)
(:also-straight dired-subtree
dired-collapse
dired-git-info
dired+)
2022-01-02 01:25:35 +00:00
(:option dired-recursive-copies 'always
dired-recursive-deletes 'always
2022-01-04 04:32:31 +00:00
dired-create-destination-dirs 'always
dired-do-revert-buffer t
dired-hide-details-hide-symlink-targets nil
dired-isearch-filenames 'dwim
delete-by-moving-to-trash t
2022-01-04 04:32:31 +00:00
dired-auto-revert-buffer t
dired-listing-switches "-Al"
ls-lisp-dirs-first t
dired-ls-F-marks-symlinks t
2022-01-04 04:32:31 +00:00
dired-clean-confirm-killing-deleted-buffers nil
2022-01-03 16:37:03 +00:00
dired-no-confirm '(byte-compile
load chgrp chmod chown
2021-12-30 04:55:55 +00:00
copy move hardlink symlink
shell touch)
dired-dwim-target t)
2021-12-29 00:20:07 +00:00
(:bind "<backspace>" #'dired-up-directory
"TAB" #'dired-subtree-cycle
"i" #'dired-subtree-toggle
")" #'dired-git-info-mode)
(:hook #'dired-collapse-mode
#'dired-hide-details-mode
#'hl-line-mode)
(:+key "C-x C-j" #'dired-jump)
2021-09-04 15:38:06 +00:00
(with-eval-after-load 'dired
2022-01-05 03:10:07 +00:00
(pcase system-system
('windows
(:straight w32-browser))
2022-01-05 03:10:07 +00:00
('linux
(:straight dired-open)
(:option dired-listing-switches
(concat dired-listing-switches " -F")))))
(with-eval-after-load 'frowny
2021-12-30 04:55:55 +00:00
(add-to-list 'frowny-inhibit-modes #'dired-mode)))
2021-12-05 05:09:33 +00:00
(setup eldoc
(:hook-into elisp-mode
lisp-interaction-mode))
(setup elisp-mode
(:also-load +elisp)
(:option eval-expression-print-length nil
eval-expression-print-level nil)
(:with-map (emacs-lisp-mode-map lisp-interaction-mode-map)
2021-12-29 00:20:07 +00:00
(:bind "C-c C-c" #'eval-defun
"C-c C-k" #'+elisp-eval-region-or-buffer
"C-c C-z" #'ielm))
(advice-add #'eval-region :around #'+eval-region@pulse))
2021-12-05 05:09:33 +00:00
(setup eshell
(:also-load +eshell
2021-09-06 17:51:48 +00:00
em-smart
em-tramp)
(:option eshell-aliases-file (.etc "eshell/aliases" t)
2021-09-06 17:51:48 +00:00
eshell-destroy-buffer-when-process-dies t
eshell-directory-name (.etc "eshell/" t)
2021-09-06 17:51:48 +00:00
eshell-error-if-no-glob t
eshell-hist-ignore-dups t
eshell-kill-on-exit nil
eshell-prefer-lisp-functions t
eshell-prefer-lisp-variables t
eshell-review-quick-commands nil
2021-09-06 17:51:48 +00:00
eshell-save-history-on-exit t
eshell-scroll-to-bottom-on-input 'all
eshell-smart-space-goes-to-end t
eshell-where-to-jump 'begin)
(add-hook 'eshell-mode-hook
(defun +eshell@setup ()
"Eshell improperly does loading. Gah."
2022-01-04 04:32:41 +00:00
(interactive)
(dolist (setting `((outline-regexp . ,eshell-prompt-regexp)
2022-01-04 04:32:41 +00:00
(page-delimiter . ,eshell-prompt-regexp)
(imenu-generic-expression
. ,`(("Prompt"
,(concat eshell-prompt-regexp
"\\(.*\\)")
1)))))
(set (make-local-variable (car setting)) (cdr setting)))
(dolist (binding `(("C-d" . +eshell-quit-or-delete-char)))
(define-key eshell-mode-map
(kbd (car binding)) (cdr binding)))
(dolist (environment `(("PAGER" . "cat")))
(setenv (car environment) (cdr environment))))))
2021-12-26 19:03:24 +00:00
(setup eww
2021-12-27 04:49:25 +00:00
(:also-load +eww)
(:option eww-search-prefix "https://duckduckgo.com/html?q="
url-privacy-level '(email agent cookies lastloc))
2021-12-29 00:20:07 +00:00
(add-hook 'eww-after-render-hook #'reading-mode)
(:hook #'+eww-bookmark-setup
#'+eww-track-readable-mode)
(:bind "b" #'bookmark-set
"B" #'bookmark-jump
2021-12-27 04:49:25 +00:00
"M-n" nil
"M-p" nil))
2021-12-26 19:03:24 +00:00
(setup flyspell
(:hook-into org-mode))
2021-12-29 00:20:24 +00:00
(setup hideshow
(:also-load +hideshow)
(:with-mode hs-minor-mode
(:hook-into prog-mode)
(:bind "C-<tab>" #'+hs-cycle
"C-S-<tab>" #'+hs-global-cycle
;; but y tho
"C-S-<iso-lefttab>" #'+hs-global-cycle)))
2021-12-26 19:05:13 +00:00
(setup ibuffer
(:also-load ibuf-ext)
(:option ibuffer-expert t
ibuffer-show-empty-filter-groups nil
ibuffer-saved-filter-groups
'(("default"
("Org" (mode . org-mode))
("emacs" (or (name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$")
(name . "^\\*Warnings\\*$")
(name . "^\\*straight-process\\*$")
(name . "^\\*Calendar\\*$")))
("customize" (mode . Custom-mode))
("emacs-config" (or (filename . ".emacs.d")
(mode . +init-mode)))
("git" (or (name . "^\*magit")
(name . "^\magit")))
("help" (or (mode . help-mode)
(mode . Info-mode)
(mode . helpful-mode)))
("irc" (or (mode . erc-mode)
(mode . circe-server-mode)
(mode . circe-channel-mode)))
("shell" (or (mode . eshell-mode)
(mode . shell-mode)
(mode . vterm-mode)))
("web" (or (mode . elpher-mode)
(mode . eww-mode))))))
(:hook (defun ibuffer@filter-to-default ()
(ibuffer-auto-mode +1)
(ibuffer-switch-to-saved-filter-groups "default"))))
2022-01-05 05:57:39 +00:00
(setup info
(:also-load +Info)
(:with-mode Info-mode ; -_-
(:hook #'reading-mode)
(:bind "c" #'+Info-copy-current-node-name
"w" #'+Info-copy-current-node-name)))
2021-12-29 01:40:03 +00:00
(setup kmacro
(:also-load +kmacro)
(with-eval-after-load '+kmacro
(+kmacro-recording-indicator-mode +1)
(+kmacro-block-undo-mode +1)))
(setup magit
;; This setup is weird because of dependency issues
(:straight (transient :host github :repo "magit/transient" :branch "master")
(magit :host github :repo "magit/magit")
(git-modes :host github :repo "magit/git-modes")))
2021-12-18 00:30:22 +00:00
(setup minibuffer
(:require +minibuffer)
(:with-map minibuffer-local-map
2021-12-29 00:20:07 +00:00
(:bind "M-/" #'+minibuffer-complete-history)))
2021-12-30 18:27:55 +00:00
(setup mouse
;; Brand new for Emacs 28: see https://ruzkuku.com/texts/emacs-mouse.html
2021-12-31 03:14:06 +00:00
;; Actually, look at this as well: https://www.emacswiki.org/emacs/Mouse3
2021-12-30 18:27:55 +00:00
(when (fboundp 'context-menu-mode)
;; (:option context-menu-functions
;; '(context-menu-ffap
;; context-menu-region
;; context-menu-undo
;; context-menu-dictionary))
(context-menu-mode +1)))
2022-01-03 05:32:06 +00:00
(setup org
;; Plain org with the `setup' form for sorting, but I install with straight.
2022-01-03 16:37:03 +00:00
(:straight (org
:type git :host nil
:repo "https://git.savannah.gnu.org/git/emacs/org-mode.git"
:local-repo "org"
:depth full
:pre-build (straight-recipes-org-elpa--build)
:build (:not autoloads)
:files (:defaults
"lisp/*.el"
("etc/styles/" "etc/styles/*")))
(org-contrib
:type git :host nil
:repo "https://git.sr.ht/~bzg/org-contrib"))
2022-01-03 05:32:06 +00:00
;; DO NOT load system-installed org !!!
(setq load-path (cl-remove-if (lambda (path)
(string-match-p "lisp/org\\'" path))
load-path))
(:also-load +org
2022-01-03 21:16:47 +00:00
ox-md
2022-01-04 20:41:46 +00:00
_work)
2022-01-03 05:32:06 +00:00
(:option org-adapt-indentation nil
org-archive-mark-done t
org-catch-invisible-edits 'show-and-error
org-clock-clocked-in-display 'mode-line
org-clock-frame-title-format (cons
'(t org-mode-line-string)
(cons " --- " frame-title-format))
org-clock-string-limit 7 ; just the clock bit
;; org-clock-string-limit 25 ; gives enough information
org-clock-persist t
org-confirm-babel-evaluate nil
org-cycle-separator-lines 0
2022-01-03 21:17:18 +00:00
org-directory (sync/ "org/" t)
org-ellipsis truncate-string-ellipsis
2022-01-03 05:32:06 +00:00
org-export-coding-system 'utf-8-unix
org-export-headline-levels 8
org-export-with-section-numbers nil
org-export-with-smart-quotes t
org-export-with-sub-superscripts t
org-export-with-toc nil
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-fontify-whole-heading-line t
org-hide-emphasis-markers t
org-html-coding-system 'utf-8-unix
org-image-actual-width (list (* (window-font-width)
(- fill-column 8)))
org-imenu-depth 3
org-list-demote-modify-bullet '(("-" . "+")
2022-01-04 22:45:32 +00:00
("+" . "-"))
2022-01-03 05:32:06 +00:00
org-log-done 'time
org-log-into-drawer t
org-outline-path-complete-in-steps nil
org-pretty-entities t
org-pretty-entities-include-sub-superscripts nil
org-refile-use-outline-path 'file
org-special-ctrl-a/e t
org-special-ctrl-k t
org-src-fontify-natively t
org-src-tab-acts-natively t
org-src-window-setup 'current-window
org-startup-truncated nil
org-startup-with-inline-images t
2022-01-03 21:18:50 +00:00
org-tags-column (- (- fill-column (length org-ellipsis)))
org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)"
"|" "DONE(d!)")
(sequence "|" "CANCELED(k!)")
(sequence "MEETING(m)")))
2022-01-03 05:32:06 +00:00
(:bind "RET" #'+org-return-dwim
"<S-return>" #'+org-table-copy-down
"C-c C-l" #'+org-insert-link-dwim
"C-c C-n" #'+org-next-heading-widen
"C-c C-p" #'+org-previous-heading-widen)
2022-01-06 21:47:09 +00:00
(:local-hook user-save-hook #'+org-before-save@prettify-buffer)
2022-01-03 05:32:06 +00:00
(advice-add #'org-delete-backward-char :override #'+org-delete-backward-char)
(with-eval-after-load 'org
(org-clock-persistence-insinuate)
2022-01-04 20:41:46 +00:00
(org-link-set-parameters "tel" :follow #'+org-tel-open))
;; Fancy list bullets
(font-lock-add-keywords
'org-mode
'(("^ *\\([-]\\) "
2022-01-04 22:52:32 +00:00
(0 (compose-region (match-beginning 1) (match-end 1) "")))
2022-01-04 20:41:46 +00:00
("^ *\\([+]\\) "
2022-01-04 22:52:32 +00:00
(0 (compose-region (match-beginning 1) (match-end 1) ""))))))
2022-01-03 05:32:06 +00:00
2021-12-29 00:20:07 +00:00
(setup org-agenda
2022-01-03 21:18:50 +00:00
(:option org-agenda-skip-deadline-if-done t
org-agenda-skip-scheduled-if-done t
org-agenda-span 10
org-agenda-include-diary nil ; I use the org-diary features
org-agenda-todo-ignore-deadlines 'near
org-agenda-todo-ignore-scheduled 'future
org-agenda-include-deadlines t
org-deadline-warning-days 0
2022-01-04 14:30:38 +00:00
org-agenda-show-future-repeats 'next
org-agenda-window-setup 'current-window)
2022-01-04 20:41:46 +00:00
(dolist (var '(org-agenda-files
org-agenda-file-regexp
org-agenda-templates))
(add-to-list '+custom-variable-allowlist var))
2022-01-04 21:30:33 +00:00
(defvar org-agenda-files nil)
2022-01-04 20:41:46 +00:00
(add-to-list 'org-agenda-files (sync/ "org/" t))
2022-01-03 21:18:50 +00:00
(:+leader "a" #'org-agenda "C-a" #'org-agenda)
(:hook #'hl-line-mode))
2021-12-18 00:30:22 +00:00
2022-01-03 05:32:06 +00:00
(setup org-capture
(:require +org-capture)
2022-01-03 21:18:50 +00:00
(:+leader "c" #'org-capture "C-c" #'org-capture)
(+org-capture-templates-setf "t" "Todo")
(+org-capture-templates-setf "tt"
2022-01-03 21:38:30 +00:00
`("Today!" entry (file "todo.org")
,(concat "* TODO %^{Title}\n"
2022-01-03 21:18:50 +00:00
"DEADLINE: %t\n"
"\n%?")))
(+org-capture-templates-setf "ts"
2022-01-03 21:38:30 +00:00
`("Someday..." entry (file "todo.org")
,(concat "* TODO %^{Title}\n"
2022-01-03 21:18:50 +00:00
":PROPERTIES:\n"
":CREATED: [%<%F %T>]\n"
":END:\n"
"\n%?")))
(+org-capture-sort))
(setup org-contacts
(:also-straight org-vcard) ; for importing Vcard files
(:option org-contacts-matcher "contact") ; Contacts are tagged "contact"
)
2022-01-03 05:32:06 +00:00
2021-12-05 05:09:33 +00:00
(setup prog
(:local-set comment-auto-fill-only-comments t)
2021-12-29 00:20:07 +00:00
(:hook #'prettify-symbols-mode
#'display-fill-column-indicator-mode
#'turn-on-auto-fill))
2021-12-05 05:09:33 +00:00
(setup scratch
(:require +scratch)
2021-12-30 04:55:55 +00:00
(:option initial-major-mode #'lisp-interaction-mode
initial-scratch-message
";; ABANDON ALL HOPE YE WHO ENTER HERE\n\n")
2021-12-29 00:20:07 +00:00
(add-hook 'kill-buffer-query-functions #'+scratch-immortal))
2021-12-05 05:09:33 +00:00
(setup text
2021-12-29 00:20:07 +00:00
(:hook #'turn-on-auto-fill))
2021-12-05 05:09:33 +00:00
(setup (:straight 0x0)
(:option 0x0-default-server 'ttm)
(with-eval-after-load 'embark
2021-12-30 04:55:55 +00:00
(define-key embark-region-map (kbd "U") #'0x0-dwim)))
2021-12-18 00:29:58 +00:00
(setup (:straight ace-window)
2021-12-18 20:34:28 +00:00
(:require +ace-window)
2021-12-18 00:29:58 +00:00
(:option aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
aw-display-mode-overlay nil)
2021-12-29 00:20:07 +00:00
(:+key "M-o" #'+ace-window-or-switch-buffer)
2021-12-18 00:29:58 +00:00
(:face aw-mode-line-face ((t (:foreground "red"))))
(+ace-window-display-mode +1))
2021-12-30 18:27:55 +00:00
(setup (:straight (actually-selected-window
:host github
:repo "duckwork/actually-selected-window.el"))
(actually-selected-window-mode +1))
2022-01-05 05:57:39 +00:00
(setup (:straight adaptive-wrap)
(:with-mode adaptive-wrap-prefix-mode
(:hook-into visual-column-mode)))
(setup (:straight anzu)
2021-12-05 05:09:33 +00:00
(:option anzu-cons-mode-line-p nil)
2021-12-29 00:20:07 +00:00
(:+key [remap query-replace] #'anzu-query-replace-regexp
[remap query-replace-regexp] #'anzu-query-replace-regexp)
(global-anzu-mode +1)
(:bind-into isearch
2021-12-29 00:20:07 +00:00
[remap isearch-query-replace] #'anzu-isearch-query-replace
[remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp))
2021-09-16 04:32:16 +00:00
(setup (:straight avy)
(:require avy +avy)
2021-12-29 00:20:07 +00:00
(:+key "M-j" #'avy-goto-char-timer)
(:bind-into isearch
2021-12-29 00:20:07 +00:00
"M-j" #'avy-isearch)
(:when-loaded
2021-12-29 00:20:07 +00:00
(setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)))
2021-09-16 04:32:16 +00:00
2021-12-31 03:14:06 +00:00
(setup (:straight (cape
:host github :repo "minad/cape"))
(dolist (fn
;; All available cape capfs listed here. Add them to the front since
;; they're reversed with `add-to-list'.
2021-12-31 05:07:58 +00:00
'(cape-file
2021-12-31 03:14:06 +00:00
cape-dabbrev
2021-12-31 05:07:58 +00:00
cape-keyword
cape-abbrev
cape-ispell
;;cape-dict))
2022-01-03 16:37:03 +00:00
(add-to-list 'completion-at-point-functions fn :append)))))
2021-11-23 05:07:32 +00:00
(setup (:straight (capf-autosuggest
:host nil
:repo "https://repo.or.cz/emacs-capf-autosuggest.git"))
(:hook-into eshell-mode
comint-mode))
2021-09-16 04:32:16 +00:00
2021-09-25 19:03:00 +00:00
(setup (:straight circe)
(:require _circe
+circe)
(:also-load circe-chanop)
(+ensure-after-init (lambda () (defalias 'irc '+irc "Start IRC.")))
2021-10-22 00:00:43 +00:00
;; Formatting options
2022-01-03 23:05:03 +00:00
(:option
;; Messages between users
circe-format-action (format (format "%%%ds* {nick} {body}"
(- +circe-left-margin 2))
" ")
circe-format-say (format "{nick:%1$d.%1$ds} | {body}"
(- +circe-left-margin 3))
circe-format-self-action circe-format-action
circe-format-self-say (replace-regexp-in-string "|" ">" circe-format-say)
circe-format-notice (format "-{nick:%1$d.%1$ds}---{body}"
(- +circe-left-margin 4))
circe-format-message (format (format "%%%ds@ *{nick}* {body}"
(- +circe-left-margin 2))
" ")
circe-format-message-action (replace-regexp-in-string "@" "*"
circe-format-message)
circe-format-self-message (format (format "%%%ds> *{chattarget}* {body}"
(- +circe-left-margin 2))
" ")
;; Meta messages
circe-format-server-channel-creation-time (+circe-format-meta
(concat "Channel {channel}"
" created on {date}") t)
circe-format-server-ctcp (+circe-format-meta
(concat "CTCP PING request to {target} from"
" {userhost}: {body}"))
circe-format-server-ctcp-ping-reply (+circe-format-meta
(concat
"CTCP PING reply to {target} from"
" {userhost}: {body}"))
circe-format-server-part (+circe-format-meta "PART {channel}: {reason}")
circe-format-server-quit (+circe-format-meta "QUIT: {reason}")
circe-format-server-quit-channel (+circe-format-meta
"QUIT {channel}: {reason}")
circe-format-server-join (+circe-format-meta "JOIN: {userinfo}")
circe-format-server-join-in-channel (+circe-format-meta
"JOIN {channel}: {userinfo}")
circe-format-server-lurker-activity (+circe-format-meta
"(JOINED {joindelta} ago)")
circe-format-server-message (+circe-format-meta "{body}" t)
circe-fromat-server-mode-change (+circe-format-meta
(concat "MODE: {target} {change}"
" by {setter} ({userhost})") t)
circe-format-server-netmerge (+circe-format-meta
(concat "NETMERGE: {split} at {date}"
" (/WL to see who's still missing)") t)
circe-format-server-netsplit (+circe-format-meta
(concat "NETSPLIT: {split}"
" (/WL to see who left)") t)
circe-format-server-nick-change (+circe-format-meta
"NICK WAS {old-nick} ({userhost})"
"new-nick")
circe-format-server-nick-regain (+circe-format-meta
"NICK REGAINED: {old-nick} ({userhost})"
"new-nick")
circe-format-server-notice (+circe-format-meta "-SERVER NOTICE- {body}" t)
circe-format-server-topic-time (+circe-format-meta
"TOPIC SET BY {setter} on {topic-date}")
circe-format-server-topic-time-for-channel (+circe-format-meta
(concat
"TOPIC ({channel}) SET BY"
" {setter} on {topic-date}"))
circe-format-server-whois-idle (+circe-format-meta "IDLE FOR {idle-duration}"
"whois-nick")
circe-format-server-whois-idle-with-signon (+circe-format-meta
(concat
"IDLE FOR {idle-duration}"
" (signon: {signon-date})")
"whois-nick")
circe-format-server-rejoin (+circe-format-meta
(concat "REJOIN: {userinfo} "
"after {departuredelta}"))
circe-format-server-topic (+circe-format-meta "TOPIC: {new-topic}")
circe-prompt-string (format (format "%%%ds> "
(- +circe-left-margin 2))
" "))
2021-12-30 04:55:55 +00:00
2021-11-23 05:08:46 +00:00
(:option +circe-server-buffer-action (lambda (buf)
(message "Connected to %s" buf))
+circe-network-inhibit-autoconnect _circe-network-inhibit-autoconnect
circe-network-options _circe-network-options
circe-color-nicks-everywhere t
circe-default-part-message "See You, Space Cowpokes . . ."
circe-default-user user-real-login-name
2021-09-25 19:03:00 +00:00
circe-reduce-lurker-spam t
circe-server-auto-join-default-type :after-auth)
2021-12-29 00:20:07 +00:00
(:bind "C-c C-p" #'circe-command-PART
"C-c C-t" #'+circe-current-topic
"C-l" #'lui-track-jump-to-indicator
"C-<return>" #'+circe-chat@set-prompt)
(advice-add #'circe-command-PART :after #'+circe-kill-buffer)
(advice-add #'circe-command-QUIT :after #'+circe-quit@kill-buffer)
(advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer)
2021-12-30 04:55:55 +00:00
2021-09-25 19:03:00 +00:00
(:with-mode circe-chat-mode
2021-12-29 00:20:07 +00:00
(:hook #'enable-circe-color-nicks
#'enable-circe-new-day-notifier
#'+circe-chat@set-prompt)
(:bind "C-c C-s" #'circe-command-SLAP))
2021-09-25 19:03:00 +00:00
(:with-mode lui-mode
(:option lui-fill-column (+ fill-column +circe-left-margin)
lui-fill-type nil
2021-09-25 19:03:00 +00:00
lui-time-stamp-position 'right-margin
lui-time-stamp-format "[ %H:%M"
2021-09-25 19:03:00 +00:00
lui-track-behavior 'before-switch-to-buffer
2022-01-05 05:57:39 +00:00
lui-track-indicator 'bar
2021-12-18 20:33:49 +00:00
lui-fill-remove-face-from-newline nil
lui-formatting-list `((,(+lui-make-formatting-list-rx "*")
1 lui-strong-face)
(,(+lui-make-formatting-list-rx "_")
1 lui-emphasis-face)
(,(+lui-make-formatting-list-rx "/")
2022-01-03 21:17:33 +00:00
1 lui-emphasis-face)))
(add-to-list '+pulse-location-commands #'lui-track-jump-to-indicator)
2021-12-29 00:20:07 +00:00
(:hook #'visual-line-mode
#'enable-lui-track
#'visual-fill-column-mode
(defun +disable-electric-pair-mode ()
"Disable `electric-pair-mode' in the current buffer."
(interactive)
(electric-pair-local-mode -1)))
(:local-set fringes-outside-margins t
right-margin-width (length lui-time-stamp-format)
2021-09-25 19:03:00 +00:00
scroll-margin 0
word-wrap t
wrap-prefix (+string-repeat +circe-left-margin " ")
line-number-mode nil
column-number-mode nil
file-percentage-mode nil
visual-fill-column-extra-text-width
(cons +circe-left-margin 0)))
2021-10-15 01:34:46 +00:00
2021-12-20 04:11:39 +00:00
(with-eval-after-load 'topsy
(:option (append topsy-mode-functions)
'(circe-channel-mode . +circe-current-topic)))
2021-12-26 19:05:05 +00:00
(with-eval-after-load 'circe-color-nicks
2021-12-29 00:20:07 +00:00
(add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset))
(add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs))
2021-09-25 19:03:00 +00:00
(setup (:straight consult)
(:also-load +consult)
;; from Consult wiki
2021-09-16 04:32:16 +00:00
(:option register-preview-delay 0
2022-01-07 04:55:26 +00:00
register-preview-function #'consult-register-format
xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref
2022-01-03 16:37:03 +00:00
tab-always-indent 'complete
2022-01-07 04:55:26 +00:00
completion-in-region-function #'consult-completion-in-region)
2021-12-29 00:20:07 +00:00
(advice-add #'register-preview :override #'consult-register-window)
(advice-add #'completing-read-multiple :override
2022-01-03 16:37:03 +00:00
#'consult-completing-read-multiple)
(dolist (binding '(;; C-c bindings (mode-specific-map)
2022-01-03 16:37:03 +00:00
("C-c h" . consult-history)
("C-c m" . consult-mode-command)
("C-c b" . consult-bookmark)
("C-c k" . consult-kmacro)
;; C-x bindings (ctl-x-map)
("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop)
("<f1> a" . consult-apropos)
;; M-g bindings (goto-map)
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ; or consult-flycheck
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline) ; or consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings (search-map)
("M-s f" . consult-find)
("M-s F" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s m" . consult-multi-occur)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)))
(global-set-key (kbd (car binding)) (cdr binding)))
(with-eval-after-load 'isearch-mode
(dolist (binding '(("M-e" . consult-isearch-history)
2022-01-03 16:37:03 +00:00
("M-s e" . consult-isearch-history)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)))
(define-key isearch-mode-map (car binding) (cdr binding))))
(with-eval-after-load 'org-mode
(define-key org-mode-map "M-g o" 'consult-org-heading))
2021-12-29 04:15:12 +00:00
(advice-add 'consult-yank-pop :after '+yank@indent)
(with-eval-after-load 'consult
(:option consult-narrow-key "<"
2022-01-03 16:37:03 +00:00
consult-project-root-function '+consult-project-root)
(consult-customize
consult-theme
:preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-file consult--source-project-file
consult--source-bookmark
:preview-key (kbd "M-."))
(consult-history-to-modes ((minibuffer-local-map . nil)
(shell-mode-map . shell-mode-hook)
(term-mode-map . term-mode-hook)
(term-raw-map . term-mode-hook)
(comint-mode-map . comint-mode-hook)
(sly-mrepl-mode-map . sly-mrepl-hook)))
(with-eval-after-load 'orderless
(:option consult--regexp-compiler 'consult--orderless-regexp-compiler))))
2021-09-16 04:32:16 +00:00
2022-01-07 04:55:26 +00:00
(setup (:straight consult-dir)
(:+key "C-x C-d" #'consult-dir)
(:with-map vertico-map
(:bind "C-x C-d" #'consult-dir
"C-x C-j" #'consult-dir-jump-file)))
2021-12-06 04:37:41 +00:00
(setup (:straight crux)
2022-01-04 06:40:26 +00:00
;; yes it's silly I have an addon to this addon.
(:also-load +crux)
(:option crux-shell-func #'crux-eshell
+crux-default-date-format "%F")
2022-01-04 06:40:26 +00:00
(:global "C-o" #'crux-smart-open-line
"C-x 4 t" #'crux-transpose-windows
"M-w" #'+crux-kill-ring-save
"C-k" #'crux-kill-and-join-forward
"C-c d" #'+crux-insert-date-or-time)
(:+leader "s" #'crux-visit-shell-buffer)
2021-12-06 04:37:41 +00:00
(el-patch-feature crux)
(with-eval-after-load 'crux
(el-patch-defun crux-reopen-as-root ()
"Find file as root if necessary.
Meant to be used as `find-file-hook'.
See also `crux-reopen-as-root-mode'."
(unless (or
;; This helps fix for `nov-mode', and possibly others.
(el-patch-add (null buffer-file-name))
(tramp-tramp-file-p buffer-file-name)
(equal major-mode 'dired-mode)
(not (file-exists-p (file-name-directory buffer-file-name)))
(file-writable-p buffer-file-name)
(crux-file-owned-by-user-p buffer-file-name))
(crux-find-alternate-file-as-root buffer-file-name))))
(crux-reopen-as-root-mode +1))
2021-09-25 19:03:00 +00:00
(setup (:straight dictionary)
(:option dictionary-use-single-buffer t)
(autoload 'dictionary-search "dictionary"
"Ask for a word and search it in all dictionaries" t)
2022-01-05 17:25:00 +00:00
(:hook #'reading-mode)
(define-key +lookup-mode-map "d" #'dictionary-search))
2021-09-16 04:32:16 +00:00
(setup (:straight (discord
:host github
:repo "davep/discord.el"
:fork (:repo "duckwork/discord.el"))))
(setup (:straight electric-cursor)
(:option electric-cursor-alist '((overwrite-mode . hbar)
(god-local-mode . box)))
2021-09-16 04:32:16 +00:00
(electric-cursor-mode +1))
(setup (:straight elfeed)
(:also-load +elfeed)
2022-01-04 04:37:34 +00:00
(+define-dir elfeed/ (sync/ "emacs/elfeed/" t))
(:option
elfeed-curl-program-name (executable-find "curl")
elfeed-use-curl elfeed-curl-program-name
elfeed-curl-extra-arguments '("--insecure")
elfeed-enclosure-default-dir (cl-loop for dir in '("~/var/download/"
"~/Downloads/")
if (file-exists-p dir)
return dir)
elfeed-search-filter "@1-month-ago +unread"
elfeed-search-trailing-width 24
elfeed-search-title-min-width 24
elfeed-search-title-max-width 78
elfeed-show-unique-buffers t
elfeed-db-directory (elfeed/ "db/" t))
2022-01-04 23:26:37 +00:00
(:with-mode elfeed-search-mode
(:hook #'hl-line-mode)
;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/
(advice-add #'elfeed-search-update--force :after #'elfeed-db-save))
(:with-mode elfeed-show-mode
2021-12-29 00:20:07 +00:00
(:bind "SPC" #'+elfeed-scroll-up-command
"S-SPC" #'+elfeed-scroll-down-command)
2022-01-04 04:37:34 +00:00
(:hook #'reading-mode)
(define-advice elfeed-show-entry (:after (&rest _))
2022-01-04 20:40:26 +00:00
"Re-flow the entry a short time after showing it."
2022-01-04 23:26:37 +00:00
(run-at-time 0.1 nil #'elfeed-show-refresh))))
(setup (:straight elfeed-org)
2022-01-04 20:41:46 +00:00
(:option rmh-elfeed-org-files (list (elfeed/ "elfeed.org" t)))
(elfeed-org))
2022-01-04 04:37:46 +00:00
(setup (:straight elpher))
(setup (:straight embark)
2022-01-07 04:55:26 +00:00
(:option prefix-help-command 'embark-prefix-help-command
embark-keymap-prompter-key ";")
2021-12-29 00:20:07 +00:00
(:+key "C-." #'embark-act
2021-12-31 03:14:06 +00:00
"M-." #'embark-dwim
"<f1> B" #'embark-bindings)
2022-01-03 16:36:32 +00:00
(:with-map minibuffer-local-map
(:bind "C-." #'embark-act)))
2021-09-16 04:32:16 +00:00
(setup (:straight embark-consult)
(:load-after consult embark)
2021-12-29 00:20:07 +00:00
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
2021-12-31 05:07:58 +00:00
(setup (:straight epithet)
(dolist (hook '(Info-selection-hook
eww-after-render-hook
help-mode-hook
occur-mode-hook))
(add-hook hook #'epithet-rename-buffer)))
2021-12-06 04:37:41 +00:00
(setup (:straight eros)
(:hook-into emacs-lisp-mode
lisp-interaction-mode))
2022-01-04 04:37:58 +00:00
(setup (:straight eshell-bookmark)
(add-hook 'eshell-mode-hook #'eshell-bookmark-setup))
(setup (:straight eshell-syntax-highlighting)
(:hook-into eshell-mode))
(setup (:straight-when exec-path-from-shell
2022-01-05 03:10:07 +00:00
(eq system-system 'linux))
2022-01-06 00:20:40 +00:00
(require 'exec-path-from-shell)
2022-01-05 03:10:07 +00:00
(dolist (var '("SSH_AUTH_SOCK"
"SSH_AGENT_PID"
"GPG_AGENT_INFO"
"LANG"
"LC_CTYPE"
"XDG_CONFIG_HOME"
"XDG_CONFIG_DIRS"
"XDG_DATA_HOME"
"XDG_DATA_DIRS"
"XDG_CACHE_HOME"))
(add-to-list 'exec-path-from-shell-variables var))
(exec-path-from-shell-initialize))
2021-09-04 15:38:06 +00:00
(setup (:straight expand-region)
(:also-load +expand-region)
(:option expand-region-fast-keys-enabled nil)
(:+key "C-=" #'er/expand-region
"C--" #'+er/contract-or-negative-argument))
2021-09-14 21:56:56 +00:00
2021-12-31 03:14:06 +00:00
(setup (:straight (fill-sentences-correctly
:host github
:repo "duckwork/fill-sentences-correctly.el"))
(fill-sentences-correctly-mode +1))
(setup (:straight (filldent
:host github
:repo "duckwork/filldent.el"))
(:+key "M-q" #'filldent-dwim))
(setup (:straight flyspell-correct)
2022-01-06 21:46:50 +00:00
(:+also-load +flyspell-correct )
(:option flyspell-correct--cr-key ";")
(:bind-into flyspell
2022-01-06 21:46:50 +00:00
"C-;" #'flyspell-correct-wrapper
"<f7>" #'+flyspell-correct-buffer))
(setup (:straight-when (forge
:host github :repo "magit/forge")
2022-01-05 03:10:07 +00:00
(eq system-system 'linux))
(require 'forge)
(add-to-list 'forge-alist
'("tildegit.org" "tildegit.org/api/v1" "tildegit.org"
forge-gitea-repository)))
2022-01-05 17:31:12 +00:00
(setup (:straight form-feed)
(global-form-feed-mode +1))
(setup (:straight (frowny
:host github
:repo "duckwork/frowny.el"))
(global-frowny-mode +1))
2021-09-04 15:38:06 +00:00
(setup (:straight gcmh)
(:option gcmh-idle-delay 'auto)
(gcmh-mode +1))
2021-12-26 19:05:20 +00:00
(setup (:straight-when geiser
(progn
(defvar +schemes
(let (schemes)
(dolist (scheme '(("scheme" . geiser-chez) ; chez
("petite" . geiser-chez) ; petite
("csi" . geiser-chicken) ; chicken
("gsi" . geiser-gambit)
("gosh" . geiser-gauche)
("guile" . geiser-guile)
("kawa" . geiser-kawa)
("mit-scheme" . geiser-mit)
("racket" . geiser-racket)
("stklos" . geiser-stklos)))
(when-let (binary (executable-find (car scheme)))
(push binary schemes)
;; and install the proper helper package
(straight-use-package (cdr scheme))))
(nreverse schemes)))
+schemes))
(:file-match (rx ".rkt" eos)
(rx ".scm" eos)))
(setup (:straight god-mode)
(setq god-mode-enable-function-key-translation nil)
(:also-load +god-mode)
(:+key "C-M-g" #'god-local-mode)
(:with-mode god-local-mode
(:bind "i" #'+god-mode-insert
"a" #'+god-mode-append)))
2021-09-04 15:38:06 +00:00
(setup (:straight helpful)
(run-with-idle-timer 0.5 nil
'require 'helpful)
2021-12-29 00:20:07 +00:00
(:+key "<f1> f" #'helpful-callable
"<f1> v" #'helpful-variable
"<f1> k" #'helpful-key
2022-01-03 21:18:58 +00:00
"<f1> ." #'helpful-at-point))
2021-10-14 22:26:33 +00:00
(setup (:straight (hippie-completing-read
:host github
:repo "duckwork/hippie-completing-read"))
2021-12-29 00:20:07 +00:00
(:+key "M-/" #'hippie-completing-read))
2021-10-14 22:26:33 +00:00
2021-09-04 15:38:06 +00:00
(setup (:straight hungry-delete)
(:option hungry-delete-chars-to-skip " \t"
2022-01-03 16:37:03 +00:00
hungry-delete-join-reluctantly nil)
(:bind-into paredit
2021-12-20 04:11:39 +00:00
;; I define these functions here because they really require both packages
;; to make any sense. So, would I put them in `+hungry-delete' or
;; `+paredit' ? There's no satisfactory answer.
[remap paredit-backward-delete]
(defun acdw/paredit-hungry-delete-backward (arg)
(interactive "P")
(if (looking-back "[ \t]" 1)
2022-01-03 16:37:03 +00:00
(hungry-delete-backward (or arg 1))
(paredit-backward-delete arg)))
[remap paredit-forward-delete]
(defun acdw/paredit-hungry-delete-forward (arg)
(interactive "P")
(if (looking-at "[ \t]")
2022-01-03 16:37:03 +00:00
(hungry-delete-forward (or arg 1))
(paredit-forward-delete arg))))
(global-hungry-delete-mode +1))
(setup (:straight isearch-mb)
;; This complicatedness is an attempt to make it easier to add and
;; subtract `isearch-mb' bindings using the suggestions in the
;; project's README.
(with-eval-after-load 'isearch-mb
(dolist (spec '((isearch-mb--with-buffer
2022-01-03 16:37:03 +00:00
("M-e" . consult-isearch)
("C-o" . loccur-isearch))
(isearch-mb--after-exit
("M-%" . anzu-isearch-query-replace)
("M-s l" . consult-line))))
(let ((isearch-mb-list (car spec))
2022-01-03 16:37:03 +00:00
(isearch-mb-binds (cdr spec)))
(dolist (cell isearch-mb-binds)
(let ((key (car cell))
(command (cdr cell)))
(when (fboundp command)
(add-to-list isearch-mb-list command)
(define-key isearch-mb-minibuffer-map (kbd key) command)))))))
(isearch-mb-mode +1))
2021-10-02 00:06:13 +00:00
(setup (:straight-when keychain-environment
(executable-find "keychain"))
(keychain-refresh-environment))
2021-09-04 15:38:06 +00:00
(setup (:straight lacarte)
2021-12-29 00:20:07 +00:00
(:+key "<f10>" #'lacarte-execute-menu-command))
2021-09-04 15:38:06 +00:00
(setup (:straight (lin :host gitlab :repo "protesilaos/lin"))
(require 'lin)
(:hook-into dired-mode
elfeed-search-mode
git-rebase-mode
ibuffer-mode
ledger-report-mode
log-view-mode
magit-log-mode
notmuch-search-mode
notmuch-tree-mode
org-agenda-mode
tabulated-list-mode))
2021-12-31 21:45:06 +00:00
(setup (:straight link-hint)
(:require +link-hint)
(+link-hint-setup-open-secondary)
(:option link-hint-avy-style 'at-full)
2022-01-05 17:24:46 +00:00
(:+key "M-l" +link-hint-map)
(:with-map +link-hint-map
(:bind "M-l" #'+link-hint-open-link "l" #'+link-hint-open-link
"M-m" #'link-hint-open-multiple-links
"m" #'link-hint-open-multiple-links
"M-c" #'link-hint-copy-link "c" #'link-hint-copy-link)))
2021-12-31 21:45:06 +00:00
2021-09-04 15:38:06 +00:00
(setup (:straight marginalia)
(marginalia-mode +1))
(setup (:straight minions)
(:option minions-prominent-modes
'(tracking-mode))
(minions-mode +1))
2021-09-04 15:38:06 +00:00
2022-01-02 01:25:44 +00:00
(setup (:straight (mode-line-bell
:fork (:host github :repo "duckwork/mode-line-bell")))
2021-10-21 23:59:54 +00:00
(:option mode-line-bell-flash-time 0.1)
(mode-line-bell-mode +1))
2021-09-04 15:38:06 +00:00
(setup (:straight (modus-themes
:host gitlab
:repo "protesilaos/modus-themes"))
(require 'modus-themes (.etc "straight/build/modus-themes/modus-themes"))
(:option modus-themes-bold-constructs t
modus-themes-italic-constructs t
modus-themes-headings '((t . (background))))
(+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi))
2021-09-04 15:38:06 +00:00
(setup (:straight mwim)
(:+key "C-a" #'mwim-beginning
"C-e" #'mwim-end))
(setup (:straight orderless)
(:option completion-styles '(orderless)))
(setup (:straight org-appear)
2021-09-23 22:11:30 +00:00
(:option org-appear-autoemphasis t
org-appear-autoentities t
org-appear-autokeywords t
org-appear-autolinks nil
org-appear-autosubmarkers t
org-appear-delay 0)
(:hook-into org-mode))
(setup (:straight org-sticky-header)
(:hook-into org-mode))
2022-01-02 01:25:49 +00:00
(setup (:straight org-visibility)
2022-01-02 16:00:47 +00:00
(:option org-visibility-state-file (.etc "org-visibility")
org-visibility-include-regexps '("\\.org\\'"))
2022-01-02 01:25:49 +00:00
(org-visibility-enable-hooks))
2021-12-31 21:45:15 +00:00
(setup (:straight package-lint
package-lint-flymake)
(add-hook 'emacs-mode-hook #'package-lint-flymake-setup)
;; Remove it from init.el files
(add-hook '+init-mode-hook #'flymake-mode-off))
2021-12-30 04:55:55 +00:00
2021-10-09 21:21:24 +00:00
(setup (:straight paredit)
2021-12-29 00:20:07 +00:00
(:bind "DEL" #'paredit-backward-delete
2022-01-06 21:47:42 +00:00
"C-<backspace>" #'paredit-backward-kill-word
2022-01-07 04:55:26 +00:00
"C-w" (lambda (arg) (interactive "P")
(+kill-word-backward-or-region arg
#'paredit-backward-kill-word))
"M-s" nil)
2021-12-30 04:55:55 +00:00
(dolist (hook '(emacs-lisp-mode-hook
eval-expression-minibuffer-setup-hook
ielm-mode-hook
lisp-interaction-mode-hook
lisp-mode-hook
scheme-mode-hook))
(add-hook hook #'enable-paredit-mode))
2021-10-09 21:21:24 +00:00
(:also-load eldoc)
2021-12-29 00:20:07 +00:00
(eldoc-add-command #'paredit-backward-delete #'paredit-close-round))
2021-10-09 21:21:24 +00:00
2021-09-04 15:38:06 +00:00
(setup (:straight paren-face)
(:hook-into emacs-lisp-mode
ielm-mode sly-repl-mode
lisp-mode
lisp-interaction-mode
scheme-mode))
2021-09-04 15:38:06 +00:00
(setup (:straight-when pdf-tools
2022-01-05 03:10:07 +00:00
;; Ensure we can build `pdf-tools'
(or (executable-find "gcc")
(executable-find "g++")))
(pdf-tools-install t))
2021-09-28 04:07:50 +00:00
(setup (:straight (shell-command+
:host nil
:repo "https://git.sr.ht/~pkal/shell-command-plus"))
2021-09-04 15:38:06 +00:00
(:option shell-command-prompt "$ ")
(:bind-into dired
"M-!" 'shell-command+)
2021-12-29 00:20:07 +00:00
(:+key "M-!" #'shell-command+))
2021-10-02 05:04:16 +00:00
2021-12-26 19:05:20 +00:00
(setup (:straight sicp))
2021-12-05 05:09:33 +00:00
(setup (:straight (simple-modeline
2021-12-30 04:55:55 +00:00
:fork (:host github :repo "duckwork/simple-modeline")))
2021-12-31 06:10:51 +00:00
(:require +modeline)
2021-12-30 04:55:55 +00:00
(:option simple-modeline-segments `((;; left
+modeline-ace-window-display
2021-12-05 05:09:33 +00:00
+modeline-modified
2021-12-30 04:55:55 +00:00
,(+modeline-concat
'(+modeline-god-mode
+modeline-reading-mode
2021-12-30 04:55:55 +00:00
+modeline-narrowed)
",")
2021-12-05 05:09:33 +00:00
+modeline-buffer-name
+modeline-position
+modeline-anzu
)
(;; right
+modeline-track
+modeline-vc
simple-modeline-segment-misc-info
simple-modeline-segment-process
+modeline-text-scale
2021-12-05 05:09:33 +00:00
+modeline-minions
2021-12-26 19:05:05 +00:00
+modeline-major-mode
)))
2021-12-05 05:09:33 +00:00
(simple-modeline-mode +1))
(setup (:straight smartscan)
2022-01-07 04:55:26 +00:00
(:with-map smartscan-map
(:bind "M-'" nil))
2021-12-27 04:49:50 +00:00
(:hook-into prog-mode))
2022-01-03 23:16:35 +00:00
(setup (:straight (sophomore
:host github
:repo "duckwork/sophomore.el"))
2022-01-04 22:45:45 +00:00
(sophomore-disable #'view-hello-file)
(sophomore-mode +1))
2022-01-03 23:16:35 +00:00
2021-06-03 04:38:30 +00:00
(setup (:straight ssh-config-mode)
2021-09-04 15:38:06 +00:00
(:file-match (rx "/.ssh/config" eos)
(rx "/ssh" (? "d") "_config" eos))
(:with-mode ssh-known-hosts-mode
(:file-match (rx "/knownhosts" eos)))
(:with-mode ssh-authorized-keys-mode
(:file-match (rx "/authorized_keys" (? "2") eos))))
2021-06-03 04:38:30 +00:00
2021-09-27 23:21:23 +00:00
(setup (:straight super-save)
(:option auto-save-default nil
2021-10-11 23:03:50 +00:00
super-save-auto-save-when-idle t
super-save-idle-duration 60
2021-09-27 23:21:23 +00:00
super-save-exclude '(".gpg")
super-save-remote-files nil)
(auto-save-visited-mode -1)
(super-save-mode +1))
2021-12-27 04:48:45 +00:00
(setup (:straight (titlecase
:host github
2021-12-29 00:20:16 +00:00
:repo "duckwork/titlecase.el"
2022-01-04 20:40:46 +00:00
:files ("*")))
(:with-map +casing-mode-map
2022-01-04 20:40:46 +00:00
(:bind "t" #'titlecase-dwim)))
2021-12-27 04:48:45 +00:00
(setup (:straight topsy)
(:hook-into prog-mode
circe-chat-mode)
(:when-loaded
(:option
topsy-header-line-format
'(:eval
(list
(propertize " "
'display
2021-12-30 04:55:55 +00:00
`((space
:align-to
,(unless (bound-and-true-p visual-fill-column-mode)
0))))
(funcall topsy-fn))))))
2022-01-04 06:40:34 +00:00
(setup (:straight transpose-frame)
(defvar +transpose-frame-map
(let ((map (make-sparse-keymap)))
(dolist (bind '(("t" . transpose-frame)
("v" . flip-frame)
("h" . flop-frame)
("r" . rotate-frame-clockwise)
("R" . rotate-frame-anticlockwise)))
(define-key map (car bind) (cdr bind)))
map)
"Map for transposing frames.")
(define-key +key-mode-map (kbd "C-x 5 t") +transpose-frame-map))
2021-09-06 17:52:51 +00:00
(setup (:straight trashed)
(:option trashed-action-confirmer #'y-or-n-p))
(setup (:straight undo-fu)
(:+key "C-/" #'undo-fu-only-undo
"C-?" #'undo-fu-only-redo))
2021-04-03 14:48:05 +00:00
(setup (:straight undo-fu-session)
(:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'"
"/git-rebase-todo\\'")
undo-fu-session-directory (.etc "undo/" t)
2022-01-05 03:10:07 +00:00
undo-fu-session-compression (executable-find "gzip"))
(global-undo-fu-session-mode +1))
2021-09-04 15:38:06 +00:00
(setup (:straight (vertico
:host github
:repo "minad/vertico"
:files ("*" "extensions/*"
(:exclude ".git"))))
2021-12-18 00:30:41 +00:00
(:also-load +vertico)
2021-09-04 15:38:06 +00:00
(:option resize-mini-windows 'grow-only
vertico-count-format nil
vertico-cycle t)
2021-12-29 00:20:07 +00:00
(advice-add #'vertico-next :around #'+vertico-ding-wrap)
2021-09-04 15:38:06 +00:00
(when (boundp 'native-comp-deferred-compilation-deny-list)
(add-to-list 'native-comp-deferred-compilation-deny-list "vertico"))
(vertico-mode +1)
;; Extensions
(:also-load vertico-directory)
2021-09-23 22:11:30 +00:00
(:with-map vertico-map
2021-12-29 00:20:07 +00:00
(:bind "RET" #'vertico-directory-enter
"DEL" #'vertico-directory-delete-char
"M-DEL" #'vertico-directory-delete-word))
(add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
2021-09-04 15:38:06 +00:00
2021-10-02 00:06:13 +00:00
(setup (:straight visual-fill-column)
2021-12-26 19:03:24 +00:00
(:option visual-fill-column-center-text t
(append reading-modes) '(visual-fill-column-mode . +1))
2021-12-29 00:20:07 +00:00
(:hook #'visual-line-mode)
2021-10-02 00:06:13 +00:00
(:hook-into org-mode)
2021-12-29 00:20:07 +00:00
(advice-add #'text-scale-adjust :after #'visual-fill-column-adjust))
2021-09-04 15:38:06 +00:00
(setup (:straight vlf)
(:require vlf-setup))
2021-09-04 15:38:06 +00:00
(setup (:straight whitespace-cleanup-mode)
2022-01-04 06:40:50 +00:00
(:option whitespace-cleanup-mode-preserve-point t
whitespace-cleanup-mode-only-if-initially-clean nil)
2021-09-04 15:38:06 +00:00
(global-whitespace-cleanup-mode +1))
2021-12-05 05:09:33 +00:00
(setup (:straight wrap-region)
(:require wrap-region)
(wrap-region-add-wrappers
'(("*" "*" nil org-mode)
("~" "~" nil org-mode)
("/" "/" nil org-mode)
("=" "=" nil org-mode)
("+" "+" nil org-mode)
("_" "_" nil org-mode)
("$" "$" nil (org-mode latex-mode))))
(:hook-into org-mode
latex-mode))
2021-12-26 19:05:25 +00:00
(setup (:straight zoom-frm))
2021-12-05 05:09:33 +00:00
(setup (:straight zzz-to-char)
2022-01-05 23:12:03 +00:00
(:require +zzz-to-char)
(:option zzz-to-char-reach 1024)
(:global "M-z" #'+zzz-to-char))