From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 14 Jun 2021 23:40:45 -0700 Subject: [PATCH 08/35] Don't set erc-server-announced-name unless known * lisp/erc/erc.el (erc-open): whenever this function is called, the variable `erc-server-announced-name' may be set locally in the calling server buffer. However, if that buffer's dialed server matches that of the one being created, the announced name is copied over on faith. But there's no guarantee that the name will match the one ultimately emitted by the server during its introductory burst. Beyond potentially causing confusion in protocol logs, this behavior may complicate debugging efforts. Setting the variable to nil helps ensure a consistent environment when preparing a buffer for all newly dialed connections. This commit also simplifies the setting of `erc-server-connected', which is always nil when connecting and vice-versa. --- lisp/erc/erc.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 4f587cbfbc..16252a181d 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2047,11 +2047,7 @@ erc-open private key and the certificate. Returns the buffer for the given server or channel." - (let ((server-announced-name (when (and (boundp 'erc-session-server) - (string= server erc-session-server)) - erc-server-announced-name)) - (connected-p (unless connect erc-server-connected)) - (buffer (erc-get-buffer-create server port channel)) + (let ((buffer (erc-get-buffer-create server port channel)) (old-buffer (current-buffer)) old-point (continued-session (and erc-reuse-buffers erc--server-reconnecting))) @@ -2062,8 +2058,9 @@ erc-open (let ((old-recon-count erc-server-reconnect-count)) (erc-mode) (setq erc-server-reconnect-count old-recon-count)) - (setq erc-server-announced-name server-announced-name) - (setq erc-server-connected connected-p) + (when (setq erc-server-connected (not connect)) + (setq erc-server-announced-name + (buffer-local-value 'erc-server-announced-name old-buffer))) ;; connection parameters (setq erc-server-process process) (setq erc-insert-marker (make-marker)) -- 2.36.1