Function: erc--parse-user-modes

erc--parse-user-modes is a byte-compiled function defined in erc.el.gz.

Signature

(erc--parse-user-modes STRING &optional CURRENT EXTRAP)

Documentation

Return lists of chars from STRING to add to and drop from CURRENT.

Expect STRING to be a so-called "modestring", the second parameter of a "MODE" command, here containing only valid user-mode letters. Expect CURRENT to be a list of chars resembling those found in erc--user-modes(var)/erc--user-modes(fun). With EXTRAP, return two additional lists of chars: those that would be added were they not already present in CURRENT and those that would be dropped were they not already absent.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc--parse-user-modes (string &optional current extrap)
  "Return lists of chars from STRING to add to and drop from CURRENT.
Expect STRING to be a so-called \"modestring\", the second
parameter of a \"MODE\" command, here containing only valid
user-mode letters.  Expect CURRENT to be a list of chars
resembling those found in `erc--user-modes'.  With EXTRAP, return
two additional lists of chars: those that would be added were
they not already present in CURRENT and those that would be
dropped were they not already absent."
  (let ((addp t)
        ;;
        redundant-add redundant-drop adding dropping)
    (erc--doarray (c string)
      (pcase c
        (?+ (setq addp t))
        (?- (setq addp nil))
        (_ (push c (let ((hasp (and current (memq c current))))
                     (if addp
                         (if hasp redundant-add adding)
                       (if hasp dropping redundant-drop)))))))
    (if extrap
        (list (nreverse adding) (nreverse dropping)
              (nreverse redundant-add) (nreverse redundant-drop))
      (list (nreverse adding) (nreverse dropping)))))