From 9534a7ed7f0caff60ccf994fbf9980a12387ebd3 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 22 Jul 2021 21:15:12 -0500 Subject: Configure ERC further --- init.el | 8 +++++--- lisp/acdw-erc.el | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index 1cb4e5b..00604d0 100644 --- a/init.el +++ b/init.el @@ -305,10 +305,11 @@ erc-button-url-regexp browse-url-button-regexp erc-common-server-suffixes '(("tilde.chat\\'" . "~") ("libera.chat\\'" . "LC")) - erc-default-server "irc.tilde.chat" ; fuck freenode. all my friends hate + erc-default-server "irc.tilde.chat" ; fuck freenode. all my friends hate ; freenode. erc-fill-function #'erc-fill-static erc-fill-static-center 14 + erc-format-nick-function #'erc-format-truncate-@nick erc-header-line-face-method #'erc/update-header-line-show-disconnected erc-hide-list '("JOIN" "NICK" "PART" "QUIT" "MODE" "324" "329" "332" "333" "353" "477") @@ -319,8 +320,9 @@ erc-kill-queries-on-quit t erc-kill-server-buffer-on-quit t erc-nick "acdw" + erc-nick-truncate (- erc-fill-static-center 2) erc-prompt (lambda () (acdw-erc/prompt)) - erc-prompt-for-password nil ; use ~/.authinfo + erc-prompt-for-password nil ; use ~/.authinfo erc/servers (when (boundp 'erc-autojoin-channels-alist) (mapcar #'car erc-autojoin-channels-alist)) @@ -329,7 +331,7 @@ '("AWAY")) erc-track-exclude-server-buffer t erc-track-position-in-mode-line 'before-modes - erc-track-visibility nil ; only the selected frame + erc-track-visibility nil ; only the selected frame ) ;; Thanks bpalmer! diff --git a/lisp/acdw-erc.el b/lisp/acdw-erc.el index 423c4a5..09fa335 100644 --- a/lisp/acdw-erc.el +++ b/lisp/acdw-erc.el @@ -111,6 +111,27 @@ If USE-TLS is non-nil, use TLS." (setq num (1- num))) (apply #'concat ss)))))) +(defcustom erc-nick-truncate nil + "The width at which to truncate a nick with `erc-format-truncate-@nick'." + :group 'erc + :type 'integer) + +(defun erc-format-truncate-@nick (&optional user channel-data) + "Format the nickname of USER as in `erc-format-@nick', with truncation. +Truncation is customized using the `erc-nick-truncate' variable. +See also `erc-format-nick-function'." + (when user + (let* ((nick (erc-server-user-nickname user)) + (ellipsis "~") + (max-len (- erc-nick-truncate 2 (length ellipsis)))) + (concat (erc-propertize + (erc-get-user-mode-prefix nick) + 'font-lock-face 'erc-nick-prefix-face) + (if (and max-len (> (length nick) max-len)) + (format "%s%s" (substring nick 0 max-len) + ellipsis) + nick))))) + ;;; Uh -- cgit 1.4.1-21-gabe81