Variable: erc--updating-modules-p

erc--updating-modules-p is a variable defined in erc.el.gz.

Value

nil

Documentation

Non-nil when running erc--update-modules in erc-open.

This allows global modules with known or likely dependents (or some other reason for activating after session initialization) to conditionally run setup code traditionally reserved for erc-mode-hook in the setup portion of their mode toggle. Note that being "global", they'll likely want to do so in all ERC buffers and ensure the code is idempotent. For example:

  (add-hook 'erc-mode-hook #'erc-foo-setup-fn)
  (unless erc--updating-modules-p
    (erc-with-all-buffers-of-server nil
        (lambda () some-condition-p)
      (erc-foo-setup-fn)))

This means that when a dependent module is initializing and realizes it's missing some required module "foo", it can confidently call (erc-foo-mode 1) without having to learn anything about the dependency's implementation.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defvar erc--updating-modules-p nil
  "Non-nil when running `erc--update-modules' in `erc-open'.
This allows global modules with known or likely dependents (or
some other reason for activating after session initialization) to
conditionally run setup code traditionally reserved for
`erc-mode-hook' in the setup portion of their mode toggle.  Note
that being \"global\", they'll likely want to do so in all ERC
buffers and ensure the code is idempotent.  For example:

  (add-hook \\='erc-mode-hook #\\='erc-foo-setup-fn)
  (unless erc--updating-modules-p
    (erc-with-all-buffers-of-server nil
        (lambda () some-condition-p)
      (erc-foo-setup-fn)))

This means that when a dependent module is initializing and
realizes it's missing some required module \"foo\", it can
confidently call (erc-foo-mode 1) without having to learn
anything about the dependency's implementation.")