GNU bug report logs - #51753
ERC switches to channel buffer on reconnect

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: important; Reported by: Stefan Kangas <stefan@HIDDEN>; Keywords: patch; dated Wed, 10 Nov 2021 15:10:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 19 Nov 2021 13:14:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 19 08:14:11 2021
Received: from localhost ([127.0.0.1]:38378 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mo3iV-0005Mx-BQ
	for submit <at> debbugs.gnu.org; Fri, 19 Nov 2021 08:14:11 -0500
Received: from mail-108-mta62.mxroute.com ([136.175.108.62]:45709)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1mo3iT-0005Mg-F1
 for 51753 <at> debbugs.gnu.org; Fri, 19 Nov 2021 08:14:10 -0500
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta62.mxroute.com (ZoneMTA) with ESMTPSA id 17d3855200a000177f.001
 for <51753 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Fri, 19 Nov 2021 13:14:02 +0000
X-Zone-Loop: 6326f686473d14bb7ea9f0686743b6b84cd8cd8de0c9
X-Originating-IP: [149.28.56.236]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me
 ; s=x;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:
 Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=Ya6YSBxhT1MJJ/xeLYMhB27nsUdKZCfHjwkFRKERN9I=; b=g/vluah3GN8Y9q7oVryLzw4dCH
 vLmlAojH9U9tjFvWt9q7Wc/BPbiu5exKa3Hkb4JIIf8qsyq3/1gqgLqjRSgzLrd+SxknjDwJdDXfD
 jXOFuCg1BsAKHH/Ce2ymBaVw3YGv2DPzRzhwM/0jEkmMqd4dRRrDXWiG7A5t95VGjLbZcJ/wxVaH6
 Rgj/zXCJuSMY8EF9TNsKqi1TeteA0aCxCH9fPz3BnoBuEhbtQx9y+NdhXd29brx8VJ2DgEiixvW44
 B1j1UCyKHySZ/ZChEl0T7eqZQJcyk69wjabMXkQe7jlghdsqJxfLfD14vQ+pxcGTppkR4lTxfT/to
 Q0DfbxaA==;
From: "J.P." <jp@HIDDEN>
To: Stefan Kangas <stefan@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
 <87bl2re5eg.fsf@HIDDEN> <87lf1ve0m4.fsf@HIDDEN>
 <877ddf9sht.fsf@HIDDEN> <87czmwjutj.fsf@HIDDEN>
 <CADwFkm=_RaiRkwte+JPRvuM4fntevprWr-qjaBaG6D+Gud_UoQ@HIDDEN>
Date: Fri, 19 Nov 2021 05:13:58 -0800
In-Reply-To: <CADwFkm=_RaiRkwte+JPRvuM4fntevprWr-qjaBaG6D+Gud_UoQ@HIDDEN>
 (Stefan Kangas's message of "Fri, 19 Nov 2021 12:45:14 +0100")
Message-ID: <875ysothih.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 FROM_HAS_DN=0, TO_DN_SOME=0, HAS_ATTACHMENT=0, FROM_EQ_ENVFROM=0,
 MIME_TRACE=0, MIME_GOOD=-0.1, RCPT_COUNT_FIVE=0, MID_RHS_MATCH_FROM=0,
 RCVD_COUNT_ZERO=0, NEURAL_SPAM=0]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 51753
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, emacs-erc@HIDDEN,
 Amin Bandali <bandali@HIDDEN>, 51753 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Stefan Kangas <stefan@HIDDEN> writes:

> On balance, I don't have a strong opinion either way.  (I do like
> `erc-reconnect-display' slightly better, because many variables that end
> with `-buffer' have to do with the _name_ of some buffer.  But it is
> true that it is also nice to have a name similar to `erc-join-buffer'.)

Screw it. Let's go with `erc-reconnect-display'.

> I just have some minor nits below:
>
>> +(defvar-local erc--server-last-reconnect-count 0
>> +  "Snapshot of reconnect count when connection established.")
>
> "when the connection was established", perhaps?

Now reads as ^.

> What is the difference between `buffer' and t?  Should they really have
> the same :tag?

No idea to both, unfortunately. But since the option is only used in
that one function (`erc-setup-buffer'), and since we don't claim
like-for-like compatibility with `erc-join-buffer' (which we've already
deviated from anyway by offering a choice of nil) ...

> I suggest we drop one of them.

Agreed. Thanks.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=0000-v1-v2.diff

From d7e9871283cfc6f0e841adf99251ae7057d39d7b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Fri, 19 Nov 2021 04:41:50 -0800
Subject: NOT A PATCH


F. Jason Park (1):
  Customize displaying of ERC buffers on reconnect

 lisp/erc/erc-backend.el |  3 +++
 lisp/erc/erc.el         | 23 +++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

Interdiff:
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 4b39bd8a30..0d586268e9 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -194,7 +194,7 @@ erc-server-reconnect-count
   "Number of times we have failed to reconnect to the current server.")
 
 (defvar-local erc--server-last-reconnect-count 0
-  "Snapshot of reconnect count when connection established.")
+  "Snapshot of reconnect count when the connection was established.")
 
 (defvar-local erc-server-quitting nil
   "Non-nil if the user requests a quit.")
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 21ae25d920..01be8ed397 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1521,7 +1521,7 @@ erc-join-buffer
                  (const :tag "Use current buffer" buffer)
                  (const :tag "Use current buffer" t)))
 
-(defcustom erc-reconnect-buffer nil
+(defcustom erc-reconnect-display nil
   "How (and whether) to display a channel buffer upon reconnecting.
 
 This only affects automatic reconnections and is ignored when issuing a
@@ -1534,8 +1534,7 @@ erc-reconnect-buffer
                  (const :tag "Split window, don't select" window-noselect)
                  (const :tag "New frame" frame)
                  (const :tag "Bury in new buffer" bury)
-                 (const :tag "Use current buffer" buffer)
-                 (const :tag "Use current buffer" t)))
+                 (const :tag "Use current buffer" buffer)))
 
 (defcustom erc-frame-alist nil
   "Alist of frame parameters for creating erc frames.
@@ -1969,7 +1968,7 @@ erc-setup-buffer
   (pcase (if (zerop (erc-with-server-buffer
                       erc--server-last-reconnect-count))
              erc-join-buffer
-           (or erc-reconnect-buffer erc-join-buffer))
+           (or erc-reconnect-display erc-join-buffer))
     ('window
      (if (active-minibuffer-window)
          (display-buffer buffer)
-- 
2.31.1


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Customize-displaying-of-ERC-buffers-on-reconnect.patch

From d7e9871283cfc6f0e841adf99251ae7057d39d7b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Thu, 18 Nov 2021 23:39:54 -0800
Subject: [PATCH 1/1] Customize displaying of ERC buffers on reconnect

* lisp/erc/erc-backend.el (erc--server-last-reconnect-count):
Add variable to record last reconnect tally.

* lisp/erc/erc.el (erc-reconnect-buffer): Add option to specify
channel-buffer display behavior on reconnect.
(erc-setup-buffer): Use option `erc-reconnect-buffer' if warranted.
(erc-connection-established): Record reconnect count in internal var
before resetting.
---
 lisp/erc/erc-backend.el |  3 +++
 lisp/erc/erc.el         | 23 +++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 69f63dfbc4..0d586268e9 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -193,6 +193,9 @@ erc-server-connected
 (defvar-local erc-server-reconnect-count 0
   "Number of times we have failed to reconnect to the current server.")
 
+(defvar-local erc--server-last-reconnect-count 0
+  "Snapshot of reconnect count when the connection was established.")
+
 (defvar-local erc-server-quitting nil
   "Non-nil if the user requests a quit.")
 
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index c5a4fbe5a0..01be8ed397 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1521,6 +1521,21 @@ erc-join-buffer
                  (const :tag "Use current buffer" buffer)
                  (const :tag "Use current buffer" t)))
 
+(defcustom erc-reconnect-display nil
+  "How (and whether) to display a channel buffer upon reconnecting.
+
+This only affects automatic reconnections and is ignored when issuing a
+/reconnect command or reinvoking `erc-tls' with the same args (assuming
+success, of course).  See `erc-join-buffer' for a description of
+possible values."
+  :group 'erc-buffers
+  :type '(choice (const :tag "Use value of `erc-join-buffer'" nil)
+                 (const :tag "Split window and select" window)
+                 (const :tag "Split window, don't select" window-noselect)
+                 (const :tag "New frame" frame)
+                 (const :tag "Bury in new buffer" bury)
+                 (const :tag "Use current buffer" buffer)))
+
 (defcustom erc-frame-alist nil
   "Alist of frame parameters for creating erc frames.
 A value of nil means to use `default-frame-alist'."
@@ -1950,7 +1965,10 @@ erc-update-modules
 
 (defun erc-setup-buffer (buffer)
   "Consults `erc-join-buffer' to find out how to display `BUFFER'."
-  (pcase erc-join-buffer
+  (pcase (if (zerop (erc-with-server-buffer
+                      erc--server-last-reconnect-count))
+             erc-join-buffer
+           (or erc-reconnect-display erc-join-buffer))
     ('window
      (if (active-minibuffer-window)
          (display-buffer buffer)
@@ -4722,7 +4740,8 @@ erc-connection-established
             (nick (car (erc-response.command-args parsed)))
             (buffer (process-buffer proc)))
         (setq erc-server-connected t)
-	(setq erc-server-reconnect-count 0)
+        (setq erc--server-last-reconnect-count erc-server-reconnect-count
+              erc-server-reconnect-count 0)
         (erc-update-mode-line)
         (erc-set-initial-user-mode nick buffer)
         (erc-server-setup-periodical-ping buffer)
-- 
2.31.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 19 Nov 2021 11:45:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 19 06:45:22 2021
Received: from localhost ([127.0.0.1]:38243 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mo2KX-0006PN-U6
	for submit <at> debbugs.gnu.org; Fri, 19 Nov 2021 06:45:22 -0500
Received: from mail-pf1-f174.google.com ([209.85.210.174]:45654)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1mo2KW-0006P5-R9
 for 51753 <at> debbugs.gnu.org; Fri, 19 Nov 2021 06:45:21 -0500
Received: by mail-pf1-f174.google.com with SMTP id x131so9160762pfc.12
 for <51753 <at> debbugs.gnu.org>; Fri, 19 Nov 2021 03:45:20 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:in-reply-to:references:mime-version:date
 :message-id:subject:to:cc;
 bh=DYTKuxr16cXwP/GETHJq7dcVY7dR5byMAlWGcr+jOcM=;
 b=WbjmQmyuRKQekZD/41etW2xj+44Gd2bT2QTCrTNDUTU62ww8fNy2rocF2AHiGnAQdI
 B7Ao83HSKe3ic98o2CSK+OXABND0nACVgW1biPJq5+jt0m9B14IxYcY3VWewbJXyAmVr
 Xp2ie9TVxTGOuIXTSOEJidjhS8csQtpe/aCGPpWfSIgm20O+J70KNfKfrkS48+6Vs6kH
 wZW7QtWTrz2/e+6XOcS+bsKs2V1nYbuxfWlEygSntrNTHEgoL0vAHHGobj0Pj67JB/aK
 k7VEisCvPOLYS1LaNtABp9nMSwKglomP2WObmsK/lWWnFYUdF1mGhguECQ+0iIGl5KD/
 Ywig==
X-Gm-Message-State: AOAM532/tKtz/ZLuschA4yTAkLS2o9VGQgJtOh1DLZIeCTbdOR6fujgv
 WSNhv1wP/NsSw+V7Z/a4jC6wapozW/ik5FgXE4c=
X-Google-Smtp-Source: ABdhPJypAe2DQM8cIP3TOffo6+jHDXZwglsfJznwR5ZMQSVmZNkeWxp749ENinqE01xvy7ypeBUu91c5R9WOxogY4Bo=
X-Received: by 2002:a63:370c:: with SMTP id e12mr16570969pga.359.1637322314979; 
 Fri, 19 Nov 2021 03:45:14 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 19 Nov 2021 12:45:14 +0100
From: Stefan Kangas <stefan@HIDDEN>
In-Reply-To: <87czmwjutj.fsf@HIDDEN>
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
 <87bl2re5eg.fsf@HIDDEN> <87lf1ve0m4.fsf@HIDDEN>
 <877ddf9sht.fsf@HIDDEN> <87czmwjutj.fsf@HIDDEN>
MIME-Version: 1.0
Date: Fri, 19 Nov 2021 12:45:14 +0100
Message-ID: <CADwFkm=_RaiRkwte+JPRvuM4fntevprWr-qjaBaG6D+Gud_UoQ@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
To: "J.P." <jp@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 51753
Cc: 51753 <at> debbugs.gnu.org, emacs-erc@HIDDEN, Amin Bandali <bandali@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

tags 51753 + patch
thanks

"J.P." <jp@HIDDEN> writes:

> I wasn't sure if that meant I was supposed to work on this. If not,
> please disregard.

You did exactly the right thing here.  Thank you for working on this!

> Otherwise, the tests are in #48598 [1]. As for the name of the option
> itself, I basically punted by going with `erc-reconnect-buffer' to try
> and stay close to `erc-join-buffer'. If that doesn't matter, perhaps
> `erc-reconnect-display' would be a better fit since we already have an
> `erc-query-display' (even though that one's not as closely related).
> Anyone with an opinion, please advise. Thanks.

On balance, I don't have a strong opinion either way.  (I do like
`erc-reconnect-display' slightly better, because many variables that end
with `-buffer' have to do with the _name_ of some buffer.  But it is
true that it is also nice to have a name similar to `erc-join-buffer'.)

I just have some minor nits below:

> +(defvar-local erc--server-last-reconnect-count 0
> +  "Snapshot of reconnect count when connection established.")

"when the connection was established", perhaps?

> +(defcustom erc-reconnect-buffer nil
> +  "How (and whether) to display a channel buffer upon reconnecting.
> +
> +This only affects automatic reconnections and is ignored when issuing a
> +/reconnect command or reinvoking `erc-tls' with the same args (assuming
> +success, of course).  See `erc-join-buffer' for a description of
> +possible values."
> +  :group 'erc-buffers
> +  :type '(choice (const :tag "Use value of `erc-join-buffer'" nil)
> +                 (const :tag "Split window and select" window)
> +                 (const :tag "Split window, don't select" window-noselect)
> +                 (const :tag "New frame" frame)
> +                 (const :tag "Bury in new buffer" bury)
> +                 (const :tag "Use current buffer" buffer)
> +                 (const :tag "Use current buffer" t)))

What is the difference between `buffer' and t?  Should they really have
the same :tag?

If they are just two names for the same thing, I suggest we drop one of
them.

Other than that, LGTM (but I didn't test it).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 19 Nov 2021 10:36:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 19 05:36:56 2021
Received: from localhost ([127.0.0.1]:38167 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mo1GK-0004Ei-AZ
	for submit <at> debbugs.gnu.org; Fri, 19 Nov 2021 05:36:56 -0500
Received: from mail-108-mta1.mxroute.com ([136.175.108.1]:33647)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1mo1GI-0004EQ-9a
 for 51753 <at> debbugs.gnu.org; Fri, 19 Nov 2021 05:36:54 -0500
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta1.mxroute.com (ZoneMTA) with ESMTPSA id 17d37c51a74000177f.001
 for <51753 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Fri, 19 Nov 2021 10:36:44 +0000
X-Zone-Loop: 1fff201c1f01186f20230320652282322cf5beb6dd80
X-Originating-IP: [149.28.56.236]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me
 ; s=x;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:
 Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=gbQyTSHdOqntVd/EB8nNcy26pFx7UNxKBVEmqR+c7rc=; b=iiseloqpHYydprl1iNDA7ypyC9
 3Cb8gzoncfFvbGdmXItChyPU0wTj3lNxlSGI+5uZIGPo3TcI3nuVwqyfhMQMOTtiq+KVAsTfiVidp
 ozimx+S5SrlC5vDp35+iI4bwMBKu5LxKkZwFN+z2AEVLBNKtD+05eviOu0Zin8yi1AJIZzm6q2has
 jSIqOG8IYhAziyhR7agHRtfy4b2UwAFLZA33V4UhiW6Br+beFQ2ZoKyyuFuQ1Qv7XzjLa8aC+884s
 0Ingaz/eChsJs/dxTZ/1Lenwwu7IK7IF9vlCd5PubPkOClcEXDkUmka0RtUWHYP2s68A+rSu6BWfK
 9rcZQLBA==;
From: "J.P." <jp@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
 <87bl2re5eg.fsf@HIDDEN> <87lf1ve0m4.fsf@HIDDEN>
 <877ddf9sht.fsf@HIDDEN>
Date: Fri, 19 Nov 2021 02:36:40 -0800
In-Reply-To: <877ddf9sht.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Thu,
 11 Nov 2021 06:22:06 +0100")
Message-ID: <87czmwjutj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 FROM_HAS_DN=0, TO_DN_SOME=0, HAS_ATTACHMENT=0, FROM_EQ_ENVFROM=0,
 MIME_TRACE=0, MIME_GOOD=-0.1, RCPT_COUNT_FIVE=0, MID_RHS_MATCH_FROM=0,
 RCVD_COUNT_ZERO=0, NEURAL_SPAM=0]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 51753
Cc: Stefan Kangas <stefan@HIDDEN>, 51753 <at> debbugs.gnu.org, emacs-erc@HIDDEN,
 Amin Bandali <bandali@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

>> However, if people want something different to happen when
>> automatically reconnecting, we'd probably have to remember whether
>> `erc-server-reconnect-count' was ever positive before crossing the
>> logical connection threshold for the current session.
>>
>> This may come down to having `erc-connection-established' record the
>> count prior to resetting it (perhaps in a new, internal variable). And
>> then, during re-JOINs, `erc-setup-buffer' could weigh that recorded
>> value against some new option, like an `erc-display-reconnect' (or
>> whatever), and proceed accordingly.
>
> Sounds good to me.

I wasn't sure if that meant I was supposed to work on this. If not,
please disregard.

Otherwise, the tests are in #48598 [1]. As for the name of the option
itself, I basically punted by going with `erc-reconnect-buffer' to try
and stay close to `erc-join-buffer'. If that doesn't matter, perhaps
`erc-reconnect-display' would be a better fit since we already have an
`erc-query-display' (even though that one's not as closely related).
Anyone with an opinion, please advise. Thanks.


[1] Around line 4736:

    https://gitlab.com/jpneverwas/erc-tools/-/raw/master/bugs/48598/patches/wip/0013-Update-ERC-scenarios-with-session-centric-naming.patch

    Or browsable (JS):

    https://gitlab.com/jpneverwas/erc-v3/-/blob/1333bda3c0d11ff06b1b2acbb27864c90d5ba303/test/erc-scenarios.el#L1668


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Customize-displaying-of-ERC-buffers-on-reconnect.patch

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Thu, 18 Nov 2021 23:39:54 -0800
Subject: [PATCH 01/29] Customize displaying of ERC buffers on reconnect

* lisp/erc/erc-backend.el (erc--server-last-reconnect-count):
Add variable to record last reconnect tally.

* lisp/erc/erc.el (erc-reconnect-buffer): Add option to specify
channel-buffer display behavior on reconnect.
(erc-setup-buffer): Use option `erc-reconnect-buffer' if warranted.
(erc-connection-established): Record reconnect count in internal var
before resetting.
---
 lisp/erc/erc-backend.el |  3 +++
 lisp/erc/erc.el         | 24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 69f63dfbc4..4b39bd8a30 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -193,6 +193,9 @@ erc-server-connected
 (defvar-local erc-server-reconnect-count 0
   "Number of times we have failed to reconnect to the current server.")
 
+(defvar-local erc--server-last-reconnect-count 0
+  "Snapshot of reconnect count when connection established.")
+
 (defvar-local erc-server-quitting nil
   "Non-nil if the user requests a quit.")
 
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index c5a4fbe5a0..21ae25d920 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1521,6 +1521,22 @@ erc-join-buffer
                  (const :tag "Use current buffer" buffer)
                  (const :tag "Use current buffer" t)))
 
+(defcustom erc-reconnect-buffer nil
+  "How (and whether) to display a channel buffer upon reconnecting.
+
+This only affects automatic reconnections and is ignored when issuing a
+/reconnect command or reinvoking `erc-tls' with the same args (assuming
+success, of course).  See `erc-join-buffer' for a description of
+possible values."
+  :group 'erc-buffers
+  :type '(choice (const :tag "Use value of `erc-join-buffer'" nil)
+                 (const :tag "Split window and select" window)
+                 (const :tag "Split window, don't select" window-noselect)
+                 (const :tag "New frame" frame)
+                 (const :tag "Bury in new buffer" bury)
+                 (const :tag "Use current buffer" buffer)
+                 (const :tag "Use current buffer" t)))
+
 (defcustom erc-frame-alist nil
   "Alist of frame parameters for creating erc frames.
 A value of nil means to use `default-frame-alist'."
@@ -1950,7 +1966,10 @@ erc-update-modules
 
 (defun erc-setup-buffer (buffer)
   "Consults `erc-join-buffer' to find out how to display `BUFFER'."
-  (pcase erc-join-buffer
+  (pcase (if (zerop (erc-with-server-buffer
+                      erc--server-last-reconnect-count))
+             erc-join-buffer
+           (or erc-reconnect-buffer erc-join-buffer))
     ('window
      (if (active-minibuffer-window)
          (display-buffer buffer)
@@ -4722,7 +4741,8 @@ erc-connection-established
             (nick (car (erc-response.command-args parsed)))
             (buffer (process-buffer proc)))
         (setq erc-server-connected t)
-	(setq erc-server-reconnect-count 0)
+        (setq erc--server-last-reconnect-count erc-server-reconnect-count
+              erc-server-reconnect-count 0)
         (erc-update-mode-line)
         (erc-set-initial-user-mode nick buffer)
         (erc-server-setup-periodical-ping buffer)
-- 
2.31.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 11 Nov 2021 05:22:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 11 00:22:18 2021
Received: from localhost ([127.0.0.1]:39858 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ml2XS-0001oe-7Y
	for submit <at> debbugs.gnu.org; Thu, 11 Nov 2021 00:22:18 -0500
Received: from quimby.gnus.org ([95.216.78.240]:50056)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1ml2XQ-0001oP-2V
 for 51753 <at> debbugs.gnu.org; Thu, 11 Nov 2021 00:22:16 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=cOwTGtW4u0ElIp9PpPtmZDys2KHDiw+YmzJ9miwjVso=; b=gaY8XoWBwK3zP5bDl4IPIHlhJv
 zoOTj0cf7bG9NdPBu58H23dXEv3iibbtGRr/Bf1+FbJhJ5N34NDXwcte7TTsF0HZ0EHAvwgTZJSw1
 89XEles92ExZkhn4jd3yd9vDLOuS0JaZW4TMuz9CTlNVsgDINtdgDT0jqP8awx8LCVLc=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1ml2XH-0002b4-9u; Thu, 11 Nov 2021 06:22:09 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: "J.P." <jp@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
 <87bl2re5eg.fsf@HIDDEN> <87lf1ve0m4.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEXtzbHTsJnOsZu8
 kHCnb06oXTV6Uj3///+a7gE0AAAAAWJLR0QHFmGI6wAAAAd0SU1FB+ULCwUUOV3sCzcAAAGYSURB
 VDjLdZJhksIgDIXBEwC9gNATWOoJCv5fLV5gV+5/hH0JRVtaMzrTyUfy8gJCNCHPWo/xRzdZ/OwR
 OGltrNkCHEZWm35wbkzbCiWM1Obi3DU9WoCiwQ/hU6HQSnIrV1p1JS01strq3jgCIW3FSysadw8U
 g1aDK7TlVl21ABloUCvn+ljFl9DiRCtxLjYGtTBCHlao4sOvAIvDB45779sKbBetWoMLYOfXfYWs
 zju6BR5IqqKBqdwY7+24SghUXNP904qnMvhgg3e/AerEoK+AdlXug52Tj4dfSWC7qDgAooCBwZHz
 pQI25LKrszBm2dWulXT9cASMXgH5AbJzBNyiQWHlyWrOUsT462mJMKDoHQKUi7rNRYP3W0A/UNGt
 aCD1rqDzPuT8yxq4G0vviQXGKYQ8P8YqThzvAzH58fma6lSYQOO2e2hP0MhvYH3HfcZAccsQDyXS
 M+eUcnrFvzi/aCocC4EUwxRqsPMQ5rALegzpMPASv4DuO/DTuO0/efwvnVilZowzR/ogkOY6VeR5
 AnUK3v8DqpuS1kRgI7QAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMTEtMTFUMDU6MjA6NTcrMDA6
 MDBI+9nGAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTExLTExVDA1OjIwOjU3KzAwOjAwOaZhegAA
 AABJRU5ErkJggg==
X-Now-Playing: King Crimson's _The Complete 1969 Recordings (26): BBC
 Sessions_: "I Talk To The Wind"
Date: Thu, 11 Nov 2021 06:22:06 +0100
In-Reply-To: <87lf1ve0m4.fsf@HIDDEN> (J. P.'s message of "Wed, 10 Nov
 2021 21:13:07 -0800")
Message-ID: <877ddf9sht.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: "J.P." <jp@HIDDEN> writes: > The simplest approach might
 be to just change the default values of > `erc-join-buffer' and
 `erc-auto-query' to 'bury. Yup. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51753
Cc: Stefan Kangas <stefan@HIDDEN>, 51753 <at> debbugs.gnu.org, emacs-erc@HIDDEN,
 Amin Bandali <bandali@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

"J.P." <jp@HIDDEN> writes:

> The simplest approach might be to just change the default values of
> `erc-join-buffer' and `erc-auto-query' to 'bury.

Yup.

> However, if people want something different to happen when
> automatically reconnecting, we'd probably have to remember whether
> `erc-server-reconnect-count' was ever positive before crossing the
> logical connection threshold for the current session.
>
> This may come down to having `erc-connection-established' record the
> count prior to resetting it (perhaps in a new, internal variable). And
> then, during re-JOINs, `erc-setup-buffer' could weigh that recorded
> value against some new option, like an `erc-display-reconnect' (or
> whatever), and proceed accordingly.

Sounds good to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 11 Nov 2021 05:13:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 11 00:13:22 2021
Received: from localhost ([127.0.0.1]:39844 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ml2Oo-0007qr-0l
	for submit <at> debbugs.gnu.org; Thu, 11 Nov 2021 00:13:22 -0500
Received: from mail-108-mta18.mxroute.com ([136.175.108.18]:35185)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1ml2Ol-0007qb-OP
 for 51753 <at> debbugs.gnu.org; Thu, 11 Nov 2021 00:13:21 -0500
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta18.mxroute.com (ZoneMTA) with ESMTPSA id 17d0d6a014e0000b55.001
 for <51753 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Thu, 11 Nov 2021 05:13:10 +0000
X-Zone-Loop: 8b4f81d4381fc88eb4e26341024fbc56c52e322c6d21
X-Originating-IP: [149.28.56.236]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me
 ; s=x;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:
 Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=m4eeA+PjNL1dkuf3HF/+GeNjerXXjdDWA0fwNbKpyy8=; b=Cx/jkC/lIq1Fdn6mxk+D+y4rlu
 FhQjFXCK2cxRIkzVPz+hNvl5il4lZiQ1GD6HjS5gmLY3wruceq5AwWPnPu3pLCzLdy6AeevMOn4U9
 dULRRlXCQmw4GRJc9dpHVxVcxlGwKG49goPIaeY2buNjqqfeC94T2Fk+Avue2LOl6W19OJUisFwW8
 S2iCJJXxceR8dxRkk7KMM5TqcGJQE9JgVjA3IGh36M9jpZmLPjhdjW50B5i278QwgycpLzP1wcRPr
 ig97Fsv7mvByYOaFK07xEkfTq/iAR8L08XjQj2nf+tYRqEk4A2E1qV+QkkfMhYTPCeUrU1BCjBHVN
 5to61mgw==;
From: "J.P." <jp@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
 <87bl2re5eg.fsf@HIDDEN>
Date: Wed, 10 Nov 2021 21:13:07 -0800
In-Reply-To: <87bl2re5eg.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Thu,
 11 Nov 2021 04:29:43 +0100")
Message-ID: <87lf1ve0m4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 FROM_HAS_DN=0, TO_DN_SOME=0, MIME_GOOD=-0.1, FROM_EQ_ENVFROM=0,
 MIME_TRACE=0, RCVD_COUNT_ZERO=0, RCPT_COUNT_FIVE=0, MID_RHS_MATCH_FROM=0,
 NEURAL_SPAM=0]
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 51753
Cc: Stefan Kangas <stefan@HIDDEN>, 51753 <at> debbugs.gnu.org, emacs-erc@HIDDEN,
 Amin Bandali <bandali@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> erc does not pop up windows when somebody messages you (but just
> displays something in the mode line), and I think that's what erc should
> do for all buffers (by default; there could be a user option to allow it
> to pop up windows, of course).

The simplest approach might be to just change the default values of
`erc-join-buffer' and `erc-auto-query' to 'bury. However, if people want
something different to happen when automatically reconnecting, we'd
probably have to remember whether `erc-server-reconnect-count' was ever
positive before crossing the logical connection threshold for the
current session.

This may come down to having `erc-connection-established' record the
count prior to resetting it (perhaps in a new, internal variable). And
then, during re-JOINs, `erc-setup-buffer' could weigh that recorded
value against some new option, like an `erc-display-reconnect' (or
whatever), and proceed accordingly.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 11 Nov 2021 03:29:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 10 22:29:59 2021
Received: from localhost ([127.0.0.1]:39670 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ml0ml-00066Z-J9
	for submit <at> debbugs.gnu.org; Wed, 10 Nov 2021 22:29:59 -0500
Received: from quimby.gnus.org ([95.216.78.240]:48892)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1ml0mf-00066E-5z
 for 51753 <at> debbugs.gnu.org; Wed, 10 Nov 2021 22:29:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=427bOdj2PZx4omAfzf/aCiJfKqPfZady3mTLwCzgqz8=; b=Wcx97DTSn8A0U1rcc3+jQM5d+x
 TWhFnGF+OfZJ3Tyl0k7lJRrbkQQp6vkwMB7rwLsohH0N1zgUmnYG4hFCOHkwUVhDPUmaDvoi5n/6j
 L+pxsMFCWVQ88eIgclQBuQTtSIdXZTBI2ma8Ui+scLRRWvulUyoziDSWmBKBWsyd3gxk=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1ml0mW-0001rN-9S; Thu, 11 Nov 2021 04:29:46 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: "J.P." <jp@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVKLCVPLCORZE60
 ln7///8IGfnBAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+ULCwIsAv43SG0AAAF7SURBVDjLnZPbecMg
 DIUFXQBpAkss0MD+u+UIgQ1t+lISXz5+ju4m8sXMheJtPsfKGiBtYDxaA+CUBbu3EueMzBWcK+5S
 SEoA6larmTWr+GM1NQ1Qe++ttZe11jvAq9sAr3FcrSXDfayhsG9iQVwFLljhazmvl6cB8NWrtQ1g
 pUGG7iMIYfkDMH0AttVsAYEDMfsB2PeUkQCuEkenwsG8gkwgSC5ylgOQ+AaKCHMs1wHuJSgURdO8
 JSYakKetUGQPKVudTnbnEEgNSZiaecC5aDRCd4DzHi5a2ZzeILHXW7zDw1q5o0KdFNNVretSBMiY
 J0qXR9Rsz8PfvegiHu71APhIiCp5cWWWdzo33KIksyEBxEEMo6luCo9FvYO1rX6EjyLjuAfBuyni
 0Tux7atJtI0JIJ+K2IcGfnifRFpjpc/E7abQimfinn1vCK5TwZnHRyMo12nKR45H1Kct7wnT+g5O
 gn2Jz2CBmRDj5xlS+qUow9YqxgbudP+53hVgPjdMzr2BAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIx
 LTExLTExVDAyOjQ0OjAyKzAwOjAwzg6UZAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0xMS0xMVQw
 Mjo0NDowMiswMDowML9TLNgAAAAASUVORK5CYII=
X-Now-Playing: Fairport Convention's _Come All Ye (5)_: "Flowers of the Forest"
Date: Thu, 11 Nov 2021 04:29:43 +0100
In-Reply-To: <877ddfgz8q.fsf__46160.5365084083$1636600524$gmane$org@HIDDEN>
 (J. P.'s message of "Wed, 10 Nov 2021 19:14:29 -0800")
Message-ID: <87bl2re5eg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: "J.P." <jp@HIDDEN> writes: > Hi Stefan. Any idea if this
 is a recent phenomenon or more along the > lines of traditional behavior,
 perhaps involving `erc-join-buffer', for > example? erc has behaved this
 way as long as I can remember, and it's really annoying (especially when a
 server bounces and erc reconnects, popping up windows everywhere while I'm
 trying to get some work done) [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51753
Cc: Amin Bandali <bandali@HIDDEN>, 51753 <at> debbugs.gnu.org, emacs-erc@HIDDEN,
 Stefan Kangas <stefan@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

"J.P." <jp@HIDDEN> writes:

> Hi Stefan. Any idea if this is a recent phenomenon or more along the
> lines of traditional behavior, perhaps involving `erc-join-buffer', for
> example?

erc has behaved this way as long as I can remember, and it's really
annoying (especially when a server bounces and erc reconnects, popping
up windows everywhere while I'm trying to get some work done).

So I'm all for making erc stopping doing this.

erc does not pop up windows when somebody messages you (but just
displays something in the mode line), and I think that's what erc should
do for all buffers (by default; there could be a user option to allow it
to pop up windows, of course).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.

Message received at 51753 <at> debbugs.gnu.org:


Received: (at 51753) by debbugs.gnu.org; 11 Nov 2021 03:14:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 10 22:14:45 2021
Received: from localhost ([127.0.0.1]:39652 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ml0Y1-0005hm-I8
	for submit <at> debbugs.gnu.org; Wed, 10 Nov 2021 22:14:45 -0500
Received: from mail-108-mta144.mxroute.com ([136.175.108.144]:44769)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1ml0Xw-0005hG-LT
 for 51753 <at> debbugs.gnu.org; Wed, 10 Nov 2021 22:14:44 -0500
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta144.mxroute.com (ZoneMTA) with ESMTPSA id
 17d0cfd61ea0000b55.001 for <51753 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Thu, 11 Nov 2021 03:14:32 +0000
X-Zone-Loop: c66a96115934e4e6ffe5aba249a813e9ba878a1335d7
X-Originating-IP: [149.28.56.236]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me
 ; s=x;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:
 Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=TOvhXXd7VzoKyrABQU2Px9umdwVNueP8XUVCyPr839E=; b=mTeXPuuBJfLKmzGlGZfa4Joia0
 f4D45E+Nx024xQ++udhJE7tg0a4dW8GGG6p6PcrBepRreNdwikBkRZ5RpvmdcAAhbXCpyR09nJ8L3
 PDKUxQM1DsbqXevGp4t3qXzxvrGUXqh74z2mrPQl5xgj+99v2M1Xv8lEQxAmRslzu7eejhkqH4FmX
 Zp4Vyqm3iyOymZxij3gHef6M2b4dScx7++f3BD3dyaCjKVhJOhDagbMfYHyBdcGoyR3pXFwU3YLaX
 /0vOgYkltgYgaKmP64++IkhF7iZUNZYUZL6BFlZlwFeByLDuiJsj1xjCMXd4wSlaYSq4DIVP3oON9
 4LtA34/w==;
From: "J.P." <jp@HIDDEN>
To: Stefan Kangas <stefan@HIDDEN>
Subject: Re: bug#51753: ERC switches to channel buffer on reconnect
References: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
Date: Wed, 10 Nov 2021 19:14:29 -0800
In-Reply-To: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
 (Stefan Kangas's message of "Wed, 10 Nov 2021 07:09:24 -0800")
Message-ID: <877ddfgz8q.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 FROM_HAS_DN=0, RCPT_COUNT_THREE=0, TO_DN_SOME=0, MIME_GOOD=-0.1,
 FROM_EQ_ENVFROM=0, MIME_TRACE=0, RCVD_COUNT_ZERO=0, NEURAL_SPAM=0,
 MID_RHS_MATCH_FROM=0]
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 51753
Cc: 51753 <at> debbugs.gnu.org, emacs-erc@HIDDEN, Amin Bandali <bandali@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Kangas <stefan@HIDDEN> writes:

> Severity: important
>
> When ERC reconnects, it switches buffer to the channel buffers.  This is
> *very* dangerous.

Hi Stefan. Any idea if this is a recent phenomenon or more along the
lines of traditional behavior, perhaps involving `erc-join-buffer', for
example? I ask this mostly out of self interest re

  commit 17e7cab1507a185d2c493548494abcad6a55d159
  Normalize usage of variable erc-server-reconnecting

and its followup

  commit ec9ddd6eaf3f1b118d3ce95a69e1d046166362d3
  Deprecate instead of redefine erc-server-reconnecting

(both recent and both mine).

Regardless, there's a solid chance what you're experiencing is
`erc-setup-buffer' related, which comes into play whenever `erc-open'
runs. For reconnects, this happens both during `erc-server-reconnect'
and again whenever `erc-server-JOIN' runs (for channels you join).

It'd also be nice to know how these JOIN replies are being triggered
(server-initiated, erc-join.el, manual /join, etc.). With the join
module, they'd likely be the result of a JOIN command (request) sent by
`erc-autojoin-channels', which runs on 376/422. This matters when trying
to pinpoint problematic interplay with the reconnect logic, if such a
thing exists.

> Consider the situation when the user is about to paste a password and
> hit enter with a quick "C-y RET", when all of a sudden the ERC buffer
> pops up a fraction of a second before you hit those keys.  Now your
> password is on IRC.
>
> At the very least, this behavior should be disabled by default, and
> preferably also come with a big warning sign for anyone that intends to
> enable it.

I don't think many would argue that this behavior isn't at least
annoying. While specific scenarios (like accidentally broadcasting creds
to a channel) are important to confront, we should also remember to take
in the long view whenever possible (IMO). And in doing so, I think we'll
find that the many downsides of interfacing with a services bot have
over time compelled the IRC world to embrace SASL (part of the IRCv3
initiative) as the preferred means of authentication. Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Nov 2021 15:09:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 10 10:09:31 2021
Received: from localhost ([127.0.0.1]:39038 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mkpEA-00054D-Su
	for submit <at> debbugs.gnu.org; Wed, 10 Nov 2021 10:09:31 -0500
Received: from lists.gnu.org ([209.51.188.17]:52698)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1mkpE7-00053x-T2
 for submit <at> debbugs.gnu.org; Wed, 10 Nov 2021 10:09:28 -0500
Received: from eggs.gnu.org ([209.51.188.92]:32794)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <stefankangas@HIDDEN>)
 id 1mkpE7-0003uB-Pz
 for bug-gnu-emacs@HIDDEN; Wed, 10 Nov 2021 10:09:27 -0500
Received: from mail-pg1-f172.google.com ([209.85.215.172]:34405)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <stefankangas@HIDDEN>)
 id 1mkpE6-0001j4-2M
 for bug-gnu-emacs@HIDDEN; Wed, 10 Nov 2021 10:09:27 -0500
Received: by mail-pg1-f172.google.com with SMTP id 200so2543876pga.1
 for <bug-gnu-emacs@HIDDEN>; Wed, 10 Nov 2021 07:09:25 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:mime-version:date:message-id:subject:to;
 bh=cGEcjGmE7QqGUbDDd+GawYF7QtE3K70OT2frKf+17Ic=;
 b=GiteP8U+EFBp7QJgaP1euxBy8g6uQG8Sruk6/0HWe5gxGl9+kAzGQ41VMPG1G4TzpZ
 qMV1tkurqc98B/Of6EdTc+GC38304zBqkguyHCM3+OjEaKKD7e8ofdaD0z2a51sAyeKm
 fZd06uyxEQ1ogtek26LKKWgDfqPhvkpuJEIA/+8P2NF6kgFCGGI8Pd01jibmeINVSLVs
 HvjYaBxMgf9qTwzjGlw7R1O3WeZaOLdZXHV94htt+gpTbEuRLSsDwla4p3/VtMUq0z2v
 Yousmv62OQmlNTZoEDwyCCs2hmc8WOXxFYJXj9Z7p+lhV6LVGZnHxjzYw2d/4CSFG2WW
 Yzyw==
X-Gm-Message-State: AOAM532fyds/6RONa+ENPWxmA363HjGNns9LDwUbSnEFF+qoS0YpuzlA
 RxXO7gwSHa9IyPHLVhOxPKI8/OuyCJ2JG8P8wvKa4mU1
X-Google-Smtp-Source: ABdhPJxXnmdVb71BYXALTN4aICSSmQlpP4Z7BhANJT77E0kZ9l012FEYSrsTRWWw/e9PErs5CtBrBC6/OEycZZU8VFM=
X-Received: by 2002:a05:6a00:244d:b0:44d:c279:5155 with SMTP id
 d13-20020a056a00244d00b0044dc2795155mr3558pfj.0.1636556964724; Wed, 10 Nov
 2021 07:09:24 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Wed, 10 Nov 2021 07:09:24 -0800
From: Stefan Kangas <stefan@HIDDEN>
X-Debbugs-CC: Amin Bandali <bandali@HIDDEN>
MIME-Version: 1.0
Date: Wed, 10 Nov 2021 07:09:24 -0800
Message-ID: <CADwFkmkUm012pjgmoaUgnQ2AT+f0SKVvo0UA5XjUYrU=xVTKeQ@HIDDEN>
Subject: ERC switches to channel buffer on reconnect
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=209.85.215.172;
 envelope-from=stefankangas@HIDDEN; helo=mail-pg1-f172.google.com
X-Spam_score_int: -13
X-Spam_score: -1.4
X-Spam_bar: -
X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9,
 FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001,
 HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

Severity: important

When ERC reconnects, it switches buffer to the channel buffers.  This is
*very* dangerous.

Consider the situation when the user is about to paste a password and
hit enter with a quick "C-y RET", when all of a sudden the ERC buffer
pops up a fraction of a second before you hit those keys.  Now your
password is on IRC.

At the very least, this behavior should be disabled by default, and
preferably also come with a big warning sign for anyone that intends to
enable it.




Acknowledgement sent to Stefan Kangas <stefan@HIDDEN>:
New bug report received and forwarded. Copy sent to bandali@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bandali@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#51753; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 19 Nov 2021 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.