From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt Date: Mon, 05 Feb 2024 19:44:36 -0800 Message-ID: <87h6im9ryz.fsf__23711.5776095138$1707191176$gmane$org@neverwas.me> References: <87v87yvnly.fsf@dataswamp.org> <834jfikb4d.fsf@gnu.org> <87mstavias.fsf@dataswamp.org> <87wmseoskl.fsf@dataswamp.org> <87plxyowpg.fsf__13716.8874776521$1705633220$gmane$org@neverwas.me> <87il3ki2tg.fsf@dataswamp.org> <87il3jh8mu.fsf__35629.5012797759$1706056526$gmane$org@neverwas.me> <87il3jh64c.fsf@dataswamp.org> <87jznzf0dz.fsf@dataswamp.org> <87h6j3eyir.fsf@dataswamp.org> <87a5of68c7.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27258"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-erc@gnu.org, 68401@debbugs.gnu.org To: Emanuel Berg Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 06 04:46:08 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rXCPP-0006sE-OG for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Feb 2024 04:46:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXCP9-0000QP-DL; Mon, 05 Feb 2024 22:45:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXCP7-0000PE-W2 for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 22:45:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXCP7-0003nU-Nx for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 22:45:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rXCPJ-0005NB-Ux for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 22:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Feb 2024 03:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68401 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68401-submit@debbugs.gnu.org id=B68401.170719110620576 (code B ref 68401); Tue, 06 Feb 2024 03:46:01 +0000 Original-Received: (at 68401) by debbugs.gnu.org; 6 Feb 2024 03:45:06 +0000 Original-Received: from localhost ([127.0.0.1]:53024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXCOP-0005Ln-UB for submit@debbugs.gnu.org; Mon, 05 Feb 2024 22:45:06 -0500 Original-Received: from mail-108-mta75.mxroute.com ([136.175.108.75]:33291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXCON-0005Lf-EL for 68401@debbugs.gnu.org; Mon, 05 Feb 2024 22:45:04 -0500 Original-Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta75.mxroute.com (ZoneMTA) with ESMTPSA id 18d7c84a91c0000466.002 for <68401@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 06 Feb 2024 03:44:45 +0000 X-Zone-Loop: 179deb34df1119f6427808f27e5fe11a668cf782a5a8 X-Originating-IP: [136.175.111.2] 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:Date:References:In-Reply-To: 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=AK8SwBVLyuQdDcJkprwtyG6Atit/VS4TPtKEqySIBKU=; b=Ic2/WYbuDC1enl0rPyHrc6knXE J7UYhEm+sPe+oQ7BhFqpiaEOhkis4iID3CFBHvbYAcFe4szdWJ0F7LmMzf/ymVdC+1F1LPsA8quky 8S4yJz6Pg3tsDokRosVsyOEZ6RYlZtBik2iDJYKSGhYdfLjKokk3iYYROWFohpEy/wGnYkOHQM/fn H/IWbgtcqjZ4NNBOsZarQqnypNPC5qYCIt6add8VmrNNLQ8Kn7JMHugChfoIuOZd4/A+hSLCW62wX 5+UgYyzeGN02Pk8arw1xEXnmhV38l29DOP89u2uLWTLjet0XoacQH1joVlThJmSD9L8XmC9kQGUgw aByMP9Dw==; In-Reply-To: <87a5of68c7.fsf@dataswamp.org> (Emanuel Berg's message of "Mon, 05 Feb 2024 01:52:24 +0100") X-Authenticated-Id: masked@neverwas.me X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279477 Archived-At: Emanuel Berg writes: > Tags: patch > > Okay, thanks to a lot of help at #erc and #git I think this is > one full patch for a single commit reflecting the desired > change to the source. > > Let me know if it is okay. > >> From b006669b078a4cf4aec2ea19de1a954d494ec19f Mon Sep 17 00:00:00 2001 > From: Emanuel Berg > Date: Tue, 23 Jan 2024 14:21:49 +0100 > Subject: [PATCH 211/211] Make erc-cmd-AMSG session local; add /GMSG, /AME and > /GME > > * lisp/erc/erc.el (erc-cmd-AMSG): Make it consistent with the doc > string by only affecting the current connection. > (erc-cmd-GMSG, erc-cmd-AME, erc-cmd-GME): new IRC slash commands > (Bug#68401) Looks like you've combined ("fixed up") your patch with the provided test and data files [1]. That's fine, but its changes should be listed in the commit message as well: * test/lisp/erc/erc-scenarios-misc-commands.el (erc-scenarios-misc-commands--AMSG-GMSG-AME-GME): New test. * test/lisp/erc/resources/commands/amsg-barnet.eld: New file. * test/lisp/erc/resources/commands/amsg-foonet.eld: New file. In the future, maybe look into "squashing" to preserve messages. Also, consider adding an entry to etc/ERC-NEWS if you think people can benefit from these commands. [1] https://lists.gnu.org/archive/html/emacs-erc/2024-01/msg00038.html > --- > lisp/erc/erc.el | 38 +++++++-- > test/lisp/erc/erc-scenarios-misc-commands.el | 84 +++++++++++++++++++ > .../erc/resources/commands/amsg-barnet.eld | 52 ++++++++++++ > .../erc/resources/commands/amsg-foonet.eld | 52 ++++++++++++ > 4 files changed, 220 insertions(+), 6 deletions(-) > create mode 100644 test/lisp/erc/resources/commands/amsg-barnet.eld > create mode 100644 test/lisp/erc/resources/commands/amsg-foonet.eld > > diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el > index 08dfa4b8f1b..15734b1010d 100644 > --- a/lisp/erc/erc.el > +++ b/lisp/erc/erc.el > @@ -4047,16 +4047,42 @@ erc--split-string-shell-cmd > ;; Input commands handlers > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > -(defun erc-cmd-AMSG (line) > - "Send LINE to all channels of the current server that you are on." > - (interactive "sSend to all channels you're on: ") > - (setq line (erc-trim-string line)) > +(defun erc--connected-and-joined-p () > + (and (erc--current-buffer-joined-p) > + erc-server-connected)) > + > +(defun erc-cmd-GMSG (line) > + "Send LINE to all channels on all networks you are on." > + (setq line (string-remove-prefix " " line)) > (erc-with-all-buffers-of-server nil > - (lambda () > - (erc-channel-p (erc-default-target))) > + #'erc--connected-and-joined-p > + (erc-send-message line))) > +(put 'erc-cmd-GMSG 'do-not-parse-args t) > + > +(defun erc-cmd-AMSG (line) > + "Send LINE to all channels of the current network. > +Interactively, prompt for the line of text to send." > + (interactive "sSend to all channels on this network: ") > + (setq line (string-remove-prefix " " line)) > + (erc-with-all-buffers-of-server erc-server-process > + #'erc--connected-and-joined-p > (erc-send-message line))) > (put 'erc-cmd-AMSG 'do-not-parse-args t) > > +(defun erc-cmd-GME (line) > + "Send LINE as an action to all channels on all networks you are on." > + (erc-with-all-buffers-of-server nil > + (erc--connected-and-joined-p) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Seems one of these things is not like the others. Guessing that's unintentional. What's not great is that the test still passes in spite of this. It seems /GME is the only variant not covered, which I guess is my fault. Perhaps you should improve the test so it fails with the current patch applied and passes once it's fixed. > + (erc-cmd-ME line))) > +(put 'erc-cmd-GME 'do-not-parse-args t) > + > +(defun erc-cmd-AME (line) > + "Send LINE as an action to all channels on the current network." > + (erc-with-all-buffers-of-server erc-server-process > + #'erc--connected-and-joined-p > + (erc-cmd-ME line))) > +(put 'erc-cmd-AME 'do-not-parse-args t) > + > (defun erc-cmd-SAY (line) > "Send LINE to the current query or channel as a message, not a command. > > diff --git a/test/lisp/erc/erc-scenarios-misc-commands.el b/test/lisp/erc/erc-scenarios-misc-commands.el > index d6ed53b5358..c6bb610b9df 100644 > --- a/test/lisp/erc/erc-scenarios-misc-commands.el > +++ b/test/lisp/erc/erc-scenarios-misc-commands.el > @@ -123,4 +123,88 @@ erc-scenarios-misc-commands--VHOST > (should (string= (erc-server-user-host (erc-get-server-user "tester")) > "some.host.test.cc")))))) > > +;; This tests four related slash commands, /AMSG, /GMSG, /AME, /GME, > +;; the latter three introduced by bug#68401. It mainly asserts > +;; correct routing behavior, especially not sending or inserting > +;; messages in buffers belonging to disconnected sessions. Left > +;; unaddressed are interactions with the `command-indicator' module > +;; (`erc-noncommands-list') and whatever future `echo-message' > +;; implementation manifests out of bug#49860. > +(ert-deftest erc-scenarios-misc-commands--AMSG-GMSG-AME-GME () > + (erc-scenarios-common-with-cleanup > + ((erc-scenarios-common-dialog "commands") > + (erc-server-flood-penalty 0.1) > + (dumb-server-foonet (erc-d-run "localhost" t "srv-foonet" 'amsg-foonet)) > + (dumb-server-barnet (erc-d-run "localhost" t "srv-barnet" 'amsg-barnet)) > + (expect (erc-d-t-make-expecter))) [...] Is this FIXME comment [2] regarding your paperwork accurate? [2] https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/elpa-packages?id=e5075ab1#n805