Function: erc--warn-once-before-connect
erc--warn-once-before-connect is a byte-compiled function defined in
erc.el.gz.
Signature
(erc--warn-once-before-connect MODE-VAR &rest ARGS)
Documentation
Display an "error notice" once.
Expect ARGS to be erc-button--display-error-notice-with-keys
compatible parameters, except without any leading buffers or
processes. If we're in an ERC buffer with a network process when
called, print the notice immediately. Otherwise, if we're in a
server buffer, arrange to do so after local modules have been set
up and mode hooks have run. Otherwise, if MODE-VAR is a global
module, try again at most once the next time erc-mode-hook
runs.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc--warn-once-before-connect (mode-var &rest args)
"Display an \"error notice\" once.
Expect ARGS to be `erc-button--display-error-notice-with-keys'
compatible parameters, except without any leading buffers or
processes. If we're in an ERC buffer with a network process when
called, print the notice immediately. Otherwise, if we're in a
server buffer, arrange to do so after local modules have been set
up and mode hooks have run. Otherwise, if MODE-VAR is a global
module, try again at most once the next time `erc-mode-hook'
runs."
(declare (indent 1))
(cl-assert (stringp (car args)))
(if (derived-mode-p 'erc-mode)
(unless (or (erc-with-server-buffer ; needs `erc-server-process'
(apply #'erc-button--display-error-notice-with-keys
(current-buffer) args)
t)
erc--target) ; unlikely
(let (hook)
(setq hook
(lambda (_)
(remove-hook 'erc-connect-pre-hook hook t)
(apply #'erc-button--display-error-notice-with-keys args)))
(add-hook 'erc-connect-pre-hook hook nil t)))
(when (custom-variable-p mode-var)
(let (hook)
(setq hook (lambda ()
(remove-hook 'erc-mode-hook hook)
(apply #'erc--warn-once-before-connect 'erc-fake args)))
(add-hook 'erc-mode-hook hook)))))