emacs-diffs
[Top][All Lists]
Advanced

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

master de53d18a4d 07/25: Don't set erc-server-announced-name unless know


From: F. Jason Park
Subject: master de53d18a4d 07/25: Don't set erc-server-announced-name unless known
Date: Thu, 30 Jun 2022 18:29:52 -0400 (EDT)

branch: master
commit de53d18a4d81e8b49d1dfecaf5481382a0ad8d08
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 2ee461a663..7f102dcefb 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2047,11 +2047,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 (and erc-reuse-buffers erc--server-reconnecting)))
@@ -2062,8 +2058,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]