Function: erc-settings--set-value

erc-settings--set-value is a byte-compiled function defined in erc-settings.el.gz.

Signature

(erc-settings--set-value VAR VALUE FLAGS)

Documentation

Set VAR to VALUE locally and interpret FLAGS.

Do nothing if VAR already has a local binding. If VAR has the symbol property erc-settings--wrap, assume it's a function that takes the arguments (SETTER VAR VALUE), and defer to it to perform the actual setting.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-settings.el.gz
;; Currently, when a binding contains the experimental flag :custom, ERC
;; tries to use VAR's `custom-set' function, if defined, for setting its
;; value. ERC doesn't do so by default because many such functions use
;; `set-default', which defeats the purpose.
(defun erc-settings--set-value (var value flags)
  "Set VAR to VALUE locally and interpret FLAGS.
Do nothing if VAR already has a local binding.  If VAR has the symbol
property `erc-settings--wrap', assume it's a function that takes the
arguments (SETTER VAR VALUE), and defer to it to perform the actual
setting."
  (unless (local-variable-p var)
    (let ((setter #'set)
          (evalp nil)
          (customp nil))
      (dolist (flag flags)
        (pcase-exhaustive flag
          (:eval (setq evalp t))
          (:custom (setq customp t))))
      (make-local-variable var)
      (when evalp
        (setq value (eval value t)))
      (when customp
        (custom-load-symbol var)
        (setq setter (or (get var 'custom-set) #'set)))
      (if-let* ((xsetter (get var 'erc-settings--wrap)))
          (funcall xsetter setter var value)
        (funcall setter var value)))))