Function: erc-schedule-reconnect

erc-schedule-reconnect is a byte-compiled function defined in erc-backend.el.gz.

Signature

(erc-schedule-reconnect BUFFER &optional INCR)

Documentation

Create and return a reconnect timer for BUFFER.

When erc-server-reconnect-attempts is a number, increment erc-server-reconnect-count by INCR unconditionally.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(defun erc-schedule-reconnect (buffer &optional incr)
  "Create and return a reconnect timer for BUFFER.
When `erc-server-reconnect-attempts' is a number, increment
`erc-server-reconnect-count' by INCR unconditionally."
  (let ((count (and (integerp erc-server-reconnect-attempts)
                    (- erc-server-reconnect-attempts
                       (cl-incf erc-server-reconnect-count (or incr 1)))))
        (proc (buffer-local-value 'erc-server-process buffer)))
    (erc-display-message nil '(notice error) buffer 'reconnecting
                         ?m erc-server-reconnect-timeout
                         ?i (if count erc-server-reconnect-count "N")
                         ?n (if count erc-server-reconnect-attempts "A"))
    (set-process-sentinel proc #'ignore)
    (delete-process proc)
    (erc-update-mode-line)
    (setq erc-server-reconnecting nil
          erc--server-reconnect-timer
          (run-at-time erc-server-reconnect-timeout nil
                       erc-server-reconnect-function buffer))))