Function: erc--favor-changed-reverted-modules-state

erc--favor-changed-reverted-modules-state is a byte-compiled function defined in erc-common.el.gz.

Signature

(erc--favor-changed-reverted-modules-state NAME OP)

Documentation

Be more nuanced in displaying Custom state of erc-modules.

When customized-value differs from saved-value, allow widget to behave normally and show "SET for current session", as though customize-set-variable or similar has been applied. However, when customized-value and standard-value match but differ from saved-value, prefer showing "CHANGED outside Customize" to prevent the widget from seeing a standard instead of a set state, which precludes any actual saving.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-common.el.gz
(defun erc--favor-changed-reverted-modules-state (name op)
  "Be more nuanced in displaying Custom state of `erc-modules'.
When `customized-value' differs from `saved-value', allow widget
to behave normally and show \"SET for current session\", as
though `customize-set-variable' or similar has been applied.
However, when `customized-value' and `standard-value' match but
differ from `saved-value', prefer showing \"CHANGED outside
Customize\" to prevent the widget from seeing a `standard'
instead of a `set' state, which precludes any actual saving."
  ;; Although the button "Apply and save" is fortunately grayed out,
  ;; `Custom-save' doesn't actually save (users must click the magic
  ;; state button instead).  The default behavior described in the doc
  ;; string is intentional and was introduced by bug#12864 "Make state
  ;; button interaction less confusing".  However, it is unfriendly to
  ;; rogue libraries (like ours) that insist on mutating user options
  ;; as a matter of course.
  (custom-load-symbol 'erc-modules)
  (funcall (get 'erc-modules 'custom-set) 'erc-modules
           (funcall op (erc--normalize-module-symbol name) erc-modules))
  (when (equal (pcase (get 'erc-modules 'saved-value)
                 (`((quote ,saved)) saved))
               erc-modules)
    (customize-mark-as-set 'erc-modules)))