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 --- lisp/acdw-erc.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lisp/acdw-erc.el') 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