summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-09 20:52:07 -0600
committerCase Duckworth2022-01-09 20:52:07 -0600
commitb7295426c95bf968288bb6ead2db416a71ec4d3e (patch)
tree41f8b5c7c4e7f8f42650ed44b8e9159f6a8984af
parentGah, so many changes (diff)
downloademacs-b7295426c95bf968288bb6ead2db416a71ec4d3e.tar.gz
emacs-b7295426c95bf968288bb6ead2db416a71ec4d3e.zip
Weekend, babee
-rw-r--r--init.el138
-rw-r--r--lisp/+apheleia.el3
-rw-r--r--lisp/+casing.el25
-rw-r--r--lisp/+circe.el130
-rw-r--r--lisp/+elfeed.el7
-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, 243 insertions, 124 deletions
diff --git a/init.el b/init.el index b32dfce..1a39f3c 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,8 +908,7 @@ 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
@@ -918,12 +936,15 @@ See also `crux-reopen-as-root-mode'."
918 elfeed-search-title-min-width 24 936 elfeed-search-title-min-width 24
919 elfeed-search-title-max-width 78 937 elfeed-search-title-max-width 78
920 elfeed-show-unique-buffers t 938 elfeed-show-unique-buffers t
921 elfeed-db-directory (elfeed/ "db/" t)) 939 elfeed-db-directory (elfeed/ "db/" t)
922 (:+key "C-x w" #'+elfeed) 940 elfeed-log 'debug ; until I can figure out syncing...
941 )
942 (:+key "C-x w" #'elfeed)
923 (:with-mode elfeed-search-mode 943 (:with-mode elfeed-search-mode
924 (:hook #'hl-line-mode) 944 (:hook #'hl-line-mode)
925 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ 945 ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/
926 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)) 946 (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)
947 (advice-add #'elfeed :before #'elfeed-db-load))
927 (:with-mode elfeed-show-mode 948 (:with-mode elfeed-show-mode
928 (:bind "SPC" #'+elfeed-scroll-up-command 949 (:bind "SPC" #'+elfeed-scroll-up-command
929 "S-SPC" #'+elfeed-scroll-down-command) 950 "S-SPC" #'+elfeed-scroll-down-command)
@@ -945,14 +966,16 @@ See also `crux-reopen-as-root-mode'."
945(setup (:straight elpher)) 966(setup (:straight elpher))
946 967
947(setup (:straight embark) 968(setup (:straight embark)
948 (:also-load +embark) 969 (:require embark
970 +embark)
949 (:option prefix-help-command 'embark-prefix-help-command 971 (:option prefix-help-command 'embark-prefix-help-command
950 embark-keymap-prompter-key ";") 972 embark-keymap-prompter-key ";")
951 (:+key "C-." #'embark-act 973 (:+key "C-." #'embark-act
952 "M-." #'embark-dwim 974 "M-." #'embark-dwim
953 "<f1> B" #'embark-bindings) 975 "<f1> B" #'embark-bindings)
954 (:with-map minibuffer-local-map 976 (:with-map minibuffer-local-map
955 (:bind "C-." #'embark-act)) 977 (:bind "C-." #'embark-act
978 "M-." #'embark-dwim))
956 (:with-map embark-file-map 979 (:with-map embark-file-map
957 (:bind "l" #'vlf))) 980 (:bind "l" #'vlf)))
958 981
@@ -1059,14 +1082,14 @@ See also `crux-reopen-as-root-mode'."
1059 (:file-match (rx ".rkt" eos) 1082 (:file-match (rx ".rkt" eos)
1060 (rx ".scm" eos))) 1083 (rx ".scm" eos)))
1061 1084
1062(setup (:straight god-mode) 1085;; (setup (:straight god-mode)
1063 (setq god-mode-enable-function-key-translation nil) 1086;; (setq god-mode-enable-function-key-translation nil)
1064 (:require god-mode 1087;; (:require god-mode
1065 +god-mode) 1088;; +god-mode)
1066 (:+key "C-M-g" #'god-mode-all) 1089;; (:+key "C-M-g" #'god-mode-all)
1067 (:with-mode god-local-mode 1090;; (:with-mode god-local-mode
1068 (:bind "i" #'+god-mode-insert 1091;; (:bind "i" #'+god-mode-insert
1069 "a" nil))) 1092;; "a" nil)))
1070 1093
1071(setup (:straight helpful) 1094(setup (:straight helpful)
1072 (run-with-idle-timer 0.5 nil 1095 (run-with-idle-timer 0.5 nil
@@ -1132,17 +1155,9 @@ See also `crux-reopen-as-root-mode'."
1132 1155
1133(setup (:straight (lin :host gitlab :repo "protesilaos/lin")) 1156(setup (:straight (lin :host gitlab :repo "protesilaos/lin"))
1134 (require 'lin) 1157 (require 'lin)
1135 (:hook-into dired-mode 1158 (dolist (hook lin-foreign-hooks)
1136 elfeed-search-mode 1159 (add-hook hook #'hl-line-mode)
1137 git-rebase-mode 1160 (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 1161
1147(setup (:straight link-hint) 1162(setup (:straight link-hint)
1148 (:require +link-hint) 1163 (:require +link-hint)
@@ -1155,6 +1170,11 @@ See also `crux-reopen-as-root-mode'."
1155 "m" #'link-hint-open-multiple-links 1170 "m" #'link-hint-open-multiple-links
1156 "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link))) 1171 "M-c" #'link-hint-copy-link "c" #'link-hint-copy-link)))
1157 1172
1173(setup (:straight macrostep)
1174 (:require macrostep)
1175 (:with-mode emacs-lisp-mode
1176 (:bind "C-c e" #'macrostep-expand)))
1177
1158(setup (:straight marginalia) 1178(setup (:straight marginalia)
1159 (marginalia-mode +1)) 1179 (marginalia-mode +1))
1160 1180
@@ -1306,8 +1326,10 @@ See also `crux-reopen-as-root-mode'."
1306 :host github 1326 :host github
1307 :repo "duckwork/titlecase.el" 1327 :repo "duckwork/titlecase.el"
1308 :files ("*"))) 1328 :files ("*")))
1309 (:with-map +casing-mode-map 1329 (:require titlecase)
1310 (:bind "t" #'titlecase-dwim))) 1330 (:with-map +casing-map
1331 (:bind "t" #'titlecase-dwim
1332 "M-t" #'titlecase-dwim)))
1311 1333
1312(setup (:straight topsy) 1334(setup (:straight topsy)
1313 (:hook-into ;;prog-mode 1335 (:hook-into ;;prog-mode
@@ -1366,11 +1388,35 @@ See also `crux-reopen-as-root-mode'."
1366 (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) 1388 (add-to-list 'native-comp-deferred-compilation-deny-list "vertico"))
1367 (vertico-mode +1) 1389 (vertico-mode +1)
1368 ;; Extensions 1390 ;; Extensions
1369 (:also-load vertico-directory) 1391 (:also-load vertico-directory
1392 vertico-mouse
1393 vertico-unobtrusive
1394 vertico-multiform)
1395 (vertico-mouse-mode +1)
1396 (vertico-multiform-mode +1)
1397 (:option vertico-multiform-commands '((execute-extended-command flat)
1398 (helpful-callable)
1399 (helpful-variable))
1400 ;; This is applied /after/ the above, so default is at the end of
1401 ;; this alist.
1402 vertico-multiform-categories '((file buffer grid)
1403 (t unobtrusive)))
1404 (dolist (buf-cmd '(consult-find
1405 consult-locate
1406 consult-grep
1407 consult-git-grep
1408 consult-ripgrep
1409 consult-line
1410 consult-line-multi
1411 consult-multi-occur
1412 consult-keep-lines
1413 consult-focus-lines))
1414 (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer)))
1370 (:with-map vertico-map 1415 (:with-map vertico-map
1371 (:bind "RET" #'vertico-directory-enter 1416 (:bind "RET" #'vertico-directory-enter
1372 "DEL" #'vertico-directory-delete-char 1417 "DEL" #'vertico-directory-delete-char
1373 "M-DEL" #'vertico-directory-delete-word)) 1418 "M-DEL" #'vertico-directory-delete-word
1419 "TAB" #'+vertico-widen-or-complete))
1374 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) 1420 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
1375 1421
1376(setup (:straight visual-fill-column) 1422(setup (:straight visual-fill-column)
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..4ee7581 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -21,12 +21,5 @@
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
25(defun +elfeed ()
26 "Wrapper to load the elfeed db from disk before opening."
27 (interactive)
28 (elfeed-db-load)
29 (elfeed))
30
31(provide '+elfeed) 24(provide '+elfeed)
32;;; +elfeed.el ends here 25;;; +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.