From cb9cfc5731d7f9e47d00fe5f3ff0077e99b668f7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 21 Jul 2022 00:04:47 -0500 Subject: bleh --- init.el | 501 +++++++++++++++++++++++++++--------------------------- lisp/+apheleia.el | 23 ++- lisp/acdw.el | 72 ++++---- lisp/user-save.el | 22 ++- 4 files changed, 323 insertions(+), 295 deletions(-) diff --git a/init.el b/init.el index 73571f6..6775e33 100644 --- a/init.el +++ b/init.el @@ -84,7 +84,7 @@ (apply fn r)))) (setup (:require +init) - (:local-hook user-save-hook #'+init-sort) + (:local-hook user-save-before-save-hook #'+init-sort) (+with-ensure-after-init (:hook #'+init-add-setup-to-imenu))) @@ -147,8 +147,8 @@ ) (setup (:require user-save) - (add-hook 'user-save-hook #'+clean-empty-lines) - (add-hook 'user-save-hook (defun user-save@save-some-buffers () + (add-hook 'user-save-before-save-hook #'+clean-empty-lines) + (add-hook 'user-save-before-save-hook (defun user-save@save-some-buffers () (save-some-buffers t t))) (user-save-global-mode +1)) @@ -375,6 +375,7 @@ (* " "))) (:+leader "s" #'+eshell-here "C-s" #'+eshell-here) + (:global "C-c C-z" #'+eshell-here) (add-to-list 'eshell-modules-list 'eshell-tramp) (with-eval-after-load 'mwim (setf (alist-get 'eshell-mode mwim-beginning-of-line-function) @@ -478,7 +479,7 @@ (executable-find "aspell"))) (put 'ispell-buffer-session-localwords 'safe-local-variable #'+ispell-safe-local-p) - (add-hook 'user-save-hook #'+ispell-move-buffer-words-to-dir-locals-hook)) + (add-hook 'user-save-before-save-hook #'+ispell-move-buffer-words-to-dir-locals-hook)) (setup kmacro (:also-load +kmacro) @@ -729,7 +730,7 @@ ;; (cons ch ch))) ;; org-emphasis-alist)) ) - (:local-hook user-save-hook #'+org-before-save@prettify-buffer) + (:local-hook user-save-before-save-hook #'+org-before-save@prettify-buffer) (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char) ;; (define-advice org-open-at-point (:around (fn &rest r) open-external) ;; "Open links from org externally." @@ -1164,167 +1165,167 @@ '(t)))))) (setup (:straight circe) - (:require _circe - +circe) - (:also-load circe-chanop) - (+ensure-after-init (lambda () (defalias 'irc '+irc "Start IRC."))) + ;; (:require _circe + ;; +circe) + ;; (:also-load circe-chanop) + ;; (+ensure-after-init (lambda () (defalias 'irc '+irc "Start IRC."))) ;; Formatting options - (:option - ;; Messages between users - circe-format-action (format (format "%%%ds* {nick} {body}" - (- +circe-left-margin 2)) - " ") - circe-format-say (format "{nick:%1$d.%1$ds} | {body}" - (- +circe-left-margin 3)) - circe-format-self-action circe-format-action - circe-format-self-say (replace-regexp-in-string "|" ">" circe-format-say) - circe-format-notice (format "-{nick:%1$d.%1$ds}---{body}" - (- +circe-left-margin 4)) - circe-format-message (format (format "%%%ds@ *{nick}* {body}" - (- +circe-left-margin 2)) - " ") - circe-format-message-action (replace-regexp-in-string "@" "*" - circe-format-message) - circe-format-self-message (format (format "%%%ds> *{chattarget}* {body}" - (- +circe-left-margin 2)) - " ") - ;; Meta messages - circe-format-server-channel-creation-time (+circe-format-meta - (concat "Channel {channel}" - " created on {date}") t) - circe-format-server-ctcp (+circe-format-meta - (concat "CTCP PING request to {target} from" - " {userhost}: {body}")) - circe-format-server-ctcp-ping-reply (+circe-format-meta - (concat - "CTCP PING reply to {target} from" - " {userhost}: {body}")) - circe-format-server-part (+circe-format-meta "PART {channel}: {reason}") - circe-format-server-quit (+circe-format-meta "QUIT: {reason}") - circe-format-server-quit-channel (+circe-format-meta - "QUIT {channel}: {reason}") - circe-format-server-join (+circe-format-meta "JOIN: {userinfo}") - circe-format-server-join-in-channel (+circe-format-meta - "JOIN {channel}: {userinfo}") - circe-format-server-lurker-activity (+circe-format-meta - "(JOINED {joindelta} ago)") - circe-format-server-message (+circe-format-meta "{body}" t) - circe-fromat-server-mode-change (+circe-format-meta - (concat "MODE: {target} {change}" - " by {setter} ({userhost})") t) - circe-format-server-netmerge (+circe-format-meta - (concat "NETMERGE: {split} at {date}" - " (/WL to see who's still missing)") t) - circe-format-server-netsplit (+circe-format-meta - (concat "NETSPLIT: {split}" - " (/WL to see who left)") t) - circe-format-server-nick-change (+circe-format-meta - "NICK WAS {old-nick} ({userhost})" - "new-nick") - circe-format-server-nick-regain (+circe-format-meta - "NICK REGAINED: {old-nick} ({userhost})" - "new-nick") - circe-format-server-notice (+circe-format-meta "-SERVER NOTICE- {body}" t) - circe-format-server-topic-time (+circe-format-meta - "TOPIC SET BY {setter} on {topic-date}") - circe-format-server-topic-time-for-channel (+circe-format-meta - (concat - "TOPIC ({channel}) SET BY" - " {setter} on {topic-date}")) - circe-format-server-whois-idle (+circe-format-meta "IDLE FOR {idle-duration}" - "whois-nick") - circe-format-server-whois-idle-with-signon (+circe-format-meta - (concat - "IDLE FOR {idle-duration}" - " (signon: {signon-date})") - "whois-nick") - circe-format-server-rejoin (+circe-format-meta - (concat "REJOIN: {userinfo} " - "after {departuredelta}")) - circe-format-server-topic (+circe-format-meta "TOPIC: {new-topic}") - circe-prompt-string (format (format "%%%ds> " - (- +circe-left-margin 2)) - " ")) - - (:option +circe-server-buffer-action (lambda (buf) - (message "Connected to %s" buf)) - +circe-network-inhibit-autoconnect _circe-network-inhibit-autoconnect - circe-network-options _circe-network-options - circe-color-nicks-everywhere t - circe-default-part-message "See You, Space Cowpokes . . ." - circe-default-user user-real-login-name - circe-reduce-lurker-spam t - circe-server-auto-join-default-type :after-auth) - (:bind "C-c C-p" #'circe-command-PART - "C-c C-t" #'+circe-current-topic - "C-l" #'lui-track-jump-to-indicator - "C-" #'+circe-chat@set-prompt) + ;; (:option + ;; ;; Messages between users + ;; circe-format-action (format (format "%%%ds* {nick} {body}" + ;; (- +circe-left-margin 2)) + ;; " ") + ;; circe-format-say (format "{nick:%1$d.%1$ds} | {body}" + ;; (- +circe-left-margin 3)) + ;; circe-format-self-action circe-format-action + ;; circe-format-self-say (replace-regexp-in-string "|" ">" circe-format-say) + ;; circe-format-notice (format "-{nick:%1$d.%1$ds}---{body}" + ;; (- +circe-left-margin 4)) + ;; circe-format-message (format (format "%%%ds@ *{nick}* {body}" + ;; (- +circe-left-margin 2)) + ;; " ") + ;; circe-format-message-action (replace-regexp-in-string "@" "*" + ;; circe-format-message) + ;; circe-format-self-message (format (format "%%%ds> *{chattarget}* {body}" + ;; (- +circe-left-margin 2)) + ;; " ") + ;; ;; Meta messages + ;; circe-format-server-channel-creation-time (+circe-format-meta + ;; (concat "Channel {channel}" + ;; " created on {date}") t) + ;; circe-format-server-ctcp (+circe-format-meta + ;; (concat "CTCP PING request to {target} from" + ;; " {userhost}: {body}")) + ;; circe-format-server-ctcp-ping-reply (+circe-format-meta + ;; (concat + ;; "CTCP PING reply to {target} from" + ;; " {userhost}: {body}")) + ;; circe-format-server-part (+circe-format-meta "PART {channel}: {reason}") + ;; circe-format-server-quit (+circe-format-meta "QUIT: {reason}") + ;; circe-format-server-quit-channel (+circe-format-meta + ;; "QUIT {channel}: {reason}") + ;; circe-format-server-join (+circe-format-meta "JOIN: {userinfo}") + ;; circe-format-server-join-in-channel (+circe-format-meta + ;; "JOIN {channel}: {userinfo}") + ;; circe-format-server-lurker-activity (+circe-format-meta + ;; "(JOINED {joindelta} ago)") + ;; circe-format-server-message (+circe-format-meta "{body}" t) + ;; circe-fromat-server-mode-change (+circe-format-meta + ;; (concat "MODE: {target} {change}" + ;; " by {setter} ({userhost})") t) + ;; circe-format-server-netmerge (+circe-format-meta + ;; (concat "NETMERGE: {split} at {date}" + ;; " (/WL to see who's still missing)") t) + ;; circe-format-server-netsplit (+circe-format-meta + ;; (concat "NETSPLIT: {split}" + ;; " (/WL to see who left)") t) + ;; circe-format-server-nick-change (+circe-format-meta + ;; "NICK WAS {old-nick} ({userhost})" + ;; "new-nick") + ;; circe-format-server-nick-regain (+circe-format-meta + ;; "NICK REGAINED: {old-nick} ({userhost})" + ;; "new-nick") + ;; circe-format-server-notice (+circe-format-meta "-SERVER NOTICE- {body}" t) + ;; circe-format-server-topic-time (+circe-format-meta + ;; "TOPIC SET BY {setter} on {topic-date}") + ;; circe-format-server-topic-time-for-channel (+circe-format-meta + ;; (concat + ;; "TOPIC ({channel}) SET BY" + ;; " {setter} on {topic-date}")) + ;; circe-format-server-whois-idle (+circe-format-meta "IDLE FOR {idle-duration}" + ;; "whois-nick") + ;; circe-format-server-whois-idle-with-signon (+circe-format-meta + ;; (concat + ;; "IDLE FOR {idle-duration}" + ;; " (signon: {signon-date})") + ;; "whois-nick") + ;; circe-format-server-rejoin (+circe-format-meta + ;; (concat "REJOIN: {userinfo} " + ;; "after {departuredelta}")) + ;; circe-format-server-topic (+circe-format-meta "TOPIC: {new-topic}") + ;; circe-prompt-string (format (format "%%%ds> " + ;; (- +circe-left-margin 2)) + ;; " ")) + + ;; (:option +circe-server-buffer-action (lambda (buf) + ;; (message "Connected to %s" buf)) + ;; +circe-network-inhibit-autoconnect _circe-network-inhibit-autoconnect + ;; circe-network-options _circe-network-options + ;; circe-color-nicks-everywhere t + ;; circe-default-part-message "See You, Space Cowpokes . . ." + ;; circe-default-user user-real-login-name + ;; circe-reduce-lurker-spam t + ;; circe-server-auto-join-default-type :after-auth) + ;; (:bind "C-c C-p" #'circe-command-PART + ;; "C-c C-t" #'+circe-current-topic + ;; "C-l" #'lui-track-jump-to-indicator + ;; "C-" #'+circe-chat@set-prompt) ;; XXX: this doesn't quite work right. - (advice-add #'circe-command-PART :after #'+circe-kill-buffer) - (advice-add #'circe-command-QUIT :after #'+circe-quit@kill-buffer) - (advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer) - - (:with-mode circe-chat-mode - (:local-set lui-input-function #'+lui-filter - +modeline-position-function #'ignore) - (:hook #'enable-circe-color-nicks - #'enable-circe-new-day-notifier - #'+circe-chat@set-prompt - ;; Filters - ;;#'+circe-F/C-mode - ;; For some reason `+circe-shorten-url-mode' won't work right out of - ;; the gate. - ;;(lambda () (run-at-time 0.25 nil #'+circe-shorten-url-mode)) - ) - (:bind "C-c C-s" #'circe-command-SLAP)) - - (:with-mode lui-mode - (:option lui-fill-column (+ fill-column +circe-left-margin) - lui-fill-type nil - lui-max-buffer-size (+bytes 10 :kb) - lui-time-stamp-position 'right-margin - lui-time-stamp-format "| %H:%M" - lui-track-behavior 'before-switch-to-buffer - lui-track-indicator 'bar - lui-fill-remove-face-from-newline nil - lui-formatting-list `((,(+lui-make-formatting-list-rx "*") - 1 lui-strong-face) - (,(+lui-make-formatting-list-rx "_") - 1 lui-emphasis-face) - (,(+lui-make-formatting-list-rx "/") - 1 lui-emphasis-face)) - lui-autopaste-function - (defun +0x0-upload-string (string) - "Upload a string using 0x0." - (with-temp-buffer - (insert string) - (0x0-upload-text (0x0--choose-server))) - (current-kill 0))) - (add-to-list '+pulse-location-commands #'lui-track-jump-to-indicator) - (:face 'lui-track-bar '((t ( :height 10 - :underline ( :color foreground-color - :style line - :position line) - :extend t :inhert (default))))) - (:hook #'visual-line-mode - #'enable-lui-track - #'visual-fill-column-mode - #'enable-lui-autopaste - (defun turn-off-+nyan-mode () (+nyan-local-mode -1)) - (defun turn-off-electric-pair-mode () (electric-pair-mode -1))) - (:local-set fringes-outside-margins t - right-margin-width (length lui-time-stamp-format) - scroll-margin 0 - scroll-step 1 - word-wrap t - wrap-prefix (+string-repeat +circe-left-margin " ") - line-number-mode nil - column-number-mode nil - file-percentage-mode nil - visual-fill-column-extra-text-width - (cons +circe-left-margin 0))) + ;; (advice-add #'circe-command-PART :after #'+circe-kill-buffer) + ;; (advice-add #'circe-command-QUIT :after #'+circe-quit@kill-buffer) + ;; (advice-add #'circe-command-GQUIT :after #'+circe-gquit@kill-buffer) + + ;; (:with-mode circe-chat-mode + ;; (:local-set lui-input-function #'+lui-filter + ;; +modeline-position-function #'ignore) + ;; (:hook #'enable-circe-color-nicks + ;; #'enable-circe-new-day-notifier + ;; #'+circe-chat@set-prompt + ;; ;; Filters + ;; ;;#'+circe-F/C-mode + ;; ;; For some reason `+circe-shorten-url-mode' won't work right out of + ;; ;; the gate. + ;; ;;(lambda () (run-at-time 0.25 nil #'+circe-shorten-url-mode)) + ;; ) + ;; (:bind "C-c C-s" #'circe-command-SLAP)) + + ;; (:with-mode lui-mode + ;; (:option lui-fill-column (+ fill-column +circe-left-margin) + ;; lui-fill-type nil + ;; lui-max-buffer-size (+bytes 10 :kb) + ;; lui-time-stamp-position 'right-margin + ;; lui-time-stamp-format "| %H:%M" + ;; lui-track-behavior 'before-switch-to-buffer + ;; lui-track-indicator 'bar + ;; lui-fill-remove-face-from-newline nil + ;; lui-formatting-list `((,(+lui-make-formatting-list-rx "*") + ;; 1 lui-strong-face) + ;; (,(+lui-make-formatting-list-rx "_") + ;; 1 lui-emphasis-face) + ;; (,(+lui-make-formatting-list-rx "/") + ;; 1 lui-emphasis-face)) + ;; lui-autopaste-function + ;; (defun +0x0-upload-string (string) + ;; "Upload a string using 0x0." + ;; (with-temp-buffer + ;; (insert string) + ;; (0x0-upload-text (0x0--choose-server))) + ;; (current-kill 0))) + ;; (add-to-list '+pulse-location-commands #'lui-track-jump-to-indicator) + ;; (:face 'lui-track-bar '((t ( :height 10 + ;; :underline ( :color foreground-color + ;; :style line + ;; :position line) + ;; :extend t :inhert (default))))) + ;; (:hook #'visual-line-mode + ;; #'enable-lui-track + ;; #'visual-fill-column-mode + ;; #'enable-lui-autopaste + ;; (defun turn-off-+nyan-mode () (+nyan-local-mode -1)) + ;; (defun turn-off-electric-pair-mode () (electric-pair-mode -1))) + ;; (:local-set fringes-outside-margins t + ;; right-margin-width (length lui-time-stamp-format) + ;; scroll-margin 0 + ;; scroll-step 1 + ;; word-wrap t + ;; wrap-prefix (+string-repeat +circe-left-margin " ") + ;; line-number-mode nil + ;; column-number-mode nil + ;; file-percentage-mode nil + ;; visual-fill-column-extra-text-width + ;; (cons +circe-left-margin 0))) (tracking-mode +1) (:with-mode tracking-mode @@ -1339,13 +1340,14 @@ '(tracking-mode tracking-mode-line-buffers))) - (with-eval-after-load 'topsy - (:option (append topsy-mode-functions) - '(circe-channel-mode . +circe-current-topic))) + ;; (with-eval-after-load 'topsy + ;; (:option (append topsy-mode-functions) + ;; '(circe-channel-mode . +circe-current-topic))) - (with-eval-after-load 'circe-color-nicks - (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset)) - (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs)) + ;; (with-eval-after-load 'circe-color-nicks + ;; (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 :repo "NicholasBHubbard/clean-kill-ring.el")) @@ -1540,79 +1542,79 @@ (t . bar))) (electric-cursor-mode +1)) -(setup (:straight elfeed) - (:require +elfeed) - (+define-dir elfeed/ (sync/ "emacs/elfeed/" t)) - (:option - elfeed-curl-program-name (executable-find "curl") - elfeed-use-curl elfeed-curl-program-name - elfeed-curl-extra-arguments '("--insecure") - elfeed-enclosure-default-dir (cl-loop for dir in '("~/var/download/" - "~/Downloads/") - if (file-exists-p dir) - return dir) - elfeed-search-filter "@10-days-ago +unread" - elfeed-search-trailing-width 24 - elfeed-search-title-min-width 24 - elfeed-search-title-max-width 78 - elfeed-search-remain-on-entry t - elfeed-show-unique-buffers t - elfeed-db-directory (elfeed/ "db/" t)) - (:+leader "f" #'elfeed "C-f" #'elfeed) - (advice-add #'elfeed-search-fetch :after #'beginning-of-buffer) - (:with-mode elfeed-search-mode - (:bind "&" #'+elfeed-search-browse-generic - "w" #'elfeed-search-yank - "y" nil - "a" #'+elfeed-show-mark-read-and-advance) - (:hook #'hl-line-mode) - ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ - (advice-add #'elfeed-search-update--force :after #'elfeed-db-save) - (advice-add #'elfeed :before #'elfeed-db-load)) - (:with-mode elfeed-show-mode - (:bind "SPC" #'+elfeed-scroll-up-command - "S-SPC" #'+elfeed-scroll-down-command - "&" #'+elfeed-show-browse-generic - "RET" #'shr-browse-url - "w" #'elfeed-show-yank - "y" nil) - (:hook #'reading-mode) - (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour - +elfeed--update-first-time 60)) - (+elfeed-update-async-mode +1) - (add-hook '+elfeed-update-proceed-hook (defun non-work-hours? () - "Return nil if during work hours, t otherwise." - (let* ((now (current-time)) - (now* (decode-time now)) - (work-start* (append '(0 0 8) (cdddr now*))) ; 8:00 AM - (work-end* (append '(0 0 18) (cdddr now*))) ; 6:00 PM - (work-start (encode-time work-start*)) - (work-end (encode-time work-end*))) - (or (time-less-p now work-start) - (time-less-p work-end now)))))) - -(setup (:straight elfeed-org) - (:also-load +org-capture) - (:option rmh-elfeed-org-files (list (elfeed/ "elfeed.org" t))) - (elfeed-org) - (+org-capture-templates-setf "f" - `("Feed" entry - (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 elfeed) +;; (:require +elfeed) +;; (+define-dir elfeed/ (sync/ "emacs/elfeed/" t)) +;; (:option +;; elfeed-curl-program-name (executable-find "curl") +;; elfeed-use-curl elfeed-curl-program-name +;; elfeed-curl-extra-arguments '("--insecure") +;; elfeed-enclosure-default-dir (cl-loop for dir in '("~/var/download/" +;; "~/Downloads/") +;; if (file-exists-p dir) +;; return dir) +;; elfeed-search-filter "@10-days-ago +unread" +;; elfeed-search-trailing-width 24 +;; elfeed-search-title-min-width 24 +;; elfeed-search-title-max-width 78 +;; elfeed-search-remain-on-entry t +;; elfeed-show-unique-buffers t +;; elfeed-db-directory (elfeed/ "db/" t)) +;; (:+leader "f" #'elfeed "C-f" #'elfeed) +;; (advice-add #'elfeed-search-fetch :after #'beginning-of-buffer) +;; (:with-mode elfeed-search-mode +;; (:bind "&" #'+elfeed-search-browse-generic +;; "w" #'elfeed-search-yank +;; "y" nil +;; "a" #'+elfeed-show-mark-read-and-advance) +;; (:hook #'hl-line-mode) +;; ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ +;; (advice-add #'elfeed-search-update--force :after #'elfeed-db-save) +;; (advice-add #'elfeed :before #'elfeed-db-load)) +;; (:with-mode elfeed-show-mode +;; (:bind "SPC" #'+elfeed-scroll-up-command +;; "S-SPC" #'+elfeed-scroll-down-command +;; "&" #'+elfeed-show-browse-generic +;; "RET" #'shr-browse-url +;; "w" #'elfeed-show-yank +;; "y" nil) +;; (:hook #'reading-mode) +;; (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour +;; +elfeed--update-first-time 60)) +;; (+elfeed-update-async-mode +1) +;; (add-hook '+elfeed-update-proceed-hook (defun non-work-hours? () +;; "Return nil if during work hours, t otherwise." +;; (let* ((now (current-time)) +;; (now* (decode-time now)) +;; (work-start* (append '(0 0 8) (cdddr now*))) ; 8:00 AM +;; (work-end* (append '(0 0 18) (cdddr now*))) ; 6:00 PM +;; (work-start (encode-time work-start*)) +;; (work-end (encode-time work-end*))) +;; (or (time-less-p now work-start) +;; (time-less-p work-end now)))))) + +;; (setup (:straight elfeed-org) +;; (:also-load +org-capture) +;; (:option rmh-elfeed-org-files (list (elfeed/ "elfeed.org" t))) +;; (elfeed-org) +;; (+org-capture-templates-setf "f" +;; `("Feed" entry +;; (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)) @@ -1869,11 +1871,15 @@ jabber-groupchat-buffer-format "%n" jabber-chat-buffer-format "%n" jabber-muc-private-buffer-format "%n(%g)" + jabber-muc-header-line-format '("" jabber-muc-topic) jabber-activity-show-p #'ignore jabber-muc-decorate-presence-patterns '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") ("." . jabber-muc-presence-dim)) - jabber-muc-colorize-foreign nil ; colorizing doesn't match my color theme + jabber-muc-colorize-foreign nil ; doesn't match my color theme + jabber-groupchat-prompt-format "[%t] %n\n" + jabber-chat-local-prompt-format "[%t] %n\n" + jabber-chat-foreign-prompt-format "[%t] %n\n" ;; jabber-chat-foreign-prompt-format ;; (concat +jabber-pre-prompt ;; "%n\n" @@ -1909,7 +1915,9 @@ jabber-roster-mode jabber-console-mode)) (let ((hook (intern (format "%s-hook" mode)))) - (add-hook hook #'visual-fill-column-mode))) + (add-hook hook #'visual-fill-column-mode) + ;; (add-hook hook (lambda () (setq-local wrap-prefix " "))) + )) (with-eval-after-load 'tracking (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca")) (:with-mode jabber-chat-mode @@ -2483,13 +2491,6 @@ trashed-use-header-line t trashed-size-format 'human-readable)) -(setup (:straight (twtxt - :fork (:repo "duckwork/twtxt-el"))) - (:require) - (:also-load _twtxt) - (:option twtxt-file _twtxt-file - twtxt-following _twtxt-following)) - (setup (:straight undo-fu) (:quit "Trying native undo functionality") (:option undo-fu-allow-undo-in-region t) (:global "C-/" #'undo-fu-only-undo diff --git a/lisp/+apheleia.el b/lisp/+apheleia.el index 3428a72..51cf145 100644 --- a/lisp/+apheleia.el +++ b/lisp/+apheleia.el @@ -3,6 +3,7 @@ ;;; Code: (require 'cl-lib) +(require 'el-patch) (require 'user-save) ;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623 @@ -14,13 +15,31 @@ (point-max)) (funcall callback))) +;;; Why does the original function have to check for `apheleia-mode' ? +(el-patch-defun apheleia--format-after-save () + "Run code formatter for current buffer if any configured, then save." + (unless apheleia--format-after-save-in-progress + (when (el-patch-swap apheleia-mode + (or apheleia-mode + +apheleia/user-save-mode)) + (when-let ((formatters (apheleia--get-formatters))) + (apheleia-format-buffer + formatters + (lambda () + (with-demoted-errors "Apheleia: %s" + (when buffer-file-name + (let ((apheleia--format-after-save-in-progress t)) + (apheleia--save-buffer-silently))) + (run-hooks 'apheleia-post-format-hook)))))))) + + (define-minor-mode +apheleia/user-save-mode "Minor mode for reformatting code on `user-save'. Customize with `apheleia-mode-alist' and `apheleia-formatters'." :lighter " Apheleia/US" (if +apheleia/user-save-mode - (add-hook 'user-save-hook #'apheleia--format-after-save nil 'local) - (remove-hook 'user-save-hook #'apheleia--format-after-save 'local))) + (add-hook 'user-save-after-save-hook #'apheleia--format-after-save nil 'local) + (remove-hook 'user-save-after-save-hook #'apheleia--format-after-save 'local))) (define-globalized-minor-mode +apheleia/user-save-global-mode +apheleia/user-save-mode +apheleia/user-save-mode) diff --git a/lisp/acdw.el b/lisp/acdw.el index 26d1494..99ab733 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -297,44 +297,44 @@ always nil; this function is mostly intended for use in init." (setq r (concat r str))) r)) -(defun chat-disconnect () - "Disconnect from all chats." - (interactive) - (+with-progress "Quitting circe..." - (ignore-errors - (circe-command-GQUIT "peace love bread") - (cancel-timer (irc-connection-get conn :flood-timer)))) - (+with-progress "Quitting jabber..." - (ignore-errors - (jabber-disconnect))) - (when (boundp '+slack-teams) - (+with-progress "Quitting-slack..." - (dolist (team +slack-teams) - (ignore-errors - (slack-team-disconnect team))) - (ignore-errors (slack-ws-close)))) - (+with-progress "Killing buffers..." - (ignore-errors - (+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally." - (let ((kill-buffer-query-functions nil)) - (tracking-remove-buffer (current-buffer)) - (kill-buffer))) - (lambda () "Return t if derived from the following modes." - (derived-mode-p 'lui-mode - 'jabber-chat-mode - 'jabber-roster-mode - 'jabber-browse-mode - 'slack-mode)))))) +;; (defun chat-disconnect () +;; "Disconnect from all chats." +;; (interactive) +;; (+with-progress "Quitting circe..." +;; (ignore-errors +;; (circe-command-GQUIT "peace love bread") +;; (cancel-timer (irc-connection-get conn :flood-timer)))) +;; (+with-progress "Quitting jabber..." +;; (ignore-errors +;; (jabber-disconnect))) +;; (when (boundp '+slack-teams) +;; (+with-progress "Quitting-slack..." +;; (dolist (team +slack-teams) +;; (ignore-errors +;; (slack-team-disconnect team))) +;; (ignore-errors (slack-ws-close)))) +;; (+with-progress "Killing buffers..." +;; (ignore-errors +;; (+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally." +;; (let ((kill-buffer-query-functions nil)) +;; (tracking-remove-buffer (current-buffer)) +;; (kill-buffer))) +;; (lambda () "Return t if derived from the following modes." +;; (derived-mode-p 'lui-mode +;; 'jabber-chat-mode +;; 'jabber-roster-mode +;; 'jabber-browse-mode +;; 'slack-mode)))))) ;; I can never remember all the damn chat things I run, so this just does all of em. -(defun chat (&optional arg) - "Initiate all chat functions. -With optional ARG, kill all chat-related buffers first." - (interactive "P") - (when arg (chat-disconnect)) - (dolist-with-progress-reporter (fn chat-functions) - "Connecting to chat..." - (call-interactively fn))) +;; (defun chat (&optional arg) +;; "Initiate all chat functions. +;; With optional ARG, kill all chat-related buffers first." +;; (interactive "P") +;; (when arg (chat-disconnect)) +;; (dolist-with-progress-reporter (fn chat-functions) +;; "Connecting to chat..." +;; (call-interactively fn))) (defun +forward-paragraph (arg) "Move forward ARG (simple) paragraphs. diff --git a/lisp/user-save.el b/lisp/user-save.el index 1c04c9d..674abac 100644 --- a/lisp/user-save.el +++ b/lisp/user-save.el @@ -20,7 +20,7 @@ (defgroup user-save nil "Group for `user-save-mode' customizations." - :group 'emacs + :group 'files :prefix "user-save-") (defcustom user-save-hook-into-kill-emacs nil @@ -39,8 +39,13 @@ Each predicate will be called with no arguments, and if it returns t, will inhibit `user-save-mode' from activating." :type '(repeat function)) -(defvar user-save-hook nil - "Hook to run when the user, not Emacs, saves the buffer.") +(defcustom user-save-before-save-hook nil + "Hook to run before the user, not Emacs, saves the buffer." + :type 'hook) + +(defcustom user-save-after-save-hook nil + "Hook to run after the user, not Emacs, saves the buffer." + :type 'hook) (defvar user-save-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-x C-s") #'user-save-buffer) @@ -49,11 +54,13 @@ returns t, will inhibit `user-save-mode' from activating." "Keymap for `user-save-mode'. This map shadows the default map for `save-buffer'.") -(defun user-save-run-hooks (&rest _) - "Run the hooks in `user-save-hook'. +(defun user-save-run-hooks (which &rest _) + "Run the hooks in one of the user-save-hooks. +If WHICH is `'before', run `user-save-before-save-hook'; +if it's `after', run `user-save-after-save-hook'. This does /not/ also save the buffer." (with-demoted-errors "User-save-hook error: %S" - (run-hooks 'user-save-hook))) + (run-hooks (intern (format "user-save-%s-save-hook" which))))) (defun user-save-non-file-buffer-p (&optional buffer-or-name) "Return whether BUFFER-OR-NAME is a non-file buffer. @@ -74,8 +81,9 @@ run all the time, put them in `user-save-hook'. ARG is passed directly to `save-buffer'." (interactive '(called-interactively)) (message "User-Saving the buffer...") - (user-save-run-hooks) + (user-save-run-hooks 'before) (save-buffer arg) + (user-save-run-hooks 'after) (message "User-Saving the buffer...Done.")) (defun user-save-some-buffers (&optional pred) -- cgit 1.4.1-21-gabe81