Rename erc--with-dependent-type-match for clarity

* lisp/erc/erc-common.el (erc--with-dependent-type-match)
(erc--custom-with-type-match-features): Rename former to latter
to avoid confusion between actual Lisp types and Custom types.
* lisp/erc/erc-track.el (erc-track-faces-priority-list)
(erc-track-faces-normal-list): Use new name.

;; The problem this macro rather bluntly attempts to work around is
;; one of option values referencing symbols from libraries that
;; haven't been loaded.  A general solution might be possible were
;; it not for ERC's inconsistent face and option names.  Some don't
;; even reflect module aliases let alone their group or library,
;; e.g., `erc-pal-face'.  If they were someday properly namespaced,
;; this macro could be replaced with a custom :match function that
;; adds temporary advice :after-until
;;
;;   (compat-call plist-get (cdr (get 'face 'widget-type)) :match)
;;
;; It could then find the longest group name loaded by `cus-load'
;; that's a prefix of the face in question and then load the group's
;; `custom-loads' libraries (see `customize-read-group') with
;; `custom-load-symbol', all before trying `facep' again.
This commit is contained in:
F. Jason Park 2026-05-16 18:42:14 -07:00
parent 3b52f8f981
commit c86cec9202
2 changed files with 8 additions and 3 deletions

View file

@ -572,7 +572,12 @@ Use the CASEMAPPING ISUPPORT parameter to determine the style."
(when erc-channel-members-changed-hook
(run-hooks 'erc-channel-members-changed-hook))))))))
(defmacro erc--with-dependent-type-match (type &rest features)
;; The default values of some ERC's options contain items defined in
;; other libraries that may not be loaded when `setopt' is invoked on
;; the option, which results in an unfriendly warning. User configs can
;; simply `require' such dependencies beforehand, but that's often
;; undesirable in ERC's own library code.
(defmacro erc--custom-with-type-match-features (type &rest features)
"Massage Custom :type TYPE with :match function that pre-loads FEATURES."
`(backquote-list* ',(car type)
:match (lambda (w v)

View file

@ -215,7 +215,7 @@ Note that ERC prioritizes certain faces reserved for critical
messages regardless of this option's value."
:package-version '(ERC . "5.6.1")
:set #'erc-track--massage-nick-button-faces
:type (erc--with-dependent-type-match
:type (erc--custom-with-type-match-features
(repeat (choice face (repeat :tag "Combination" face)))
erc-button))
@ -259,7 +259,7 @@ module. To see your changes reflected mid-session, cycle
The effect may be disabled by setting this variable to nil."
:package-version '(ERC . "5.6.1")
:set #'erc-track--massage-nick-button-faces
:type (erc--with-dependent-type-match
:type (erc--custom-with-type-match-features
(repeat (choice face (repeat :tag "Combination" face)))
erc-button))