From f99a58906b0c258194e0f010a6490c3fd6af3f98 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 23 Jul 2024 14:06:29 -0400 Subject: [PATCH] refactor(irc): minor reformatting - Remove redundant autoloads (already autoloaded by packages). - Move lui configuration to lui use-package! block. - Ensure consistent use of whitespace. --- modules/app/irc/config.el | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index 8f8e029ee..65b4b6f9d 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -36,10 +36,10 @@ playback.") ;; -;; Packages +;;; Packages (use-package! circe - :commands circe circe-server-buffers + :commands circe-server-buffers :config (setq circe-default-quit-message nil circe-default-part-message nil @@ -91,18 +91,6 @@ playback.") :after #'circe--irc-conn-disconnected (run-hooks '+irc-disconnect-hook)) - (add-hook! 'lui-pre-output-hook - (defun +irc-circe-truncate-nicks-h () - "Truncate long nicknames in chat output non-destructively." - (when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)) - (goto-char beg) - (let ((end (next-single-property-change beg 'lui-format-argument)) - (nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords) - :nick))) - (when (> (length nick) +irc-left-padding) - (compose-region (+ beg +irc-left-padding -1) end - +irc-truncate-nick-char)))))) - (add-hook! 'circe-message-option-functions (defun +irc-circe-message-option-bot-h (nick &rest ignored) "Fontify known bots and mark them to not be tracked." @@ -154,7 +142,7 @@ playback.") (use-package! circe-notifications - :commands enable-circe-notifications + :defer t :init (add-hook! 'circe-server-connected-hook (defun +irc-init-circe-notifications-h () @@ -181,6 +169,18 @@ playback.") (setq lui-time-stamp-format "%H:%M" lui-time-stamp-position 'right-margin) + (add-hook! 'lui-pre-output-hook + (defun +irc-truncate-nicks-h () + "Truncate long nicknames in chat output non-destructively." + (when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)) + (goto-char beg) + (let ((end (next-single-property-change beg 'lui-format-argument)) + (nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords) + :nick))) + (when (> (length nick) +irc-left-padding) + (compose-region (+ beg +irc-left-padding -1) end + +irc-truncate-nick-char)))))) + (after! evil (defun +irc-evil-insert-h () "Ensure entering insert mode will put us at the prompt, unless editing @@ -195,7 +195,6 @@ after prompt marker." (mapc (lambda (cmd) (push cmd +irc-scroll-to-bottom-on-commands)) '(evil-paste-after evil-paste-before evil-open-above evil-open-below))) - (defun +irc-preinput-scroll-to-bottom-h () "Go to the end of the buffer in all windows showing it. Courtesy of esh-mode.el"