Function: erc-networks--set-name

erc-networks--set-name is a byte-compiled function defined in erc-networks.el.gz.

Signature

(erc-networks--set-name PROC PARSED)

Documentation

Set erc-network(var)/erc-network(fun) to the value returned by erc-networks--determine.

Print an error message when the network cannot be determined before shutting down the connection.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-networks.el.gz
Otherwise, expect it to vanish at any time.") ; Bug#59976

(defun erc-networks--set-name (proc parsed)
  "Set `erc-network' to the value returned by `erc-networks--determine'.
Print an error message when the network cannot be determined before
shutting down the connection."
  ;; Always update (possibly clobber) current value, if any.
  (pcase (setq erc-network (erc-networks--determine))
    ((and (pred (eq (erc-networks--id-given erc-networks--id)))
          (let m (format "Couldn't determine network. Using given ID `%s'."
                         erc-network)))
     (erc-display-message parsed 'notice nil m)
     nil)
    ((and
      (guard (eq erc-network erc-networks--name-missing-sentinel))
      ;; This can happen theoretically, e.g., when adjusting settings
      ;; on a proxy service that partially impersonates IRC but isn't
      ;; currently conveying anything through to a real network.  The
      ;; service may send a 422 but no NETWORK param (or *any* 005s).
      (let m (concat "Failed to determine network.  Please set entry for \""
                     erc-server-announced-name "\" in `erc-networks-alist'"
                     " or consider calling `erc-tls' with the keyword `:id'."
                     "  See Info:\"(erc) Network Identifier\" for more.")))
     (require 'info)
     (erc-display-error-notice parsed m)
     (if erc-networks--allow-unknown-network
         (progn
           (erc-display-error-notice
            parsed (format "Continuing anyway with network set to `%s'."
                           erc-network))
           nil)
       (delete-process proc)
       'error))))