Skip to content

Instantly share code, notes, and snippets.

@mplscorwin
Created January 20, 2020 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mplscorwin/0fd23717d41e317825cd13b10c503a7c to your computer and use it in GitHub Desktop.
Save mplscorwin/0fd23717d41e317825cd13b10c503a7c to your computer and use it in GitHub Desktop.
Can't ever remember where I stole this code. Sketchy.
;;; erc-countusers-mode.el --- display a count of channel users in the mode-string
;;; Commentary:
;; TODO: return empty string if parted/disconnected
;; TODO: add to emacswiki files
;;; Code:
(define-minor-mode ncm-mode "https://www.emacswiki.org/emacs/ErcModeline
Add this to your .emacs to see the number of opped/voiced/normal members of the
current channel in the modeline:" nil
(:eval
(let ((ops 0)
(voices 0)
(members 0))
(maphash (lambda (key value)
(when (erc-channel-user-op-p key)
(setq ops (1+ ops)))
(when (erc-channel-user-voice-p key)
(setq voices (1+ voices)))
(setq members (1+ members)))
erc-channel-users)
(format " %S/%S/%S" ops voices members))))
(provide ncm-mode)
;;; erc-countusers-mode.el ends here
@mplscorwin
Copy link
Author

Oh good. I did leave a URL in the source somewhere just took me a minute to find it:

See: https://www.emacswiki.org/emacs/ErcModeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment