From dbb6181a5d8b5aa14a46bb207ebaf6c7911c8ced Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 15 Jun 2022 10:26:10 -0500 Subject: aodifu --- init.el | 109 ++++++++++++++++++++++++++++------------------------- lisp/+emacs.el | 13 ++++++- lisp/+org.el | 37 ++++++++++++++++++ lisp/+titlecase.el | 12 ++++-- machines/bob.el | 27 +++++++------ 5 files changed, 128 insertions(+), 70 deletions(-) diff --git a/init.el b/init.el index 6c88148..d1eb3ec 100644 --- a/init.el +++ b/init.el @@ -53,7 +53,10 @@ "C-" #'+backward-kill-word "C-x TAB" #'+indent-rigidly "" #'flyspell-mode - "C-x C-c" #'+save-buffers-quit) + "C-x C-c" #'+save-buffers-quit + "C-\\" nil ; original: toggle-input-method + "C-/" #'undo-only + "C-?" #'undo-redo) ;; Disable bindings (:global "M-j" nil "" nil) @@ -479,6 +482,9 @@ ;; (+kmacro-recording-indicator-mode +1) (+kmacro-block-undo-mode +1))) +(setup midnight + (midnight-mode +1)) + (setup minibuffer (:require +minibuffer) (:with-map minibuffer-local-map @@ -898,6 +904,8 @@ (add-hook 'kill-buffer-query-functions #'+scratch-immortal)) (setup sh + (:option sh-indentation tab-width) + (:hook #'indent-tabs-mode) (:apheleia shfmt '("shfmt"))) (setup shell @@ -993,8 +1001,7 @@ (:face 'aw-mode-line-face '((t (:foreground "red")))) (+ace-window-display-mode +1)) -(setup (:straight (actually-selected-window - :host github +(setup (:straight (actually-selected-window :host github :repo "duckwork/actually-selected-window.el")) (actually-selected-window-mode +1)) @@ -1121,8 +1128,7 @@ browse-kill-ring-separator " ") (:hook #'form-feed-mode)) -(setup (:straight (cape - :host github :repo "minad/cape")) +(setup (:straight (cape :host github :repo "minad/cape")) (let ;; All available cape capfs listed here. Add them to the front since ;; they're reversed with `add-to-list'. @@ -1327,8 +1333,7 @@ (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset)) (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs)) -(setup (:straight (clean-kill-ring - :host github +(setup (:straight (clean-kill-ring :host github :repo "NicholasBHubbard/clean-kill-ring.el")) (:require) (:option clean-kill-ring-prevent-duplicates t) @@ -1481,8 +1486,7 @@ "TAB" #'dired-subtree-cycle "i" #'dired-subtree-toggle)) -(setup (:straight (discord - :host github +(setup (:straight (discord :host github :repo "davep/discord.el" :fork (:repo "duckwork/discord.el")))) @@ -1574,6 +1578,20 @@ (file+olp ,(car rmh-elfeed-org-files) "Feeds") "* %? %^g"))) +(setup (:straight (elfeed-tube :host github :repo "karthink/elfeed-tube") + (or (executable-find "youtube-dl") + (executable-find "yt-dlp"))) + (:straight (elfeed-tube-mpv :host github :repo "karthink/elfeed-tube")) + (:load-after elfeed) + (with-eval-after-load 'elfeed + (elfeed-tube-setup) + (:bind-into (elfeed-show-mode-map elfeed-search-mode-map) + "F" #'elfeed-tube-fetch + [remap save-buffer] #'elfeed-tube-save) + (:bind-into elfeed-show-mode-map + "C-c C-f" #'elfeed-tube-mpv-follow-mode + "C-c C-w" #'elfeed-tube-mpv-where))) + (setup (:straight elpher) (:bind "l" #'elpher-back)) @@ -1603,8 +1621,7 @@ :inherit font-lock-keyword-face)))) (:+key "C-," #'embrace-commander)) -(setup (:straight (ement - :host github +(setup (:straight (ement :host github :repo "alphapapa/ement.el") ;; `plz' is a requirement, but isn't on an elpa. (setup (:straight (plz :host github @@ -1661,19 +1678,11 @@ (:+key "C-=" #'er/expand-region "C--" #'+er/contract-or-negative-argument)) -(setup (:straight (fill-sentences-correctly - :host github - :repo "duckwork/fill-sentences-correctly.el")) - (:quit "I don't think this works like how I want.") - (fill-sentences-correctly-mode +1)) - -(setup (:straight (filldent - :host github - :repo "duckwork/filldent.el")) +(setup (:straight (filldent :host nil + :repo "https://codeberg.org/acdw/filldent.el")) (:+key "M-q" #'filldent-unfill-toggle)) -(setup (:straight (flymake-collection - :host github +(setup (:straight (flymake-collection :host github :repo "mohkale/flymake-collection")) (+ensure-after-init #'flymake-collection-hook-setup)) @@ -1702,8 +1711,7 @@ 'notmuch-message) (:hook-into notmuch-show-mode)) -(setup (:straight (forge - :host github :repo "magit/forge") +(setup (:straight (forge :host github :repo "magit/forge") (eq system-type 'gnu/linux)) (:quit) ; XXX: Somehow missing compat-26 (add-to-list 'forge-alist @@ -1715,9 +1723,8 @@ (:face 'form-feed-line '((t (:strike-through t)))) (global-form-feed-mode +1)) -(setup (:straight (frowny - :host github - :repo "duckwork/frowny.el")) +(setup (:straight (frowny :host nil + :repo "https://codeberg.org/acdw/frowny.el")) (:option frowny-eyes (rx (any ":=") (opt "'") (? "-"))) (global-frowny-mode +1)) @@ -1738,8 +1745,7 @@ (setf (alist-get "\\.scm\\'" auto-insert-alist nil nil #'equal) '(insert "#!/bin/sh\n#| -*- scheme -*-\nexec csi -s $0 \"$@\"\n|#\n"))) -(setup (:straight (git-modes - :host github :repo "magit/git-modes")) +(setup (:straight (git-modes :host github :repo "magit/git-modes")) (:require git-modes)) (setup (:straight god-mode @@ -1763,8 +1769,7 @@ (require 'info-look) (info-lookup-setup-mode 'symbol 'emacs-lisp-mode)))) -(setup (:straight (hippie-completing-read - :host nil +(setup (:straight (hippie-completing-read :host nil :repo "https://codeberg.org/acdw/hippie-completing-read.el")) (:+key "M-/" #'hippie-completing-read)) @@ -1825,8 +1830,8 @@ (define-key isearch-mb-minibuffer-map (kbd key) command))))))) (isearch-mb-mode +1)) -(setup (:straight (jabber :repo "https://codeberg.org/emacs-jabber/emacs-jabber" - :host nil +(setup (:straight (jabber :host nil + :repo "https://codeberg.org/emacs-jabber/emacs-jabber" :files ("*.el" "*.texi" ("jabber-fallback-lib" "jabber-fallback-lib/hexrgb.el" @@ -1896,8 +1901,8 @@ (remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo) (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) -(setup (:straight (keepassxc-shim - :host github :repo "duckwork/keepassxc-shim.el")) +(setup (:straight (keepassxc-shim :host nil + :repo "https://codeberg.org/acdw/keepassxc-shim.el")) (keepassxc-shim-activate)) (setup (:straight keychain-environment @@ -1926,8 +1931,8 @@ "M-c" #'+link-hint-open-chrome "c" #'+link-hint-open-chrome))) (setup (:straight (machine - :host github - :repo "duckwork/machine.el")) + :host nil + :repo "https://codeberg.org/acdw/machine.el")) (+with-ensure-after-init ; So that they override anything here. ;; Emoji fonts (let ((ffl (font-family-list)) @@ -2008,7 +2013,10 @@ (:option modus-themes-mixed-fonts t modus-themes-bold-constructs t modus-themes-italic-constructs t - modus-themes-headings '((t t))) + modus-themes-headings '((1 monochrome bold overline) + (2 monochrome bold) + (3 monochrome italic) + (t monochrome))) (dotimes (facen-1 8) (let ((facen (1+ facen-1))) (custom-set-faces @@ -2178,8 +2186,8 @@ (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize)))) (setup (:straight (org-taskwise - :host github - :repo "duckwork/org-taskwise.el")) + :host nil + :repo "https://codeberg.org/acdw/org-taskwise.el.git")) (with-eval-after-load 'org (require 'org-taskwise) (define-key org-mode-map (kbd "C-x n t") #'org-taskwise-narrow-to-task))) @@ -2264,9 +2272,8 @@ persistent-scratch-scratch-buffer-p-function)) (setup (:straight (plancat - :host github - :repo "duckwork/plancat.el" - :local-repo "~/src/emacs-packages/plancat.el/")) + :host nil + :repo "https://codeberg.org/acdw/plancat.el")) (:option plancat-user "acdw")) (setup (:straight pocket-reader) @@ -2287,8 +2294,6 @@ (setup (:straight rainbow-mode) (:hook-into prog-mode)) -(setup (:straight restart-emacs)) - (setup (:straight (shell-command+ :host nil :repo "https://git.sr.ht/~pkal/shell-command-plus")) @@ -2375,8 +2380,8 @@ (:hook-into prog-mode)) (setup (:straight (sophomore - :host github - :repo "duckwork/sophomore.el")) + :host nil + :repo "https://codeberg.org/acdw/sophomore.el")) (sophomore-enable #'narrow-to-region) (sophomore-disable ; These are mostly annoying commands #'view-hello-file @@ -2389,8 +2394,8 @@ (sophomore-mode +1)) (setup (:straight (spongebob-case - :host github - :repo "duckwork/spongebob-case.el"))) + :host nil + :repo "https://codeberg.org/acdw/spongebob-case.el"))) (setup (:straight ssh-config-mode) (:file-match (rx "/.ssh/config" eos) @@ -2414,8 +2419,8 @@ (:option systemd-man-function 'woman)) (setup (:straight (titlecase - :host github - :repo "duckwork/titlecase.el" + :host nil + :repo "https://codeberg.org/acdw/titlecase.el" :files ("*"))) (:require titlecase +titlecase) (:with-map +casing-map @@ -2466,7 +2471,7 @@ (:option twtxt-file _twtxt-file twtxt-following _twtxt-following)) -(setup (:straight undo-fu) +(setup (:straight undo-fu) (:quit "Trying native undo functionality") (:option undo-fu-allow-undo-in-region t) (:global "C-/" #'undo-fu-only-undo "C-?" #'undo-fu-only-redo)) diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 533d438..b4742da 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el @@ -206,8 +206,17 @@ Do this only if the buffer is not visiting a file." ;;; Hooks -(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) -(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode) +(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) +(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + +(defun +auto-create-missing-dirs () + "Automatically create missing directories when finding a file." + ;; https://emacsredux.com/blog/2022/06/12/auto-create-missing-directories/ + (let ((target-dir (file-name-directory buffer-file-name))) + (unless (file-exists-p target-dir) + (make-directory target-dir t)))) + +(add-hook 'find-file-not-found-functions #'+auto-create-missing-dirs) ;;; Better-default functions ... diff --git a/lisp/+org.el b/lisp/+org.el index 0d6e300..6b956ae 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -729,5 +729,42 @@ When called with a prefix ARG, will still unconditionally call ((org-at-table-p) #'org-table-wrap-region) (t #'org-return))))) + +;;; el-patch + +(el-patch-defun org-format-outline-path (path &optional width prefix separator) + "Format the outline path PATH for display. +WIDTH is the maximum number of characters that is available. +PREFIX is a prefix to be included in the returned string, +such as the file name. +SEPARATOR is inserted between the different parts of the path, +the default is \"/\"." + (setq width (or width 79)) + (setq path (delq nil path)) + (unless (> width 0) + (user-error "Argument `width' must be positive")) + (setq separator (or separator "/")) + (let* ((org-odd-levels-only nil) + (fpath (concat + prefix (and prefix path separator) + (mapconcat + (lambda (s) (replace-regexp-in-string "[ \t]+\\'" "" s)) + (cl-loop for head in path + for n from 0 + collect (el-patch-swap + (org-add-props + head nil 'face + (nth (% n org-n-level-faces) org-level-faces)) + head)) + separator)))) + (when (> (length fpath) width) + (if (< width 7) + ;; It's unlikely that `width' will be this small, but don't + ;; waste characters by adding ".." if it is. + (setq fpath (substring fpath 0 width)) + (setf (substring fpath (- width 2)) ".."))) + fpath)) + + (provide '+org) ;;; +org.el ends here diff --git a/lisp/+titlecase.el b/lisp/+titlecase.el index 1366a46..655ebe1 100644 --- a/lisp/+titlecase.el +++ b/lisp/+titlecase.el @@ -4,10 +4,14 @@ ;;; Code: -(defun +titlecase-sentence-style-dwim () - "Titlecase a sentence." - (interactive) - (titlecase-dwim 'sentence)) +(defun +titlecase-sentence-style-dwim (&optional arg) + "Titlecase a sentence. +With prefix ARG, toggle the value of +`titlecase-downcase-sentences' before sentence-casing." + (interactive "P") + (let ((titlecase-downcase-sentences (if arg (not titlecase-downcase-sentences) + titlecase-downcase-sentences))) + (titlecase-dwim 'sentence))) (defun +titlecase-org-headings () (interactive) diff --git a/machines/bob.el b/machines/bob.el index 06e605a..40db7b0 100644 --- a/machines/bob.el +++ b/machines/bob.el @@ -8,33 +8,36 @@ (require 'machine) (defun +bob-set-faces (&rest _) - (let ((base-face "IBM Plex Mono") - (base-size 110) + (let (;;(base-face "IBM Plex Mono") + (base-face "Iosevka Comfy Wide") + (base-size 100) (italic-face nil) ;; (bold-face nil) (mono-face nil) - (var-face "IBM Plex Sans") + ;; (var-face "IBM Plex Sans") + (var-face "Iosevka Comfy Duo") (var-size 1.0)) (+set-faces `((default :family ,base-face :height ,base-size - :weight normal) - ;; (bold :family ,(or bold-face base-face) - ;; :weight bold) - (italic :family ,(or italic-face base-face) + :weight regular) + (bold :family ,(or (bound-and-true-p bold-face) base-face) + :weight extra-bold) + (italic :family ,(or (bound-and-true-p italic-face) base-face) :weight normal :slant italic) - (fixed-pitch :family ,(or mono-face base-face) + (fixed-pitch :family ,(or (bound-and-true-p mono-face) base-face) :height 1.0) (variable-pitch :family ,(or var-face base-face) :height ,var-size) - (org-italic - :family ,(or var-face base-face) - :slant italic))))) + ;; (org-italic + ;; :family ,(or var-face base-face) + ;; :slant italic) + )))) ;; Other ideas: [[https://twitter.com/NPRougier/status/1488570192561160195][from Nic Rougier]] -(add-function :after machine-after-load-theme #'+bob-set-faces) +(add-hook 'machine-after-load-theme-hook #'+bob-set-faces) ;; bob.el ends here (+bob-set-faces) -- cgit 1.4.1-21-gabe81