about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--early-init.el28
-rw-r--r--init.el105
-rw-r--r--lisp/+crux.el46
-rw-r--r--lisp/+setup.el25
-rw-r--r--lisp/acdw.el6
5 files changed, 141 insertions, 69 deletions
diff --git a/early-init.el b/early-init.el index 77a9ecf..02f92c2 100644 --- a/early-init.el +++ b/early-init.el
@@ -55,22 +55,22 @@ See `no-littering' for examples.")
55;;; Default frame settings 55;;; Default frame settings
56 56
57(setq default-frame-alist '((tool-bar-lines . 0) 57(setq default-frame-alist '((tool-bar-lines . 0)
58 (menu-bar-lines . 0) 58 (menu-bar-lines . 0)
59 (vertical-scroll-bars) 59 (vertical-scroll-bars)
60 (horizontal-scroll-bars)) 60 (horizontal-scroll-bars))
61 frame-inhibit-implied-resize t 61 frame-inhibit-implied-resize t
62 frame-resize-pixelwise t 62 frame-resize-pixelwise t
63 window-resize-pixelwise t 63 window-resize-pixelwise t
64 inhibit-x-resources t 64 inhibit-x-resources t
65 indicate-empty-lines nil 65 indicate-empty-lines nil
66 indicate-buffer-boundaries '((top . right) 66 indicate-buffer-boundaries '((top . right)
67 (bottom . right))) 67 (bottom . right)))
68 68
69;; Fonts 69;; Fonts
70 70
71(let ((font-name "Go Mono") 71(let ((font-name "DejaVu Sans Mono")
72 (font-size 105) 72 (font-size 105)
73 (variable-font-name "Go") 73 (variable-font-name "DejaVu Sans")
74 (variable-font-size 1.0)) 74 (variable-font-size 1.0))
75 (set-face-attribute 'default nil :family font-name 75 (set-face-attribute 'default nil :family font-name
76 :height font-size :weight 'book) 76 :height font-size :weight 'book)
@@ -84,9 +84,9 @@ See `no-littering' for examples.")
84(setq package-enable-at-startup nil 84(setq package-enable-at-startup nil
85 package-quickstart nil 85 package-quickstart nil
86 straight-host-usernames '((github . "duckwork") 86 straight-host-usernames '((github . "duckwork")
87 (gitlab . "acdw")) 87 (gitlab . "acdw"))
88 straight-check-for-modifications '(check-on-save 88 straight-check-for-modifications '(check-on-save
89 find-when-checking)) 89 find-when-checking))
90 90
91(setq no-littering-etc-directory .etc 91(setq no-littering-etc-directory .etc
92 no-littering-var-directory .etc 92 no-littering-var-directory .etc
@@ -117,17 +117,17 @@ See `no-littering' for examples.")
117(require 'straight-x) 117(require 'straight-x)
118 118
119(dolist (pkg '(el-patch 119(dolist (pkg '(el-patch
120 no-littering 120 no-littering
121 setup)) 121 setup))
122 (straight-use-package pkg) 122 (straight-use-package pkg)
123 (require pkg) 123 (require pkg)
124 (require (intern (format "+%s" pkg)) nil :noerror)) 124 (require (intern (format "+%s" pkg)) nil :noerror))
125 125
126;;; Appendix 126;; Setup `setup'
127
128(add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors)
127 129
128;; I've patched setup to look at `setup-ensure-function-inhibit' to decide 130;;; Appendix
129;; whether to ensure functions or not with local macros.
130(setq setup-ensure-function-inhibit t)
131 131
132;; Get rid of a dumb alias. straight-ಠ_ಠ-mode really slows down all 132;; Get rid of a dumb alias. straight-ಠ_ಠ-mode really slows down all
133;; minibuffer completion functions. Since it's a (rarely-used, even) 133;; minibuffer completion functions. Since it's a (rarely-used, even)
diff --git a/init.el b/init.el index 26f8c47..bb6006d 100644 --- a/init.el +++ b/init.el
@@ -21,20 +21,19 @@
21 private)) 21 private))
22 (require (or (car-safe feature) feature) (cdr-safe feature) :noerror)) 22 (require (or (car-safe feature) feature) (cdr-safe feature) :noerror))
23 23
24(setq debug-on-error t) 24(setq debug-on-error (memq system-type '(msdos windows-nt)))
25 25
26(setup (:require +emacs) 26(setup (:require +emacs)
27 (:also-load +lisp)
28 ;; +emacs.el contains super-basic defaults that are basically necessary for 27 ;; +emacs.el contains super-basic defaults that are basically necessary for
29 ;; good functioning. In this block, I add extra things or more "experimental" 28 ;; good functioning. In this block, I add extra things or more "experimental"
30 ;; ones that might not belong in a separate file. 29 ;; ones that might not belong in a separate file.
30 (:also-load +lisp)
31 (:option truncate-string-ellipsis "…") 31 (:option truncate-string-ellipsis "…")
32 ;; Bindings 32 ;; Bindings
33 (:global "C-x C-k" #'kill-current-buffer 33 (:global "C-x C-k" #'kill-current-buffer
34 "C-x 4 n" #'clone-buffer 34 "C-x 4 n" #'clone-buffer
35 "C-c v" #'visible-mode 35 "C-c v" #'visible-mode
36 "C-M-;" #'+lisp-comment-or-uncomment-sexp 36 "C-M-;" #'+lisp-comment-or-uncomment-sexp)
37 "<f12>" #'consult-buffer)
38 ;; Unbind stuff, too. 37 ;; Unbind stuff, too.
39 (dolist (key '("C-M-j" 38 (dolist (key '("C-M-j"
40 "M-j")) 39 "M-j"))
@@ -56,10 +55,7 @@
56 (+ensure-after-init #'+key-global-mode)) 55 (+ensure-after-init #'+key-global-mode))
57 56
58(setup (:require auth-source) 57(setup (:require auth-source)
59 (:option auth-sources (list (private/ "authinfo") 58 (:option auth-sources (list (private/ "authinfo"))))
60 (private/ "authinfo.gpg")
61 "~/.authinfo"
62 "~/.authinfo.gpg")))
63 59
64(setup (:require goto-addr) 60(setup (:require goto-addr)
65 (if (fboundp #'global-goto-address-mode) 61 (if (fboundp #'global-goto-address-mode)
@@ -139,7 +135,7 @@
139 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites 135 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
140 browse-url-secondary-browser-function) 136 browse-url-secondary-browser-function)
141 (cons "." ; everything else 137 (cons "." ; everything else
142 browse-url-browser-function))) 138 +browse-url-browser-function)))
143 ;; Transform URLs before passing to `browse-url' 139 ;; Transform URLs before passing to `browse-url'
144 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com" 140 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
145 "youtu.be")) 141 "youtu.be"))
@@ -193,11 +189,16 @@
193 dired+) 189 dired+)
194 (:option dired-recursive-copies 'always 190 (:option dired-recursive-copies 'always
195 dired-recursive-deletes 'always 191 dired-recursive-deletes 'always
196 dired-create-destination-dirs 'ask 192 dired-create-destination-dirs 'always
193 dired-do-revert-buffer t
194 dired-hide-details-hide-symlink-targets nil
195 dired-isearch-filenames 'dwim
197 delete-by-moving-to-trash t 196 delete-by-moving-to-trash t
197 dired-auto-revert-buffer t
198 dired-listing-switches "-Al" 198 dired-listing-switches "-Al"
199 ls-lisp-dirs-first t 199 ls-lisp-dirs-first t
200 dired-ls-F-marks-symlinks t 200 dired-ls-F-marks-symlinks t
201 dired-clean-confirm-killing-deleted-buffers nil
201 dired-no-confirm '(byte-compile 202 dired-no-confirm '(byte-compile
202 load chgrp chmod chown 203 load chgrp chmod chown
203 copy move hardlink symlink 204 copy move hardlink symlink
@@ -256,8 +257,14 @@
256 (add-hook 'eshell-mode-hook 257 (add-hook 'eshell-mode-hook
257 (defun +eshell@setup () 258 (defun +eshell@setup ()
258 "Eshell improperly does loading. Gah." 259 "Eshell improperly does loading. Gah."
260 (interactive)
259 (dolist (setting `((outline-regexp . ,eshell-prompt-regexp) 261 (dolist (setting `((outline-regexp . ,eshell-prompt-regexp)
260 (page-delimiter . ,eshell-prompt-regexp))) 262 (page-delimiter . ,eshell-prompt-regexp)
263 (imenu-generic-expression
264 . ,`(("Prompt"
265 ,(concat eshell-prompt-regexp
266 "\\(.*\\)")
267 1)))))
261 (set (make-local-variable (car setting)) (cdr setting))) 268 (set (make-local-variable (car setting)) (cdr setting)))
262 (dolist (binding `(("C-d" . +eshell-quit-or-delete-char))) 269 (dolist (binding `(("C-d" . +eshell-quit-or-delete-char)))
263 (define-key eshell-mode-map 270 (define-key eshell-mode-map
@@ -328,14 +335,7 @@
328 ;; This setup is weird because of dependency issues 335 ;; This setup is weird because of dependency issues
329 (:straight (transient :host github :repo "magit/transient" :branch "master") 336 (:straight (transient :host github :repo "magit/transient" :branch "master")
330 (magit :host github :repo "magit/magit") 337 (magit :host github :repo "magit/magit")
331 (git-modes :host github :repo "magit/git-modes")) 338 (git-modes :host github :repo "magit/git-modes")))
332 (when (eq system-type 'gnu/linux)
333 (:straight (forge :host github :repo "magit/forge"))
334 (with-eval-after-load 'magit
335 (require 'forge)
336 (add-to-list 'forge-alist
337 '("tildegit.org" "tildegit.org/api/v1" "tildegit.org"
338 forge-gitea-repository)))))
339 339
340(setup minibuffer 340(setup minibuffer
341 (:require +minibuffer) 341 (:require +minibuffer)
@@ -775,8 +775,15 @@
775 (:option consult--regexp-compiler 'consult--orderless-regexp-compiler)))) 775 (:option consult--regexp-compiler 'consult--orderless-regexp-compiler))))
776 776
777(setup (:straight crux) 777(setup (:straight crux)
778 (:+key "C-o" #'crux-smart-open-line 778 ;; yes it's silly I have an addon to this addon.
779 "C-x 4 t" #'crux-transpose-windows) 779 (:also-load +crux)
780 (:option crux-shell-func #'crux-eshell)
781 (:global "C-o" #'crux-smart-open-line
782 "C-x 4 t" #'crux-transpose-windows
783 "M-w" #'+crux-kill-ring-save
784 "C-k" #'crux-kill-and-join-forward
785 "C-c d" #'+crux-insert-date-or-time)
786 (:+leader "s" #'crux-visit-shell-buffer)
780 787
781 (el-patch-feature crux) 788 (el-patch-feature crux)
782 (with-eval-after-load 'crux 789 (with-eval-after-load 'crux
@@ -826,21 +833,36 @@ See also `crux-reopen-as-root-mode'."
826 833
827(setup (:straight elfeed) 834(setup (:straight elfeed)
828 (:also-load +elfeed) 835 (:also-load +elfeed)
829 (:option elfeed-use-curl t 836 (+define-dir elfeed/ (sync/ "emacs/elfeed/" t))
830 elfeed-curl-extra-arguments '("--insecure") 837 (:option
831 elfeed-show-unique-buffers t 838 elfeed-curl-program-name (executable-find "curl")
832 elfeed-db-directory (sync/ "elfeed/db/" t)) 839 elfeed-use-curl elfeed-curl-program-name
840 elfeed-curl-extra-arguments '("--insecure")
841 elfeed-enclosure-default-dir (cl-loop for dir in '("~/var/download/"
842 "~/Downloads/")
843 if (file-exists-p dir)
844 return dir)
845 elfeed-search-filter "@1-month-ago +unread"
846 elfeed-search-trailing-width 24
847 elfeed-search-title-min-width 24
848 elfeed-search-title-max-width 78
849 elfeed-show-unique-buffers t
850 elfeed-db-directory (elfeed/ "db/" t))
833 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ 851 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/
834 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save) 852 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)
835 (:with-mode elfeed-show-mode 853 (:with-mode elfeed-show-mode
836 (:bind "SPC" #'+elfeed-scroll-up-command 854 (:bind "SPC" #'+elfeed-scroll-up-command
837 "S-SPC" #'+elfeed-scroll-down-command) 855 "S-SPC" #'+elfeed-scroll-down-command)
838 (:hook #'reading-mode))) 856 (:hook #'reading-mode)
857 (define-advice elfeed-show-entry (:after (&rest _))
858 (run-at-time 0 nil #'elfeed-show-refresh))))
839 859
840(setup (:straight elfeed-org) 860(setup (:straight elfeed-org)
841 (:option rmh-elfeed-org-files (list (sync/ "elfeed/elfeed.org" t))) 861 (:option rmh-elfeed-org-files (list (elfeed/ "/elfeed.org" t)))
842 (elfeed-org)) 862 (elfeed-org))
843 863
864(setup (:straight elpher))
865
844(setup (:straight embark) 866(setup (:straight embark)
845 (:option prefix-help-command 'embark-prefix-help-command) 867 (:option prefix-help-command 'embark-prefix-help-command)
846 (:+key "C-." #'embark-act 868 (:+key "C-." #'embark-act
@@ -864,6 +886,9 @@ See also `crux-reopen-as-root-mode'."
864 (:hook-into emacs-lisp-mode 886 (:hook-into emacs-lisp-mode
865 lisp-interaction-mode)) 887 lisp-interaction-mode))
866 888
889(setup (:straight eshell-bookmark)
890 (add-hook 'eshell-mode-hook #'eshell-bookmark-setup))
891
867(setup (:straight eshell-syntax-highlighting) 892(setup (:straight eshell-syntax-highlighting)
868 (:hook-into eshell-mode)) 893 (:hook-into eshell-mode))
869 894
@@ -890,6 +915,14 @@ See also `crux-reopen-as-root-mode'."
890 :repo "duckwork/filldent.el")) 915 :repo "duckwork/filldent.el"))
891 (:+key "M-q" #'filldent-dwim)) 916 (:+key "M-q" #'filldent-dwim))
892 917
918(setup (:straight-when (forge
919 :host github :repo "magit/forge")
920 (eq system-type 'gnu/linux))
921 (require 'forge)
922 (add-to-list 'forge-alist
923 '("tildegit.org" "tildegit.org/api/v1" "tildegit.org"
924 forge-gitea-repository)))
925
893(setup (:straight (frowny 926(setup (:straight (frowny
894 :host github 927 :host github
895 :repo "duckwork/frowny.el")) 928 :repo "duckwork/frowny.el"))
@@ -1078,7 +1111,7 @@ See also `crux-reopen-as-root-mode'."
1078 1111
1079(setup (:straight-when pdf-tools 1112(setup (:straight-when pdf-tools
1080 (eq system-type 'gnu/linux)) 1113 (eq system-type 'gnu/linux))
1081 (pdf-tools-install)) 1114 (pdf-tools-install t))
1082 1115
1083(setup (:straight (shell-command+ 1116(setup (:straight (shell-command+
1084 :host nil 1117 :host nil
@@ -1161,7 +1194,18 @@ See also `crux-reopen-as-root-mode'."
1161 0)))) 1194 0))))
1162 (funcall topsy-fn)))))) 1195 (funcall topsy-fn))))))
1163 1196
1164(setup (:straight transpose-frame)) 1197(setup (:straight transpose-frame)
1198 (defvar +transpose-frame-map
1199 (let ((map (make-sparse-keymap)))
1200 (dolist (bind '(("t" . transpose-frame)
1201 ("v" . flip-frame)
1202 ("h" . flop-frame)
1203 ("r" . rotate-frame-clockwise)
1204 ("R" . rotate-frame-anticlockwise)))
1205 (define-key map (car bind) (cdr bind)))
1206 map)
1207 "Map for transposing frames.")
1208 (define-key +key-mode-map (kbd "C-x 5 t") +transpose-frame-map))
1165 1209
1166(setup (:straight trashed) 1210(setup (:straight trashed)
1167 (:option trashed-action-confirmer #'y-or-n-p)) 1211 (:option trashed-action-confirmer #'y-or-n-p))
@@ -1209,7 +1253,8 @@ See also `crux-reopen-as-root-mode'."
1209 (:require vlf-setup)) 1253 (:require vlf-setup))
1210 1254
1211(setup (:straight whitespace-cleanup-mode) 1255(setup (:straight whitespace-cleanup-mode)
1212 (:option whitespace-cleanup-mode-preserve-point t) 1256 (:option whitespace-cleanup-mode-preserve-point t
1257 whitespace-cleanup-mode-only-if-initially-clean nil)
1213 (global-whitespace-cleanup-mode +1)) 1258 (global-whitespace-cleanup-mode +1))
1214 1259
1215(setup (:straight zoom-frm)) 1260(setup (:straight zoom-frm))
diff --git a/lisp/+crux.el b/lisp/+crux.el new file mode 100644 index 0000000..b87ec7e --- /dev/null +++ b/lisp/+crux.el
@@ -0,0 +1,46 @@
1;;; +crux.el -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(require 'crux)
6
7(defgroup +crux nil
8 "Extra crux customizations."
9 :group 'crux
10 :prefix "+crux-")
11
12(defun +crux-kill-ring-save (begin end arg)
13 "Copy region to the kill-ring, possibly indenting it first.
14Copy from BEGIN to END using `kill-ring-save' if no argument was
15passed, or with `crux-indent-rigidly-and-copy-to-clipboard' if
16one was."
17 (interactive "r\nP")
18 (call-interactively (if arg #'kill-ring-save
19 #'crux-indent-rigidly-and-copy-to-clipboard)))
20
21(defcustom +crux-default-date-format "%c"
22 "Default date format to use for `+crux-insert-date-or-time'.
23Should be a format parsable by `format-time-string'."
24 :type 'string)
25
26(defcustom +crux-alternate-date-format "%FT%T%z"
27 "Alternate date format to use for `+crux-insert-date-or-time'.
28Should be a format parsable by `format-time-string'."
29 :type 'string)
30
31(defun +crux-insert-date-or-time (arg)
32 "Insert current date or time.
33Called without a prefix ARG, insert the time formatted by
34`+crux-default-date-format'. When called with \\[universal-argument],
35format the time with `+crux-alternate-date-format'. Otherwise,
36prompt for the time format."
37 (interactive "*P")
38 (let ((time (current-time)))
39 (insert (cond
40 ((null arg) (format-time-string +crux-default-date-format time))
41 ((eq (car-safe arg) 4)
42 (format-time-string +crux-alternate-date-format time))
43 (t (format-time-string (read-string "Time Format: ") time))))))
44
45(provide '+crux)
46;;; +crux.el ends here
diff --git a/lisp/+setup.el b/lisp/+setup.el index ac99c1f..c6bcb9e 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el
@@ -24,31 +24,6 @@
24(require 'setup) 24(require 'setup)
25(require 'straight) 25(require 'straight)
26 26
27;; I don't like the "magic" `setup' performs to ensure a symbol is a
28;; function in `:global', `:bind', `:hook', `:hook-into', and others.
29;; So here, I'll just make it return the symbol unmodified.
30(el-patch-feature setup)
31(with-eval-after-load 'setup
32 (el-patch-defvar
33 (el-patch-add setup-ensure-function-inhibit nil
34 "Whether to inhibit `setup-ensure-function'."))
35 (el-patch-defun setup-ensure-function (sexp)
36 (el-patch-concat
37 "Attempt to return SEXP as a quoted function name."
38 (el-patch-add
39 "\nIf `setup-ensure-function-inhibit' is non-nil, just return SEXP."))
40 (el-patch-wrap 3 0
41 (if (and setup-ensure-function-inhibit
42 (not (eq sexp (setup-get 'mode))))
43 sexp
44 (cond ((eq (car-safe sexp) 'function)
45 sexp)
46 ((eq (car-safe sexp) 'quote)
47 `#',(cadr sexp))
48 ((symbolp sexp)
49 `#',sexp)
50 (sexp))))))
51
52(setup-define :face 27(setup-define :face
53 (lambda (face spec) 28 (lambda (face spec)
54 `(custom-set-faces '(,face ,spec 'now "Customized by `setup'."))) 29 `(custom-set-faces '(,face ,spec 'now "Customized by `setup'.")))
diff --git a/lisp/acdw.el b/lisp/acdw.el index 43cb5c7..a4e12f1 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -83,5 +83,11 @@ If Emacs is already started, run FUNCTION. Otherwise, add it to
83 (funcall function) 83 (funcall function)
84 (add-hook 'after-init-hook function))) 84 (add-hook 'after-init-hook function)))
85 85
86(defun +remember-prefix-arg (p-arg P-arg)
87 "Display prefix ARG, in \"p\" and \"P\" `interactive' types.
88I keep forgetting how they differ."
89 (interactive "p\nP")
90 (message "p: %S P: %S" p-arg P-arg))
91
86(provide 'acdw) 92(provide 'acdw)
87;;; acdw.el ends here 93;;; acdw.el ends here