Function: erc--find-group

erc--find-group is a byte-compiled function defined in erc-common.el.gz.

Signature

(erc--find-group &rest SYMBOLS)

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-common.el.gz
;; This is a migration helper that determines a module's `:group'
;; keyword argument from its name or alias.  A (global) module's minor
;; mode variable appears under the group's Custom menu.  Like
;; `erc--normalize-module-symbol', it must run when the module's
;; definition (rather than that of `define-erc-module') is expanded.
;; For corner cases in which this fails or the catch-all of `erc' is
;; more inappropriate, (global) modules can declare a top-level
;;
;;   (put 'foo 'erc-group 'erc-bar)
;;
;; where `erc-bar' is the group and `foo' is the normalized module.
;; Do this *before* the module's definition.  If `define-erc-module'
;; ever accepts arbitrary keywords, passing an explicit `:group' will
;; obviously be preferable.

(defun erc--find-group (&rest symbols)
  (catch 'found
    (dolist (s symbols)
      (let* ((downed (downcase (symbol-name s)))
             (known (intern-soft (concat "erc-" downed))))
        (when (and known
                   (or (get known 'group-documentation)
                       (rassq known custom-current-group-alist)))
          (throw 'found known))
        (when (setq known (intern-soft (concat "erc-" downed "-mode")))
          (when-let* ((found (custom-group-of-mode known)))
            (throw 'found found))))
      (when-let* ((found (get (erc--normalize-module-symbol s) 'erc-group)))
        (throw 'found found)))
    'erc))