about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-10 08:33:43 -0600
committerCase Duckworth2022-01-10 08:33:43 -0600
commit2918cb39a25558b8896bf212b68e22d1fde02032 (patch)
treee6eef338bddf327236d305ef0310fd793e9f8062
parentAdd markdown (diff)
parentAdd a few packages and .. stuff (diff)
downloademacs-2918cb39a25558b8896bf212b68e22d1fde02032.tar.gz
emacs-2918cb39a25558b8896bf212b68e22d1fde02032.zip
Merge branch 'main' of https://tildegit.org/acdw/emacs
-rw-r--r--init.el156
-rw-r--r--lisp/+apheleia.el3
-rw-r--r--lisp/+casing.el25
-rw-r--r--lisp/+circe.el130
-rw-r--r--lisp/+elfeed.el13
-rw-r--r--lisp/+embark.el4
-rw-r--r--lisp/+lookup.el26
-rw-r--r--lisp/+org-capture.el16
-rw-r--r--lisp/+vertico.el8
-rw-r--r--lisp/acdw.el10
10 files changed, 268 insertions, 123 deletions
diff --git a/init.el b/init.el index 46cd281..ae61b87 100644 --- a/init.el +++ b/init.el
@@ -38,11 +38,12 @@
38 "C-x o" (lambda () (interactive) (switch-to-buffer nil)) 38 "C-x o" (lambda () (interactive) (switch-to-buffer nil))
39 "C-x C-o" #'+open-paragraph 39 "C-x C-o" #'+open-paragraph
40 "C-w" #'+kill-word-backward-or-region 40 "C-w" #'+kill-word-backward-or-region
41 "C-x C-1" #'delete-other-windows 41 ;; "C-x C-1" #'delete-other-windows
42 "C-x 2" #'+split-window-below-then 42 ;; "C-x 2" #'+split-window-below-then
43 "C-x C-2" #'+split-window-below-then 43 ;; "C-x C-2" #'+split-window-below-then
44 "C-x 3" #'+split-window-right-then 44 ;; "C-x 3" #'+split-window-right-then
45 "C-x C-3" #'+split-window-right-then) 45 ;; "C-x C-3" #'+split-window-right-then
46 )
46 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults 47 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
47 (global-set-key (kbd "C-h") 'delete-backward-char) 48 (global-set-key (kbd "C-h") 'delete-backward-char)
48 (keyboard-translate ?\C-h ?\C-?) 49 (keyboard-translate ?\C-h ?\C-?)
@@ -58,9 +59,6 @@
58 (:bind "C-c s" #'+init-sort-then-save) 59 (:bind "C-c s" #'+init-sort-then-save)
59 (:hook #'+init-add-setup-to-imenu)) 60 (:hook #'+init-add-setup-to-imenu))
60 61
61(setup (:require +lookup)
62 (+lookup-mode +1))
63
64(setup (:require auth-source) 62(setup (:require auth-source)
65 (:option auth-sources (list (private/ "authinfo")))) 63 (:option auth-sources (list (private/ "authinfo"))))
66 64
@@ -109,6 +107,9 @@
109 (:option pulse-flag nil 107 (:option pulse-flag nil
110 pulse-delay 0.5 108 pulse-delay 0.5
111 pulse-iterations 1) 109 pulse-iterations 1)
110 (dolist (command '(+ace-window-or-switch-buffer
111 pop-mark pop-globl-mark))
112 (add-to-list '+pulse-location-commands command))
112 (+ensure-after-init #'+pulse-location-mode)) 113 (+ensure-after-init #'+pulse-location-mode))
113 114
114(setup (:require reading) 115(setup (:require reading)
@@ -137,6 +138,15 @@
137 (:option 138 (:option
138 browse-url-browser-function #'eww-browse-url 139 browse-url-browser-function #'eww-browse-url
139 +browse-url-browser-function browse-url-browser-function 140 +browse-url-browser-function browse-url-browser-function
141 browse-url-generic-program (seq-some #'executable-find
142 '("firefox"
143 "chromium"
144 "chrome"))
145 browse-url-generic-args (seq-some (lambda (e)
146 (when (equal (executable-find (car e))
147 browse-url-generic-program)
148 (cdr e)))
149 '(("firefox" "--new-tab")))
140 browse-url-secondary-browser-function (if (executable-find "firefox") 150 browse-url-secondary-browser-function (if (executable-find "firefox")
141 #'browse-url-firefox 151 #'browse-url-firefox
142 #'browse-url-default-browser) 152 #'browse-url-default-browser)
@@ -230,7 +240,7 @@
230 copy move hardlink symlink 240 copy move hardlink symlink
231 shell touch) 241 shell touch)
232 dired-dwim-target t) 242 dired-dwim-target t)
233 (:local-set truncate-lines nil) 243 (:local-set truncate-lines t)
234 (:bind "<backspace>" #'dired-up-directory 244 (:bind "<backspace>" #'dired-up-directory
235 "TAB" #'dired-subtree-cycle 245 "TAB" #'dired-subtree-cycle
236 "i" #'dired-subtree-toggle 246 "i" #'dired-subtree-toggle
@@ -475,13 +485,19 @@
475 (with-eval-after-load 'org 485 (with-eval-after-load 'org
476 (org-clock-persistence-insinuate) 486 (org-clock-persistence-insinuate)
477 (org-link-set-parameters "tel" :follow #'+org-tel-open)) 487 (org-link-set-parameters "tel" :follow #'+org-tel-open))
478 ;; Fancy list bullets 488 ;; Extra keywords
479 (font-lock-add-keywords 489 (font-lock-add-keywords
480 'org-mode 490 'org-mode
481 '(("^ *\\([-]\\) " 491 '(;; Fancy list bullets
492 ("^ *\\([-]\\) "
482 (0 (compose-region (match-beginning 1) (match-end 1) "•"))) 493 (0 (compose-region (match-beginning 1) (match-end 1) "•")))
483 ("^ *\\([+]\\) " 494 ("^ *\\([+]\\) "
484 (0 (compose-region (match-beginning 1) (match-end 1) "◦")))))) 495 (0 (compose-region (match-beginning 1) (match-end 1) "◦"))))
496 (with-eval-after-load 'form-feed
497 ;; Horizontal lines
498 (font-lock-add-keywords
499 'org-mode
500 '(("^-----+" 0 'form-feed--font-lock-face t))))))
485 501
486(setup org-agenda 502(setup org-agenda
487 (:option org-agenda-skip-deadline-if-done t 503 (:option org-agenda-skip-deadline-if-done t
@@ -586,9 +602,6 @@
586 (executable-find "diff")) 602 (executable-find "diff"))
587 (:require apheleia 603 (:require apheleia
588 +apheleia) 604 +apheleia)
589 (setf (alist-get 'indent-region apheleia-formatters) #'+apheleia-indent-region
590 (alist-get 'emacs-lisp-mode apheleia-mode-alist) 'indent-region
591 (alist-get 'lisp-interaction-mode apheleia-mode-alist) 'indent-region)
592 (apheleia-global-mode +1)) 605 (apheleia-global-mode +1))
593 606
594(setup (:straight avy) 607(setup (:straight avy)
@@ -721,9 +734,15 @@
721 (advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer) 734 (advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer)
722 735
723 (:with-mode circe-chat-mode 736 (:with-mode circe-chat-mode
737 (:local-set lui-input-function #'+lui-filter)
724 (:hook #'enable-circe-color-nicks 738 (:hook #'enable-circe-color-nicks
725 #'enable-circe-new-day-notifier 739 #'enable-circe-new-day-notifier
726 #'+circe-chat@set-prompt) 740 #'+circe-chat@set-prompt
741 ;; Filters
742 #'+circe-F/C-mode
743 ;; For some reason `+circe-shorten-url-mode' won't work right out of
744 ;; the gate.
745 (lambda () (run-with-idle-timer 0.25 nil #'+circe-shorten-url-mode)))
727 (:bind "C-c C-s" #'circe-command-SLAP)) 746 (:bind "C-c C-s" #'circe-command-SLAP))
728 747
729 (:with-mode lui-mode 748 (:with-mode lui-mode
@@ -889,14 +908,16 @@ See also `crux-reopen-as-root-mode'."
889 (:option dictionary-use-single-buffer t) 908 (:option dictionary-use-single-buffer t)
890 (autoload 'dictionary-search "dictionary" 909 (autoload 'dictionary-search "dictionary"
891 "Ask for a word and search it in all dictionaries" t) 910 "Ask for a word and search it in all dictionaries" t)
892 (:hook #'reading-mode) 911 (:hook #'reading-mode))
893 (define-key +lookup-mode-map "d" #'dictionary-search))
894 912
895(setup (:straight (discord 913(setup (:straight (discord
896 :host github 914 :host github
897 :repo "davep/discord.el" 915 :repo "davep/discord.el"
898 :fork (:repo "duckwork/discord.el")))) 916 :fork (:repo "duckwork/discord.el"))))
899 917
918(setup (:straight dumb-jump)
919 (add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
920
900(setup (:straight electric-cursor) 921(setup (:straight electric-cursor)
901 (:option electric-cursor-alist '((overwrite-mode . hbar) 922 (:option electric-cursor-alist '((overwrite-mode . hbar)
902 (god-local-mode . box))) 923 (god-local-mode . box)))
@@ -918,15 +939,20 @@ See also `crux-reopen-as-root-mode'."
918 elfeed-search-title-min-width 24 939 elfeed-search-title-min-width 24
919 elfeed-search-title-max-width 78 940 elfeed-search-title-max-width 78
920 elfeed-show-unique-buffers t 941 elfeed-show-unique-buffers t
921 elfeed-db-directory (elfeed/ "db/" t)) 942 elfeed-db-directory (elfeed/ "db/" t)
922 (:+key "C-x w" #'+elfeed) 943 elfeed-log 'debug ; until I can figure out syncing...
944 )
945 (:+key "C-x w" #'elfeed)
923 (:with-mode elfeed-search-mode 946 (:with-mode elfeed-search-mode
947 (:bind "&" #'+elfeed-search-browse-generic)
924 (:hook #'hl-line-mode) 948 (:hook #'hl-line-mode)
925 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ 949 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/
926 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)) 950 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)
951 (advice-add #'elfeed :before #'elfeed-db-load))
927 (:with-mode elfeed-show-mode 952 (:with-mode elfeed-show-mode
928 (:bind "SPC" #'+elfeed-scroll-up-command 953 (:bind "SPC" #'+elfeed-scroll-up-command
929 "S-SPC" #'+elfeed-scroll-down-command) 954 "S-SPC" #'+elfeed-scroll-down-command
955 "&" #'+elfeed-show-browse-generic)
930 (:hook #'reading-mode) 956 (:hook #'reading-mode)
931 ;; (define-advice elfeed-show-entry (:after (&rest _)) 957 ;; (define-advice elfeed-show-entry (:after (&rest _))
932 ;; "Re-flow the entry a short time after showing it." 958 ;; "Re-flow the entry a short time after showing it."
@@ -945,14 +971,16 @@ See also `crux-reopen-as-root-mode'."
945(setup (:straight elpher)) 971(setup (:straight elpher))
946 972
947(setup (:straight embark) 973(setup (:straight embark)
948 (:also-load +embark) 974 (:require embark
975 +embark)
949 (:option prefix-help-command 'embark-prefix-help-command 976 (:option prefix-help-command 'embark-prefix-help-command
950 embark-keymap-prompter-key ";") 977 embark-keymap-prompter-key ";")
951 (:+key "C-." #'embark-act 978 (:+key "C-." #'embark-act
952 "M-." #'embark-dwim 979 "M-." #'embark-dwim
953 "<f1> B" #'embark-bindings) 980 "<f1> B" #'embark-bindings)
954 (:with-map minibuffer-local-map 981 (:with-map minibuffer-local-map
955 (:bind "C-." #'embark-act)) 982 (:bind "C-." #'embark-act
983 "M-." #'embark-dwim))
956 (:with-map embark-file-map 984 (:with-map embark-file-map
957 (:bind "l" #'vlf))) 985 (:bind "l" #'vlf)))
958 986
@@ -1059,14 +1087,14 @@ See also `crux-reopen-as-root-mode'."
1059 (:file-match (rx ".rkt" eos) 1087 (:file-match (rx ".rkt" eos)
1060 (rx ".scm" eos))) 1088 (rx ".scm" eos)))
1061 1089
1062(setup (:straight god-mode) 1090;; (setup (:straight god-mode)
1063 (setq god-mode-enable-function-key-translation nil) 1091;; (setq god-mode-enable-function-key-translation nil)
1064 (:require god-mode 1092;; (:require god-mode
1065 +god-mode) 1093;; +god-mode)
1066 (:+key "C-M-g" #'god-mode-all) 1094;; (:+key "C-M-g" #'god-mode-all)
1067 (:with-mode god-local-mode 1095;; (:with-mode god-local-mode
1068 (:bind "i" #'+god-mode-insert 1096;; (:bind "i" #'+god-mode-insert
1069 "a" nil))) 1097;; "a" nil)))
1070 1098
1071(setup (:straight helpful) 1099(setup (:straight helpful)
1072 (run-with-idle-timer 0.5 nil 1100 (run-with-idle-timer 0.5 nil
@@ -1132,17 +1160,9 @@ See also `crux-reopen-as-root-mode'."
1132 1160
1133(setup (:straight (lin :host gitlab :repo "protesilaos/lin")) 1161(setup (:straight (lin :host gitlab :repo "protesilaos/lin"))
1134 (require 'lin) 1162 (require 'lin)
1135 (:hook-into dired-mode 1163 (dolist (hook lin-foreign-hooks)
1136 elfeed-search-mode 1164 (add-hook hook #'hl-line-mode)
1137 git-rebase-mode 1165 (add-hook hook #'lin-mode)))
1138 ibuffer-mode
1139 ledger-report-mode
1140 log-view-mode
1141 magit-log-mode
1142 notmuch-search-mode
1143 notmuch-tree-mode
1144 org-agenda-mode
1145 tabulated-list-mode))
1146 1166
1147(setup (:straight link-hint) 1167(setup (:straight link-hint)
1148 (:require +link-hint) 1168 (:require +link-hint)
@@ -1155,6 +1175,11 @@ See also `crux-reopen-as-root-mode'."
1155 "m" #'link-hint-open-multiple-links 1175 "m" #'link-hint-open-multiple-links
1156 "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link))) 1176 "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link)))
1157 1177
1178(setup (:straight macrostep)
1179 (:require macrostep)
1180 (:with-mode emacs-lisp-mode
1181 (:bind "C-c e" #'macrostep-expand)))
1182
1158(setup (:straight marginalia) 1183(setup (:straight marginalia)
1159 (marginalia-mode +1)) 1184 (marginalia-mode +1))
1160 1185
@@ -1212,6 +1237,9 @@ See also `crux-reopen-as-root-mode'."
1212 org-visibility-include-regexps '("\\.org\\'")) 1237 org-visibility-include-regexps '("\\.org\\'"))
1213 (org-visibility-enable-hooks)) 1238 (org-visibility-enable-hooks))
1214 1239
1240(setup (:straight orglink)
1241 (global-orglink-mode +1))
1242
1215(setup (:straight package-lint 1243(setup (:straight package-lint
1216 package-lint-flymake) 1244 package-lint-flymake)
1217 (add-hook 'emacs-mode-hook #'package-lint-flymake-setup) 1245 (add-hook 'emacs-mode-hook #'package-lint-flymake-setup)
@@ -1317,8 +1345,10 @@ See also `crux-reopen-as-root-mode'."
1317 :host github 1345 :host github
1318 :repo "duckwork/titlecase.el" 1346 :repo "duckwork/titlecase.el"
1319 :files ("*"))) 1347 :files ("*")))
1320 (:with-map +casing-mode-map 1348 (:require titlecase)
1321 (:bind "t" #'titlecase-dwim))) 1349 (:with-map +casing-map
1350 (:bind "t" #'titlecase-dwim
1351 "M-t" #'titlecase-dwim)))
1322 1352
1323(setup (:straight topsy) 1353(setup (:straight topsy)
1324 (:hook-into ;;prog-mode 1354 (:hook-into ;;prog-mode
@@ -1377,11 +1407,37 @@ See also `crux-reopen-as-root-mode'."
1377 (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) 1407 (add-to-list 'native-comp-deferred-compilation-deny-list "vertico"))
1378 (vertico-mode +1) 1408 (vertico-mode +1)
1379 ;; Extensions 1409 ;; Extensions
1380 (:also-load vertico-directory) 1410 (:also-load vertico-directory
1411 vertico-mouse
1412 vertico-unobtrusive
1413 vertico-multiform)
1414 (vertico-mouse-mode +1)
1415 (vertico-multiform-mode +1)
1416 (:option vertico-multiform-commands '((execute-extended-command flat)
1417 (helpful-function)
1418 (helpful-macro)
1419 (helpful-callable)
1420 (helpful-variable))
1421 ;; This is applied /after/ the above, so default is at the end of
1422 ;; this alist.
1423 vertico-multiform-categories '((file buffer grid)
1424 (t unobtrusive)))
1425 (dolist (buf-cmd '(consult-find
1426 consult-locate
1427 consult-grep
1428 consult-git-grep
1429 consult-ripgrep
1430 consult-line
1431 consult-line-multi
1432 consult-multi-occur
1433 consult-keep-lines
1434 consult-focus-lines))
1435 (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer)))
1381 (:with-map vertico-map 1436 (:with-map vertico-map
1382 (:bind "RET" #'vertico-directory-enter 1437 (:bind "RET" #'vertico-directory-enter
1383 "DEL" #'vertico-directory-delete-char 1438 "DEL" #'vertico-directory-delete-char
1384 "M-DEL" #'vertico-directory-delete-word)) 1439 "M-DEL" #'vertico-directory-delete-word
1440 "TAB" #'+vertico-widen-or-complete))
1385 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) 1441 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
1386 1442
1387(setup (:straight visual-fill-column) 1443(setup (:straight visual-fill-column)
@@ -1412,6 +1468,12 @@ See also `crux-reopen-as-root-mode'."
1412 (:hook-into org-mode 1468 (:hook-into org-mode
1413 latex-mode)) 1469 latex-mode))
1414 1470
1471(setup (:straight yasnippet)
1472 (:option yas-snippet-dirs (list
1473 (expand-file-name "snippets" user-emacs-directory)
1474 (sync/ "emacs/snippets" t)))
1475 (yas-global-mode +1))
1476
1415(setup (:straight zoom-frm)) 1477(setup (:straight zoom-frm))
1416 1478
1417(setup (:straight zzz-to-char) 1479(setup (:straight zzz-to-char)
diff --git a/lisp/+apheleia.el b/lisp/+apheleia.el index f3b16e4..469232a 100644 --- a/lisp/+apheleia.el +++ b/lisp/+apheleia.el
@@ -8,9 +8,8 @@
8 (setq-local indent-line-function 8 (setq-local indent-line-function
9 (buffer-local-value 'indent-line-function orig)) 9 (buffer-local-value 'indent-line-function orig))
10 (indent-region (point-min) 10 (indent-region (point-min)
11(point-max)) 11 (point-max))
12 (funcall callback))) 12 (funcall callback)))
13 13
14(provide '+apheleia) 14(provide '+apheleia)
15;;; +apheleia.el ends here 15;;; +apheleia.el ends here
16 \ No newline at end of file
diff --git a/lisp/+casing.el b/lisp/+casing.el index 5f39b2e..c8e9e4d 100644 --- a/lisp/+casing.el +++ b/lisp/+casing.el
@@ -3,7 +3,6 @@
3;;; Code: 3;;; Code:
4 4
5(require 'thingatpt) 5(require 'thingatpt)
6(require '+key)
7 6
8;;;###autoload 7;;;###autoload
9(defun +upcase-dwim (arg) 8(defun +upcase-dwim (arg)
@@ -61,21 +60,23 @@ Otherwise, it calls `capitalize-word' on the word at point (using
61 60
62;; Later on, I'll add repeat maps and stuff in here... 61;; Later on, I'll add repeat maps and stuff in here...
63 62
63(defvar +casing-map (let ((map (make-sparse-keymap)))
64 (define-key map "u" #'+upcase-dwim)
65 (define-key map (kbd "M-u") #'+upcase-dwim)
66 (define-key map "l" #'+downcase-dwim)
67 (define-key map (kbd "M-l") #'+downcase-dwim)
68 (define-key map "c" #'+capitalize-dwim)
69 (define-key map (kbd "M-c") #'+capitalize-dwim)
70 map)
71 "Keymap for case-related twiddling.")
72
64(define-minor-mode +casing-mode 73(define-minor-mode +casing-mode
65 "Enable easy case-twiddling commands." 74 "Enable easy case-twiddling commands."
66 :lighter " cC" 75 :lighter " cC"
76 :global t
67 :keymap (let ((map (make-sparse-keymap))) 77 :keymap (let ((map (make-sparse-keymap)))
68 (define-key map "u" #'+upcase-dwim) 78 (define-key map (kbd "M-c") +casing-map)
69 (define-key map (kbd "M-u") #'+upcase-dwim) 79 map))
70 (define-key map "l" #'+downcase-dwim)
71 (define-key map (kbd "M-l") #'+downcase-dwim)
72 (define-key map "c" #'+capitalize-dwim)
73 (define-key map (kbd "M-c") #'+capitalize-dwim)
74 map)
75 (define-key +key-mode-map (kbd "M-c") (when +casing-mode
76 +casing-mode-map)))
77
78(defvaralias '+casing-map '+casing-mode-map)
79 80
80(provide '+casing) 81(provide '+casing)
81;;; +casing.el ends here 82;;; +casing.el ends here
diff --git a/lisp/+circe.el b/lisp/+circe.el index c29cea6..3d6ea60 100644 --- a/lisp/+circe.el +++ b/lisp/+circe.el
@@ -101,9 +101,11 @@ For entry into `lui-formatting-list'."
101 101
102(defun +circe-kill-buffer (&rest _) 102(defun +circe-kill-buffer (&rest _)
103 "Kill a circe buffer without confirmation, and after a delay." 103 "Kill a circe buffer without confirmation, and after a delay."
104 (let ((circe-channel-killed-confirmation nil) 104 (let ((circe-channel-killed-confirmation)
105 (circe-server-killed-confirmation nil)) 105 (circe-server-killed-confirmation))
106 (run-with-timer 0.25 nil 'kill-buffer))) 106 (when (derived-mode-p 'lui-mode) ; don't spuriously kill
107 (ignore-errors
108 (kill-buffer)))))
107 109
108(defun +circe-quit@kill-buffer (&rest _) 110(defun +circe-quit@kill-buffer (&rest _)
109 "ADVICE: kill all buffers of a server after `circe-command-QUIT'." 111 "ADVICE: kill all buffers of a server after `circe-command-QUIT'."
@@ -115,9 +117,11 @@ For entry into `lui-formatting-list'."
115 117
116(defun +circe-gquit@kill-buffer (&rest _) 118(defun +circe-gquit@kill-buffer (&rest _)
117 "ADVICE: kill all Circe buffers after `circe-command-GQUIT'." 119 "ADVICE: kill all Circe buffers after `circe-command-GQUIT'."
118 (dolist (buf (circe-server-buffers)) 120 (let ((circe-channel-killed-confirmation)
119 (with-current-buffer buf 121 (circe-server-killed-confirmation))
120 (+circe-quit@kill-buffer)))) 122 (dolist (buf (circe-server-buffers))
123 (with-current-buffer buf
124 (+circe-quit@kill-buffer)))))
121 125
122(defun +circe-quit-all@kill-emacs () 126(defun +circe-quit-all@kill-emacs ()
123 "Quit all circe buffers when killing Emacs." 127 "Quit all circe buffers when killing Emacs."
@@ -165,28 +169,104 @@ See `circe-network-options' for a list of common options."
165 (funcall +circe-server-buffer-action buffer)))) 169 (funcall +circe-server-buffer-action buffer))))
166 170
167;;; Chat commands 171;;; Chat commands
168;; TODO: Actually ... write these~!?!?!
169
170(defun circe-command-SHORTEN (url)
171 "Shorten URL using `0x0-shorten-uri'.")
172 172
173(defun circe-command-SLAP (nick) 173(defun circe-command-SLAP (nick)
174 "Slap NICK around a bit with a large trout.") 174 "Slap NICK around a bit with a large trout."
175 175 (interactive (list (completing-read "Nick to slap: "
176(defun circe-command-POKE (nick) 176 (circe-channel-nicks)
177 "Poke NICK like in the old Facebook days.") 177 nil t nil)))
178 178 (circe-command-ME (format "slaps %s about a bit with a large trout" nick)))
179;;; Pure idiocy 179
180 180;;; Filtering functions
181(define-minor-mode circe-cappy-hour-mode 181;; Set `lui-input-function' to `+lui-filter', then add the filters you want to
182;; `circe-channel-mode-hook'.
183
184(require 'dash)
185
186(defvar +lui-filters nil
187 "Stack of input functions to apply.
188This is an alist with cells of the structure (TAG . FN), so we
189can easily remove elements.")
190(make-variable-buffer-local '+lui-filters)
191
192(defun +lui-filter (text &optional fn-alist)
193 (let ((fs (nreverse (purecopy (or fn-alist +lui-filters)))))
194 (while fs
195 (setq text (funcall (cdr (pop fs)) text)))
196 (circe--input text)))
197
198(defmacro +circe-define-filter (name docstring &rest body)
199 "Define a filter for circe-inputted text."
200 (declare (doc-string 2)
201 (indent 1))
202 (let (plist)
203 (while (keywordp (car-safe body))
204 (push (pop body) plist)
205 (push (pop body) plist))
206 ;; Return value
207 `(define-minor-mode ,name
208 ,docstring
209 ,@(nreverse plist)
210 (when (derived-mode-p 'circe-chat-mode)
211 (if ,name
212 (push '(,name . (lambda (it) ,@body)) +lui-filters)
213 (setq +lui-filters
214 (assoc-delete-all ',name +lui-filters)))))))
215
216;; CAPPY HOUR! (Pure idiocy)
217
218(+circe-define-filter +circe-cappy-hour-mode
182 "ENABLE CAPPY HOUR IN CIRCE!" 219 "ENABLE CAPPY HOUR IN CIRCE!"
183 :lighter "CAPPY HOUR" 220 :lighter " CAPPY HOUR"
184 (when (derived-mode-p 'circe-chat-mode) 221 (upcase it))
185 (if circe-cappy-hour-mode 222
186 (setq-local lui-input-function 223;; URL Shortener
187 (lambda (input) (circe--input (upcase input)))) 224
188 ;; XXX: It'd be better if this were more general, but whatever. 225(+circe-define-filter +circe-shorten-url-mode
189 (setq-local lui-input-function #'circe--input)))) 226 "Shorten long urls when chatting."
227 :lighter " c0x0"
228 (+circe-0x0-shorten-urls it))
229
230(defvar +circe-0x0-max-length 20
231 "Maximum length of URLs before using a shortener.")
232
233(defun +circe-0x0-shorten-urls (text)
234 "Find urls in TEXT and shorten them using `0x0'."
235 (require '0x0)
236 (require 'browse-url)
237 (let ((case-fold-search t))
238 (replace-regexp-in-string
239 browse-url-button-regexp
240 (lambda (match)
241 (if (> (length match) +circe-0x0-max-length)
242 (+with-message (format "Shortening URL: %s" match)
243 (0x0-shorten-uri (0x0--choose-server)
244 (substring-no-properties match)))
245 match))
246 text)))
247
248;; Temperature conversion
249
250(+circe-define-filter +circe-F/C-mode
251 "Convert degF to degF/degC for international chats."
252 :lighter " F/C"
253 (str-F/C it))
254
255(defun fahrenheit-to-celsius (degf)
256 "Convert DEGF to Celsius."
257 (round (* (/ 5.0 9.0) (- degf 32))))
258
259(defun celsius-to-fahrenheit (degc)
260 "Convert DEGC to Fahrenheit."
261 (round (+ 32 (* (/ 9.0 5.0) degc))))
262
263(defun str-F/C (text)
264 (replace-regexp-in-string "[0-9.]+[Ff]"
265 (lambda (match)
266 (format "%s/%dC" match
267 (fahrenheit-to-celsius
268 (string-to-number match))))
269 text))
190 270
191(provide '+circe) 271(provide '+circe)
192;;; +circe.el ends here 272;;; +circe.el ends here
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index c26bfab..9e5f787 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -21,12 +21,15 @@
21 (scroll-down-command arg) 21 (scroll-down-command arg)
22 (error (elfeed-show-prev))))) 22 (error (elfeed-show-prev)))))
23 23
24;; https://babbagefiles.blogspot.com/2017/03/take-elfeed-everywhere-mobile-rss.html 24(defun +elfeed-search-browse-generic ()
25(defun +elfeed () 25 "Browse a url with `browse-url-generic-browser'."
26 "Wrapper to load the elfeed db from disk before opening."
27 (interactive) 26 (interactive)
28 (elfeed-db-load) 27 (elfeed-search-browse-url t))
29 (elfeed)) 28
29(defun +elfeed-show-browse-generic ()
30 "Browse a url with `browse-url-generic-browser'."
31 (interactive)
32 (elfeed-show-visit t))
30 33
31(provide '+elfeed) 34(provide '+elfeed)
32;;; +elfeed.el ends here 35;;; +elfeed.el ends here
diff --git a/lisp/+embark.el b/lisp/+embark.el index 3900492..e66d4b3 100644 --- a/lisp/+embark.el +++ b/lisp/+embark.el
@@ -7,7 +7,6 @@
7;;; Code: 7;;; Code:
8 8
9(require 'embark) 9(require 'embark)
10(require 'marginalia)
11 10
12(embark-define-keymap embark-straight-map 11(embark-define-keymap embark-straight-map
13 ("u" straight-visit-package-website) 12 ("u" straight-visit-package-website)
@@ -22,7 +21,8 @@
22 21
23(add-to-list 'embark-keymap-alist '(straight . embark-straight-map)) 22(add-to-list 'embark-keymap-alist '(straight . embark-straight-map))
24 23
25(add-to-list 'marginalia-prompt-categories '("recipe\\|package" . straight)) 24(with-eval-after-load 'marginalia
25 (add-to-list 'marginalia-prompt-categories '("recipe\\|package" . straight)))
26 26
27(provide '+embark) 27(provide '+embark)
28;;; +embark.el ends here 28;;; +embark.el ends here
diff --git a/lisp/+lookup.el b/lisp/+lookup.el deleted file mode 100644 index 755f84e..0000000 --- a/lisp/+lookup.el +++ /dev/null
@@ -1,26 +0,0 @@
1;;; +lookup.el -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; I look up a lot of things in Emacs. Let's bind them all to an easy-to-use
6;; keymap.
7
8;;; Code:
9
10(require '+key)
11
12(define-minor-mode +lookup-mode
13 "A mode for easily looking things up."
14 :lighter " l^"
15 :keymap (let ((map (make-sparse-keymap)))
16 (define-key map "f" #'find-function)
17 (define-key map "l" #'find-library)
18 (define-key map "v" #'find-variable)
19 map)
20 (define-key +key-mode-map (kbd "C-c l") (when +lookup-mode
21 +lookup-mode-map)))
22
23(defvaralias '+lookup-map '+lookup-mode-map)
24
25(provide '+lookup)
26;;; +lookup.el ends here
diff --git a/lisp/+org-capture.el b/lisp/+org-capture.el index ba036bd..6c59b98 100644 --- a/lisp/+org-capture.el +++ b/lisp/+org-capture.el
@@ -85,5 +85,21 @@ properly process the variable."
85 ;; Sort after, maybe 85 ;; Sort after, maybe
86 (when sort-after (+org-capture-sort list)))) 86 (when sort-after (+org-capture-sort list))))
87 87
88(defun +org-template--ensure-path (keys &optional list)
89 "Ensure path of keys exists in `org-capture-templates'."
90 (unless list (setq list 'org-capture-templates))
91 (when (> (length key) 1)
92 ;; Check for existence of groups.
93 (let ((expected (cl-loop for i from 1 to (1- (length key))
94 collect (substring key 0 i) into keys
95 finally return keys)))
96 (cl-loop for ek in expected
97 if (not (+org-capture--get ek (symbol-value list))) do
98 (setf (+org-capture--get ek (symbol-value list))
99 (list (format "(Group %s)" ek)))))))
100
101(defun +org-define-capture-template (keys title &rest args)
102 )
103
88(provide '+org-capture) 104(provide '+org-capture)
89;;; +org-capture.el ends here 105;;; +org-capture.el ends here
diff --git a/lisp/+vertico.el b/lisp/+vertico.el index 4adde3d..d4fb3a3 100644 --- a/lisp/+vertico.el +++ b/lisp/+vertico.el
@@ -12,5 +12,13 @@
12 (unless (eq 1 (abs (- beg-index vertico--index))) 12 (unless (eq 1 (abs (- beg-index vertico--index)))
13 (ding)))) 13 (ding))))
14 14
15(defun +vertico-widen-or-complete ()
16 (interactive)
17 (if (or vertico-unobtrusive-mode
18 vertico-flat-mode)
19 (progn (vertico-unobtrusive-mode -1)
20 (vertico-flat-mode -1))
21 (call-interactively #'vertico-insert)))
22
15(provide '+vertico) 23(provide '+vertico)
16;;; +vertico.el ends here 24;;; +vertico.el ends here
diff --git a/lisp/acdw.el b/lisp/acdw.el index 262c15e..603f46f 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -128,10 +128,12 @@ I keep forgetting how they differ."
128(defmacro +with-message (message &rest body) 128(defmacro +with-message (message &rest body)
129 "Execute BODY, with MESSAGE. 129 "Execute BODY, with MESSAGE.
130If body executes without errors, MESSAGE...Done will be displayed." 130If body executes without errors, MESSAGE...Done will be displayed."
131 ;; ^ TODO 131 (declare (indent 1))
132 `(prog1 (progn (message ,(concat message "...")) 132 (let ((msg (gensym)))
133 ,@body) 133 `(let ((,msg ,message))
134 (message ,(concat message "...Done.")))) 134 (unwind-protect (progn (message "%s..." ,msg)
135 ,@body)
136 (message "%s... Done." ,msg)))))
135 137
136(defun +mapc-some-buffers (func &optional predicate) 138(defun +mapc-some-buffers (func &optional predicate)
137 "Perform FUNC on all buffers satisfied by PREDICATE. 139 "Perform FUNC on all buffers satisfied by PREDICATE.