From b13e8f87a92c34abb7168a812523f395151afcc7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 12 Jan 2023 16:39:31 -0600 Subject: Meh --- init.el | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 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 @@ ;;; Built-ins (use-package emacs ; Misc. config - :config - (setopt tab-bar-show 1)) - -(use-package faces :custom-face (default ((t :family "Comic Code" :height 100))) (variable-pitch ((t :family "Comic Code"))) :config + (setopt tab-bar-show 1 + recenter-positions '(top middle bottom))) + +(use-package faces + :defer 2 ; This is sort of expensive + :config ;; Emojis (cl-loop with ffl = (font-family-list) for font in '("Noto Emoji" "Noto Color Emoji" @@ -133,6 +135,36 @@ :config (fringe-mode '(nil . 0))) + +(use-package dired + :bind (("C-x C-j" . dired-jump) + ([remap list-directory] . dired) + :map dired-mode-map + ("C-j" . dired-up-directory) + ("" . dired-up-directory)) + :config + (require 'dired-x) + (setopt dired-recursive-copies 'always + dired-recursive-deletes 'always + 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 + dired-auto-revert-buffer t + dired-listing-switches "-AlFhv --group-directories-first" + ls-lisp-dirs-first t + dired-ls-F-marks-symlinks t + dired-clean-confirm-killing-deleted-buffers nil + dired-no-confirm '(byte-compile + load chgrp chmod chown + copy move hardlink symlink + shell touch) + dired-dwim-target t) + (add-hook 'dired-mode-hook #'dired-hide-details-mode) + (add-hook 'dired-mode-hook #'hl-line-mode) + (add-hook 'dired-mode-hook #'truncate-lines-local-mode)) + ;;; Locally-developed packages @@ -190,11 +222,14 @@ (use-package jabber :load-path "~/src/emacs/emacs-jabber/" :preface + (defvar jabber-prefix-width 10 + "Width of jabber prompts and other prefixes.") (defun jabber-ui-setup () "Setup the `jabber' user interface." (visual-fill-column-mode) (electric-pair-local-mode -1) - (auto-fill-mode -1)) + (auto-fill-mode -1) + (setq-local wrap-prefix (make-string (+ 3 jabber-prefix-width) #x20))) :custom-face (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign :foreground unspecified @@ -217,10 +252,27 @@ (setopt jabber-account-list '(("acdw@hmm.st")) jabber-auto-reconnect t jabber-last-read-marker (make-string 40 ?-) - jabber-muc-presence-patterns + jabber-muc-decorate-presence-patterns '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") ("." . jabber-muc-presence-dim)) - jabber-activity-make-strings #'jabber-activity-make-strings-shorten) + jabber-activity-make-strings #'jabber-activity-make-strings-shorten + jabber-last-read-marker (make-string (- fill-column 8) ?-) + jabber-rare-time-format " - - - - - - %H:%M %F" + ;; buffer name formats + jabber-chat-buffer-format "%n " + jabber-browse-buffer-format "%n " + jabber-groupchat-buffer-format "%n " + jabber-muc-private-buffer-format "%n " + ;; "prompt" (speaker) formats + jabber-groupchat-prompt-format (format "%%>%dn | " jabber-prefix-width) + jabber-chat-local-prompt-format (format "%%>%dn | " jabber-prefix-width) + jabber-chat-system-prompt-format (let ((s "")) + (while (< (length s) + jabber-prefix-width) + (setq s (concat s " *"))) + s) + jabber-chat-foreign-prompt-format (format "%%>%dn | " jabber-prefix-width) + jabber-muc-private-foreign-prompt-format "\n%g/%n | ") (add-hook 'jabber-chat-mode-hook #'jabber-ui-setup) (keymap-global-set "C-x C-j" #'dired-jump) ; Extremely annoying fix (require 'jabber-httpupload nil t) @@ -493,3 +545,41 @@ :pin melpa-stable :ensure t :bind ("C-x g" . magit)) + +(use-package eradio + :ensure t + :preface + (defun eradio-toggle|play (&optional arg) + "Run `eradio-toggle', or `eradio-play' with prefix ARG." + (interactive "P") + (if arg (eradio-play) (eradio-toggle))) + :bind (("C-c r p" . eradio-toggle|play) + ("C-c r s" . eradio-stop)) + :config + (setopt eradio-player '("mpv" "--no-video" "--no-terminal") + eradio-channels + ;; At some point I should actually ... write this in to this file or + ;; something. But until I decide to quit using radish altogether, this + ;; what I got. + (with-current-buffer (find-file-noselect "~/etc/radish/stations") + (let (chans) + (dolist (line (string-split (buffer-substring-no-properties + (point-min) (point-max)) + "\n") + chans) + (unless (string-match-p "^#" line) + (let* ((ll (string-split line "\t")) + (url (cl-first ll)) + (name (cl-second ll)) + (tags (cl-third ll))) + (when (and name + (string-match-p "[^ \n\t]*://[^ \n\t]*" url)) + (push (cons (format "%s - %s" name tags) url) chans))))))))) + +(use-package wiki-abbrev + :defer 5 ; Allow for network to come up + :load-path "~/src/emacs/wiki-abbrev.el/" + :config + (setopt wiki-abbrev-file (etc/ "wiki-abbrevs")) + (wiki-abbrev-insinuate)) + 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." (executable-find (car (ensure-list x)))) programs)) +(defun file-string (file) + "Return the contents of FILE as a string." + (with-current-buffer (find-file-noselect file) + (buffer-string))) + +(defun unsmartify-region (begin end) + "Replace \"smart\" punctuation with \"dumb\" counterparts." + (interactive "*r") + (save-excursion + (goto-char begin) + (while (re-search-forward "[“”‘’–—]" end t) + (let ((replace (pcase (match-string 0) + ((or "“" "”") "\"") + ((or "‘" "’") "'") + ("–" "--") + ("—" "---")))) + (replace-match replace nil nil))))) + +(defun ++concat (func strings) + "Concat STRINGS processed by FUNC. +Each of STRINGS can be a bare string or a list. Strings are +passed through as-is, but lists are passed to FUNC first as +arguments. Finally, all the resulting strings are `mapconcat'-ed +together. + +As a special case, if `:separator' is the first of STRINGS, the +string following will be used as a separator. Otherwise, a +newline will be used." + (let (separator) + (when (eq (car strings) :separator) + (setq separator (cadr strings) + strings (cddr strings))) + (mapconcat (lambda (s) + (cond + ((listp s) (apply func s)) + ((stringp s) s) + (t (user-error "Bad argument: %S" s)))) + strings + (or separator "\n")))) + +(defun format-concat (&rest strings) + "Concatenate formatted STRINGS. +Each of STRINGS can be a bare string or a list. Bare strings are passed as-is +to `mapconcat' for concatenation and separation. Lists, however, are passed to +`format' first. + +If `:separator' is the first of STRINGS, the next string will be +used as a separator." + (++concat #'format strings)) + (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81