diff options
author | Case Duckworth | 2023-01-12 16:39:31 -0600 |
---|---|---|
committer | Case Duckworth | 2023-01-12 16:39:31 -0600 |
commit | b13e8f87a92c34abb7168a812523f395151afcc7 (patch) | |
tree | 9cbb709acf9b366d54d6d41201292b2f9d17ceeb | |
parent | Move faces definition to init.el (diff) | |
download | emacs-b13e8f87a92c34abb7168a812523f395151afcc7.tar.gz emacs-b13e8f87a92c34abb7168a812523f395151afcc7.zip |
Meh
-rw-r--r-- | init.el | 104 | ||||
-rw-r--r-- | lisp/acdw.el | 50 |
2 files changed, 147 insertions, 7 deletions
diff --git a/init.el b/init.el index 95a022e..5ce5cdb 100644 --- a/init.el +++ b/init.el | |||
@@ -9,15 +9,17 @@ | |||
9 | ;;; Built-ins | 9 | ;;; Built-ins |
10 | 10 | ||
11 | (use-package emacs ; Misc. config | 11 | (use-package emacs ; Misc. config |
12 | :config | ||
13 | (setopt tab-bar-show 1)) | ||
14 | |||
15 | (use-package faces | ||
16 | :custom-face | 12 | :custom-face |
17 | (default ((t :family "Comic Code" | 13 | (default ((t :family "Comic Code" |
18 | :height 100))) | 14 | :height 100))) |
19 | (variable-pitch ((t :family "Comic Code"))) | 15 | (variable-pitch ((t :family "Comic Code"))) |
20 | :config | 16 | :config |
17 | (setopt tab-bar-show 1 | ||
18 | recenter-positions '(top middle bottom))) | ||
19 | |||
20 | (use-package faces | ||
21 | :defer 2 ; This is sort of expensive | ||
22 | :config | ||
21 | ;; Emojis | 23 | ;; Emojis |
22 | (cl-loop with ffl = (font-family-list) | 24 | (cl-loop with ffl = (font-family-list) |
23 | for font in '("Noto Emoji" "Noto Color Emoji" | 25 | for font in '("Noto Emoji" "Noto Color Emoji" |
@@ -133,6 +135,36 @@ | |||
133 | :config | 135 | :config |
134 | (fringe-mode '(nil . 0))) | 136 | (fringe-mode '(nil . 0))) |
135 | 137 | ||
138 | |||
139 | (use-package dired | ||
140 | :bind (("C-x C-j" . dired-jump) | ||
141 | ([remap list-directory] . dired) | ||
142 | :map dired-mode-map | ||
143 | ("C-j" . dired-up-directory) | ||
144 | ("<backspace>" . dired-up-directory)) | ||
145 | :config | ||
146 | (require 'dired-x) | ||
147 | (setopt dired-recursive-copies 'always | ||
148 | dired-recursive-deletes 'always | ||
149 | dired-create-destination-dirs 'always | ||
150 | dired-do-revert-buffer t | ||
151 | dired-hide-details-hide-symlink-targets nil | ||
152 | dired-isearch-filenames 'dwim | ||
153 | delete-by-moving-to-trash t | ||
154 | dired-auto-revert-buffer t | ||
155 | dired-listing-switches "-AlFhv --group-directories-first" | ||
156 | ls-lisp-dirs-first t | ||
157 | dired-ls-F-marks-symlinks t | ||
158 | dired-clean-confirm-killing-deleted-buffers nil | ||
159 | dired-no-confirm '(byte-compile | ||
160 | load chgrp chmod chown | ||
161 | copy move hardlink symlink | ||
162 | shell touch) | ||
163 | dired-dwim-target t) | ||
164 | (add-hook 'dired-mode-hook #'dired-hide-details-mode) | ||
165 | (add-hook 'dired-mode-hook #'hl-line-mode) | ||
166 | (add-hook 'dired-mode-hook #'truncate-lines-local-mode)) | ||
167 | |||
136 | 168 | ||
137 | ;;; Locally-developed packages | 169 | ;;; Locally-developed packages |
138 | 170 | ||
@@ -190,11 +222,14 @@ | |||
190 | (use-package jabber | 222 | (use-package jabber |
191 | :load-path "~/src/emacs/emacs-jabber/" | 223 | :load-path "~/src/emacs/emacs-jabber/" |
192 | :preface | 224 | :preface |
225 | (defvar jabber-prefix-width 10 | ||
226 | "Width of jabber prompts and other prefixes.") | ||
193 | (defun jabber-ui-setup () | 227 | (defun jabber-ui-setup () |
194 | "Setup the `jabber' user interface." | 228 | "Setup the `jabber' user interface." |
195 | (visual-fill-column-mode) | 229 | (visual-fill-column-mode) |
196 | (electric-pair-local-mode -1) | 230 | (electric-pair-local-mode -1) |
197 | (auto-fill-mode -1)) | 231 | (auto-fill-mode -1) |
232 | (setq-local wrap-prefix (make-string (+ 3 jabber-prefix-width) #x20))) | ||
198 | :custom-face | 233 | :custom-face |
199 | (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign | 234 | (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign |
200 | :foreground unspecified | 235 | :foreground unspecified |
@@ -217,10 +252,27 @@ | |||
217 | (setopt jabber-account-list '(("acdw@hmm.st")) | 252 | (setopt jabber-account-list '(("acdw@hmm.st")) |
218 | jabber-auto-reconnect t | 253 | jabber-auto-reconnect t |
219 | jabber-last-read-marker (make-string 40 ?-) | 254 | jabber-last-read-marker (make-string 40 ?-) |
220 | jabber-muc-presence-patterns | 255 | jabber-muc-decorate-presence-patterns |
221 | '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") | 256 | '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") |
222 | ("." . jabber-muc-presence-dim)) | 257 | ("." . jabber-muc-presence-dim)) |
223 | jabber-activity-make-strings #'jabber-activity-make-strings-shorten) | 258 | jabber-activity-make-strings #'jabber-activity-make-strings-shorten |
259 | jabber-last-read-marker (make-string (- fill-column 8) ?-) | ||
260 | jabber-rare-time-format " - - - - - - %H:%M %F" | ||
261 | ;; buffer name formats | ||
262 | jabber-chat-buffer-format "%n <xmpp>" | ||
263 | jabber-browse-buffer-format "%n <xmpp-browse>" | ||
264 | jabber-groupchat-buffer-format "%n <xmpp-muc>" | ||
265 | jabber-muc-private-buffer-format "%n <xmpp-muc-private>" | ||
266 | ;; "prompt" (speaker) formats | ||
267 | jabber-groupchat-prompt-format (format "%%>%dn | " jabber-prefix-width) | ||
268 | jabber-chat-local-prompt-format (format "%%>%dn | " jabber-prefix-width) | ||
269 | jabber-chat-system-prompt-format (let ((s "")) | ||
270 | (while (< (length s) | ||
271 | jabber-prefix-width) | ||
272 | (setq s (concat s " *"))) | ||
273 | s) | ||
274 | jabber-chat-foreign-prompt-format (format "%%>%dn | " jabber-prefix-width) | ||
275 | jabber-muc-private-foreign-prompt-format "\n%g/%n | ") | ||
224 | (add-hook 'jabber-chat-mode-hook #'jabber-ui-setup) | 276 | (add-hook 'jabber-chat-mode-hook #'jabber-ui-setup) |
225 | (keymap-global-set "C-x C-j" #'dired-jump) ; Extremely annoying fix | 277 | (keymap-global-set "C-x C-j" #'dired-jump) ; Extremely annoying fix |
226 | (require 'jabber-httpupload nil t) | 278 | (require 'jabber-httpupload nil t) |
@@ -493,3 +545,41 @@ | |||
493 | :pin melpa-stable | 545 | :pin melpa-stable |
494 | :ensure t | 546 | :ensure t |
495 | :bind ("C-x g" . magit)) | 547 | :bind ("C-x g" . magit)) |
548 | |||
549 | (use-package eradio | ||
550 | :ensure t | ||
551 | :preface | ||
552 | (defun eradio-toggle|play (&optional arg) | ||
553 | "Run `eradio-toggle', or `eradio-play' with prefix ARG." | ||
554 | (interactive "P") | ||
555 | (if arg (eradio-play) (eradio-toggle))) | ||
556 | :bind (("C-c r p" . eradio-toggle|play) | ||
557 | ("C-c r s" . eradio-stop)) | ||
558 | :config | ||
559 | (setopt eradio-player '("mpv" "--no-video" "--no-terminal") | ||
560 | eradio-channels | ||
561 | ;; At some point I should actually ... write this in to this file or | ||
562 | ;; something. But until I decide to quit using radish altogether, this | ||
563 | ;; what I got. | ||
564 | (with-current-buffer (find-file-noselect "~/etc/radish/stations") | ||
565 | (let (chans) | ||
566 | (dolist (line (string-split (buffer-substring-no-properties | ||
567 | (point-min) (point-max)) | ||
568 | "\n") | ||
569 | chans) | ||
570 | (unless (string-match-p "^#" line) | ||
571 | (let* ((ll (string-split line "\t")) | ||
572 | (url (cl-first ll)) | ||
573 | (name (cl-second ll)) | ||
574 | (tags (cl-third ll))) | ||
575 | (when (and name | ||
576 | (string-match-p "[^ \n\t]*://[^ \n\t]*" url)) | ||
577 | (push (cons (format "%s - %s" name tags) url) chans))))))))) | ||
578 | |||
579 | (use-package wiki-abbrev | ||
580 | :defer 5 ; Allow for network to come up | ||
581 | :load-path "~/src/emacs/wiki-abbrev.el/" | ||
582 | :config | ||
583 | (setopt wiki-abbrev-file (etc/ "wiki-abbrevs")) | ||
584 | (wiki-abbrev-insinuate)) | ||
585 | |||
diff --git a/lisp/acdw.el b/lisp/acdw.el index f16a679..6729759 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -35,5 +35,55 @@ enables passing arguments to a calling function." | |||
35 | (executable-find (car (ensure-list x)))) | 35 | (executable-find (car (ensure-list x)))) |
36 | programs)) | 36 | programs)) |
37 | 37 | ||
38 | (defun file-string (file) | ||
39 | "Return the contents of FILE as a string." | ||
40 | (with-current-buffer (find-file-noselect file) | ||
41 | (buffer-string))) | ||
42 | |||
43 | (defun unsmartify-region (begin end) | ||
44 | "Replace \"smart\" punctuation with \"dumb\" counterparts." | ||
45 | (interactive "*r") | ||
46 | (save-excursion | ||
47 | (goto-char begin) | ||
48 | (while (re-search-forward "[“”‘’–—]" end t) | ||
49 | (let ((replace (pcase (match-string 0) | ||
50 | ((or "“" "”") "\"") | ||
51 | ((or "‘" "’") "'") | ||
52 | ("–" "--") | ||
53 | ("—" "---")))) | ||
54 | (replace-match replace nil nil))))) | ||
55 | |||
56 | (defun ++concat (func strings) | ||
57 | "Concat STRINGS processed by FUNC. | ||
58 | Each of STRINGS can be a bare string or a list. Strings are | ||
59 | passed through as-is, but lists are passed to FUNC first as | ||
60 | arguments. Finally, all the resulting strings are `mapconcat'-ed | ||
61 | together. | ||
62 | |||
63 | As a special case, if `:separator' is the first of STRINGS, the | ||
64 | string following will be used as a separator. Otherwise, a | ||
65 | newline will be used." | ||
66 | (let (separator) | ||
67 | (when (eq (car strings) :separator) | ||
68 | (setq separator (cadr strings) | ||
69 | strings (cddr strings))) | ||
70 | (mapconcat (lambda (s) | ||
71 | (cond | ||
72 | ((listp s) (apply func s)) | ||
73 | ((stringp s) s) | ||
74 | (t (user-error "Bad argument: %S" s)))) | ||
75 | strings | ||
76 | (or separator "\n")))) | ||
77 | |||
78 | (defun format-concat (&rest strings) | ||
79 | "Concatenate formatted STRINGS. | ||
80 | Each of STRINGS can be a bare string or a list. Bare strings are passed as-is | ||
81 | to `mapconcat' for concatenation and separation. Lists, however, are passed to | ||
82 | `format' first. | ||
83 | |||
84 | If `:separator' is the first of STRINGS, the next string will be | ||
85 | used as a separator." | ||
86 | (++concat #'format strings)) | ||
87 | |||
38 | (provide 'acdw) | 88 | (provide 'acdw) |
39 | ;;; acdw.el ends here | 89 | ;;; acdw.el ends here |