emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix/bug-48598 c25371f9d7 08/27: Don't set erc-server-announced-name unle


From: F. Jason Park
Subject: fix/bug-48598 c25371f9d7 08/27: Don't set erc-server-announced-name unless known
Date: Fri, 8 Apr 2022 03:06:47 -0400 (EDT)

branch: fix/bug-48598
commit c25371f9d7d77c6a350bc9883c32bf9c33be094a
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    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 74d4d6f148..4ef6ec9635 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2036,11 +2036,7 @@ or t, which means that `auth-source' will be queried for 
the
 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 erc--server-reconnecting))
@@ -2051,8 +2047,9 @@ Returns the buffer for the given server or channel."
     (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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]