Function: erc--define-channel-user-status-compat-getter

erc--define-channel-user-status-compat-getter is a macro defined in erc.el.gz.

Signature

(erc--define-channel-user-status-compat-getter NAME C D)

Documentation

Define accessor with gv getter for historical erc-channel-user slot NAME.

Expect NAME to be a string, C to be its traditionally associated letter, and D to be its fallback power-of-2 integer for non-ERC buffers. Unlike pre-ERC-5.6 accessors, do not bother generating a compiler macro for inlining calls to these adapters.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defmacro erc--define-channel-user-status-compat-getter (name c d)
  "Define accessor with gv getter for historical `erc-channel-user' slot NAME.
Expect NAME to be a string, C to be its traditionally associated letter,
and D to be its fallback power-of-2 integer for non-ERC buffers.  Unlike
pre-ERC-5.6 accessors, do not bother generating a compiler macro for
inlining calls to these adapters."
  `(defun ,(intern (concat "erc-channel-user-" name)) (u)
     ,(format "Get equivalent of pre-5.6 `%s' slot for `erc-channel-user'."
              name)
     (declare (gv-setter (lambda (v)
                           (macroexp-let2 nil v v
                             (,'\`(let ((val (erc-channel-user-status ,',u))
                                        (n (or (erc--get-prefix-flag ,c) ,d)))
                                    (setf (erc-channel-user-status ,',u)
                                          (if ,',v
                                              (logior val n)
                                            (logand val (lognot n))))
                                    ,',v))))))
     (let ((n (or (erc--get-prefix-flag ,c) ,d)))
       (= n (logand n (erc-channel-user-status u))))))