Skip to content

Instantly share code, notes, and snippets.

@jmn
Created June 3, 2016 09:07
Show Gist options
  • Save jmn/8ed0b4e726928b094087248bf66f394a to your computer and use it in GitHub Desktop.
Save jmn/8ed0b4e726928b094087248bf66f394a to your computer and use it in GitHub Desktop.
;; Align messages in Emacs erc IRC-client by setting nick names
;; to use a fixed number of chars.
(defun jmn-erc-format-nick (&optional user channel-data)
"Like `erc-format-nick' but trim/pad nick to a fixed length.
- Based on xwl-erc-format-nick"
(let ((nick (erc-format-nick user channel-data)))
(when (> (length nick) 9)
(setq nick (concat (substring nick 0 6)
".."
(substring nick -1))))
(when (< (length nick) 9)
(setq nick (format "%-9s" nick)))
nick))
;; Use with below (or customize):
(setq erc-format-nick-function 'jmn-erc-format-nick)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment