master c86cec9202d 2/9: Rename erc--with-dependent-type-match for clarity

"F. Jason Park" <[email protected]> Tue, 30 Jun 2026 23:37:21 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit c86cec9202d3e6fb57951a944441b6fe28afe35d
Author: F. Jason Park <[email protected]>
Commit: F. Jason Park <[email protected]>

    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.
---
 lisp/erc/erc-common.el | 7 ++++++-
 lisp/erc/erc-track.el  | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el
index 1a0b9c323d1..aa176a14b46 100644
--- a/lisp/erc/erc-common.el
+++ b/lisp/erc/erc-common.el
@@ -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)
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 6306df3fa2a..91466b9d5e3 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -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))