Function: erc-cmd-BANLIST
erc-cmd-BANLIST is a byte-compiled function defined in erc.el.gz.
Signature
(erc-cmd-BANLIST &rest ARGS)
Documentation
Print the list of ban masks for the current channel.
When uninitialized or with option -f, resync erc-channel-banlist.
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-BANLIST (&rest args)
"Print the list of ban masks for the current channel.
When uninitialized or with option -f, resync `erc-channel-banlist'."
(cond
((not (erc-channel-p (current-buffer)))
(erc-display-message nil 'notice 'active "You're not on a channel\n"))
((or (equal args '("-f"))
(and (not erc--channel-banlist-synchronized-p)
(not (get 'erc-channel-banlist 'received-from-server))))
(erc-sync-banlist (erc--wrap-banlist-cmd #'erc-cmd-BANLIST)))
((null erc-channel-banlist)
(erc-display-message nil 'notice 'active
(format "No bans for channel: %s\n" (erc-target))))
((let ((max-width (erc--determine-fill-column-function))
(lw 0) (rw 0) separator fmt)
(dolist (entry erc-channel-banlist)
(setq rw (max (length (car entry)) rw)
lw (max (length (cdr entry)) lw)))
(let ((maxw (* 1.0 (min max-width (+ rw lw)))))
(when (< maxw (+ rw lw)) ; scale down when capped
(cl-psetq rw (/ (* rw maxw) (* 1.0 (+ rw lw)))
lw (/ (* lw maxw) (* 1.0 (+ rw lw)))))
(when-let* ((larger (max rw lw)) ; cap ratio at 3:1
(wavg (* maxw 0.75))
((> larger wavg)))
(setq rw (if (eql larger rw) wavg (- maxw wavg))
lw (- maxw rw)))
(cl-psetq rw (+ rw (* erc-banlist-fill-padding
(- (/ (* rw max-width) maxw) rw)))
lw (+ lw (* erc-banlist-fill-padding
(- (/ (* lw max-width) maxw) lw)))))
(setq rw (truncate rw)
lw (truncate lw))
(cl-assert (<= (+ rw lw) max-width))
(setq separator (make-string (+ rw lw 1) ?=)
fmt (concat "%-" (number-to-string lw) "s "
"%" (number-to-string rw) "s"))
(erc-display-message
nil 'notice 'active
(format "Ban list for channel: %s%s\n" (erc-target)
(if erc--channel-banlist-synchronized-p " (cached)" "")))
(erc-display-line separator 'active)
(erc-display-line (format fmt "Ban Mask" "Banned By") 'active)
(erc-display-line separator 'active)
(dolist (entry erc-channel-banlist)
(erc-display-line
(format fmt (truncate-string-to-width (cdr entry) lw)
(truncate-string-to-width (car entry) rw))
'active))
(erc-display-message nil 'notice 'active "End of Ban list"))))
(put 'erc-channel-banlist 'received-from-server nil)
t)