about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-erc.el21
1 files changed, 21 insertions, 0 deletions
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."
111 (setq num (1- num))) 111 (setq num (1- num)))
112 (apply #'concat ss)))))) 112 (apply #'concat ss))))))
113 113
114(defcustom erc-nick-truncate nil
115 "The width at which to truncate a nick with `erc-format-truncate-@nick'."
116 :group 'erc
117 :type 'integer)
118
119(defun erc-format-truncate-@nick (&optional user channel-data)
120 "Format the nickname of USER as in `erc-format-@nick', with truncation.
121Truncation is customized using the `erc-nick-truncate' variable.
122See also `erc-format-nick-function'."
123 (when user
124 (let* ((nick (erc-server-user-nickname user))
125 (ellipsis "~")
126 (max-len (- erc-nick-truncate 2 (length ellipsis))))
127 (concat (erc-propertize
128 (erc-get-user-mode-prefix nick)
129 'font-lock-face 'erc-nick-prefix-face)
130 (if (and max-len (> (length nick) max-len))
131 (format "%s%s" (substring nick 0 max-len)
132 ellipsis)
133 nick)))))
134
114 135
115;;; Uh 136;;; Uh
116 137