From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.bugs,gmane.emacs.erc.general 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, 22 Jan 2024 11:18:19 +0100 Message-ID: <87wms1k6xg.fsf@dataswamp.org> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26312"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-erc@gnu.org To: 68401@debbugs.gnu.org Cancel-Lock: sha1:50eZ73/lbB+Vw1CDpJWXBLVjL6I= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 22 11:19:14 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 1rRrOb-0006cZ-RV for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Jan 2024 11:19:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRrOO-0007SM-Gd; Mon, 22 Jan 2024 05:19:00 -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 1rRrOM-0007Ru-Ic for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2024 05:18:58 -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 1rRrOM-0001RH-9Z for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2024 05:18:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rRrOQ-0000SY-7J for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2024 05:19:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87v87yvnly.fsf@dataswamp.org> Resent-From: Emanuel Berg Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jan 2024 10:19:02 +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 X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17059187231741 (code B ref -1); Mon, 22 Jan 2024 10:19:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jan 2024 10:18:43 +0000 Original-Received: from localhost ([127.0.0.1]:39920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRrO7-0000S1-0X for submit@debbugs.gnu.org; Mon, 22 Jan 2024 05:18:43 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:59754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRrO5-0000Ro-GV for submit@debbugs.gnu.org; Mon, 22 Jan 2024 05:18:42 -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 1rRrNw-0007Mq-7m for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2024 05:18:32 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRrNu-0001J3-Bt for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2024 05:18:31 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rRrNr-0005Uf-E3 for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2024 11:18:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: bug-gnu-emacs@gnu.org Original-Followup-To: gmane.emacs.bugs,gmane.emacs.erc.general Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:278698 gmane.emacs.erc.general:2382 Archived-At: J.P. wrote: > Make erc-cmd-AMSG session-local, add /GMSG /AME /GME > > * lisp/erc/erc.el (erc-cmd-AMSG): Make good on behavior described in > the doc string by limiting damage to the current connection. > (erc-cmd-GMSG, erc-cmd-GME, erc-cmd-AME): New functions, all IRC > "slash commands". (Bug#68401) Okay, I'll use that instead. But let's agree on the source first. > I question the wisdom of having new slash commands serve > double duty as interactive Emacs commands (at least those > handling chat input). This reservation has nothing to do > with M-x erc-cmd-FOO being less faithful (or whatever) > to the traditional IRC experience than /FOO . Rather, > it stems from a need to prioritize consistent feedback and > promote maintainability by only having a single path for > chat input to reach the server (except under special > circumstances). I made them interactive as `erc-cmd-AMSG' is interactive, but let's remove it from the other three then. [ As a side note, Emacs has a problem with different interfaces doing too much and influencing the behavior of their functions. Interfaces should just be different ways of setting the formal parameters, after that the exact same thing should happen for the same data. ] >> (setq line (erc-trim-string line)) > > It might be nice to remove at most one space, for cases > where a user wants to send preformatted text. OTOH, normal > /MSG doesn't do this, so perhaps we shouldn't here either. Again, this is in the original `erc-cmd-AMSG'. I have no opinion, so you can decide it. "At most one space", what space should that be? Leading or trailing? This is nothing `erc-trim-string' can do BTW. But we can of course still remove whatever spaces we like. >> (erc-with-all-buffers-of-server nil >> - (lambda () >> - (erc-channel-p (erc-default-target))) >> + (lambda () (erc-channel-p (erc-default-target))) >> + (erc-send-message line))) > > Without first checking for connectivity, we run into another > situation in which messages may be inserted but not sent, > similar to the bit about commands being potentially > "misleading," above. The most obvious way to solve this is > to check for "physical" connectivity with something like: > > (erc-with-all-buffers-of-server nil #'erc-server-process-alive > (when (and erc--target (erc--current-buffer-joined-p)) > (erc-send-message line)))) > > Alternatively, you can check for "logical" connectivity, > which is probably more in keeping with traditional design > principles: > > (erc-with-all-buffers-of-server nil nil > (when (and erc-server-connected erc--target (erc--current-buffer-joined-p)) > (erc-send-message line)))) > > One minor downside of this second method is that IRC > adjacent protocols and aberrant proxy servers that happen to > skip 376/422 and also provide some (possibly &local) > "control channel" won't be detected. (BTW, you won't be > needing the `erc--target' in either example if you rebase > atop the latest master.) Okay, but instead of having these checks embedded and hopefully correctly repeated four times, shouldn't we have two functions, say "erc-connected-physical-p" and "erc-connected-logical-p" and call either of those (or both) from the functions? >> +(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 (erc-trim-string line)) >> + (erc-with-all-buffers-of-server erc-server-process >> + (lambda () (erc-channel-p (erc-default-target))) > > ^ Indentation. This macro is declared "indent 2" Okay, fixed that. > rebase How do you do that, just 'git pull'? -- underground experts united https://dataswamp.org/~incal