Function: erc--channel-modes
erc--channel-modes is a byte-compiled function defined in erc.el.gz.
Signature
(erc--channel-modes &optional AS-TYPE SEP)
Documentation
Return channel "MODE" settings in a form described by AS-TYPE.
When AS-TYPE is the symbol strings (plural), return letter keys
as a list of sorted string. When it's string (singular),
return keys as a single string. When it's a number N, return a
single string consisting of the concatenated and sorted keys
followed by a space and then their corresponding args, each
truncated to N chars max. ERC joins these args together with
SEP, which defaults to a single space. Otherwise, return a
sorted alist of letter and arg pairs. In all cases that include
values, respect erc-show-channel-key-p and optionally omit the
secret key associated with the letter k.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc--channel-modes (&optional as-type sep)
"Return channel \"MODE\" settings in a form described by AS-TYPE.
When AS-TYPE is the symbol `strings' (plural), return letter keys
as a list of sorted string. When it's `string' (singular),
return keys as a single string. When it's a number N, return a
single string consisting of the concatenated and sorted keys
followed by a space and then their corresponding args, each
truncated to N chars max. ERC joins these args together with
SEP, which defaults to a single space. Otherwise, return a
sorted alist of letter and arg pairs. In all cases that include
values, respect `erc-show-channel-key-p' and optionally omit the
secret key associated with the letter k."
(and-let* ((modes erc--channel-modes)
(tobj (erc--channel-mode-types))
(types (erc--channel-mode-types-table tobj)))
(let (out)
(maphash (lambda (k v)
(unless (eq ?a (aref types k))
(push (cons k
(and (not (eq t v))
(not (and (eq k ?k)
(not (bound-and-true-p
erc-show-channel-key-p))))
v))
out)))
modes)
(setq out (cl-sort out #'< :key #'car))
(pcase as-type
('strings (mapcar (lambda (o) (char-to-string (car o))) out))
('string (apply #'string (mapcar #'car out)))
((and (pred natnump) c)
(let (keys vals)
(pcase-dolist (`(,k . ,v) out)
(when v
(push (if (> (length v) c)
(with-memoization
(gethash (list c k v)
(erc--channel-mode-types-shortargs tobj))
(truncate-string-to-width v c 0 nil t))
v)
vals))
(push k keys))
(concat (apply #'string (nreverse keys)) (and vals " ")
(string-join (nreverse vals) (or sep " ")))))
(_ out)))))