unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "J.P." <jp@neverwas.me>
To: Stefan Kangas <stefan@marxist.se>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	emacs-erc@gnu.org, Amin Bandali <bandali@gnu.org>,
	51753@debbugs.gnu.org
Subject: bug#51753: ERC switches to channel buffer on reconnect
Date: Thu, 02 Dec 2021 21:31:24 -0800	[thread overview]
Message-ID: <87zgpicl03.fsf__3305.82036856271$1638509543$gmane$org@neverwas.me> (raw)
In-Reply-To: <CADwFkmmqNW-CyrxUU1-TiqEvUhwYe=zzVOO_q2iEAHmQYorudw@mail.gmail.com> (Stefan Kangas's message of "Thu, 2 Dec 2021 11:43:03 -0800")

These are just some related notes, mostly intended for posterity. Feel
free to ignore. Thanks.


I think at some point it'll be worth exploring the best time and place
for forgetting the current connection's origins with respect to whether
it sprang from an automated reconnect. The latest iteration of this
patch does this via `erc-cmd-JOIN'. But that's a bit of a compromise and
one that will hopefully be replaced with something smarter down the
road.

Ideally, resetting would occur immediately after all reconnect-related
JOINs have happened. As might be obvious, doing this ultimately involves
tracking more state, including but not limited to "JOINedness". In the
case of server-initiated joins, that implies doing so across sessions
[1]. For client-initiated ones, it means tracking request context. While
IRCv3 features like "label responses" were designed specifically to
assist with the latter [2], that doesn't mean we can't do so manually,
given sufficient motivation.

Indeed, when armed with a reliable way to uniquely identify a "logical"
channel subscription across connections [3], it becomes possible to do
this manually by stashing callbacks or continuation instructions. (Some
people may know this as the "command" pattern.) The real question then
becomes whether it's worth the added complexity.

BTW, if anyone has alternative ideas for a temporary solution (other
than `erc-cmd-JOIN'), please speak up. I originally thought about doing
the resetting in a subset of /CMDs originating from typed user input,
but that seemed more prone to inconveniencing users who may have long
incorporated the underlying functions into custom code (firing on
connection) [4]. One way around this would be to only do the resetting
when a user actually enters something at the prompt, but unless you want
that to happen on *any* /CMD, we'd need special handling [5] for the
handful desired (possibly chosen via configurable option).


~~~

[1] A related issue is the means of detecting whether we're joined to a
    channel. With traditional pub/sub services (IRC channels are really
    just "topics"), it's in the client's interest to stay abreast of its
    subscription status. And the service API also typically exposes a
    way for a client to query for this out of band. ERC *does* track a
    channel's JOIN'd state, but it's a bit hampered by legacy features
    related to how targets are currently handled (via
    `erc-default-recipients' and functions that access/mutate it).

[2] https://ircv3.net/irc/#labeled-responses

[3] "Logical" meaning including serially, i.e., spanning disconnects.

[4] In ERC's case, these commands aren't designated as being primarily
    intended for /interactive use (`erc-cmd-JOIN`, being one such
    function, naturally suffers from the same flaw).

[5] Hopefully something more flexible than adding/removing properties,
    like `process-not-needed', which creates problems when trying to
    override /CMDs.





  parent reply	other threads:[~2021-12-03  5:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 15:09 bug#51753: ERC switches to channel buffer on reconnect Stefan Kangas
2021-11-11  3:14 ` J.P.
2021-11-11  3:29   ` Lars Ingebrigtsen
     [not found]   ` <87bl2re5eg.fsf@gnus.org>
2021-11-11  5:13     ` J.P.
     [not found]     ` <87lf1ve0m4.fsf@neverwas.me>
2021-11-11  5:22       ` Lars Ingebrigtsen
     [not found]       ` <877ddf9sht.fsf@gnus.org>
2021-11-19 10:36         ` J.P.
     [not found]         ` <87czmwjutj.fsf@neverwas.me>
2021-11-19 11:45           ` Stefan Kangas
     [not found]           ` <CADwFkm=_RaiRkwte+JPRvuM4fntevprWr-qjaBaG6D+Gud_UoQ@mail.gmail.com>
2021-11-19 13:13             ` J.P.
2021-11-20  7:21             ` J.P.
     [not found]             ` <87ilwnnvfs.fsf@neverwas.me>
2021-11-20  9:09               ` Stefan Kangas
     [not found]               ` <CADwFkmnL1ugFn4VYi--5ygJnYu4RmES6VGjku6j92fy+8B6yeA@mail.gmail.com>
2021-11-21 22:54                 ` J.P.
     [not found]                 ` <87sfvp5dd5.fsf@neverwas.me>
2021-12-02 19:43                   ` Stefan Kangas
     [not found]                   ` <CADwFkmmqNW-CyrxUU1-TiqEvUhwYe=zzVOO_q2iEAHmQYorudw@mail.gmail.com>
2021-12-03  5:31                     ` J.P. [this message]
2023-04-14 14:11 ` bug#51753: bug#55540: 29.0.50; ERC launches autojoin-channels in current frame instead of original frame J.P.
  -- strict thread matches above, loose matches on Subject: below --
2022-05-20 13:06 Pankaj Jangid
2022-05-23  1:56 ` bug#51753: ERC switches to channel buffer on reconnect J.P.
     [not found] ` <87a6b92ers.fsf@neverwas.me>
2022-05-23  2:50   ` Pankaj Jangid
2022-05-23  7:48     ` J.P.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='87zgpicl03.fsf__3305.82036856271$1638509543$gmane$org@neverwas.me' \
    --to=jp@neverwas.me \
    --cc=51753@debbugs.gnu.org \
    --cc=bandali@gnu.org \
    --cc=emacs-erc@gnu.org \
    --cc=larsi@gnus.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).