Function: erc--with-isupport-data

erc--with-isupport-data is a macro defined in erc-backend.el.gz.

Signature

(erc--with-isupport-data PARAM VAR &rest BODY)

Documentation

Return structured data stored in VAR for "ISUPPORT" PARAM.

Expect VAR's value to be an instance of erc--isupport-data. If VAR is uninitialized or stale, evaluate BODY and assign the result to VAR.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
;; While it's better to depend on interfaces than specific types,
;; using `cl-struct-slot-value' or similar to extract a known slot at
;; runtime would incur a small "ducktyping" tax, which should probably
;; be avoided when running hundreds of times per incoming message.
;; Instead of separate keys per data type, we could increment a
;; counter whenever a new 005 arrives.
(defmacro erc--with-isupport-data (param var &rest body)
  "Return structured data stored in VAR for \"ISUPPORT\" PARAM.
Expect VAR's value to be an instance of `erc--isupport-data'.  If
VAR is uninitialized or stale, evaluate BODY and assign the
result to VAR."
  (declare (indent defun))
  `(erc-with-server-buffer
     (pcase-let (((,@(list '\` (list param  '\, 'key)))
                  (erc--get-isupport-entry ',param)))
       (or (and ,var (eq key (erc--isupport-data-key ,var)) ,var)
           (setq ,var (progn ,@body))))))