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.erc.general,gmane.emacs.bugs Subject: Re: 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 20:23:17 +0100 Message-ID: <87r0i9jhp6.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> <87wms1k6xg.fsf@dataswamp.org> <87plxt2yjx.fsf@neverwas.me> <87ttn5job9.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="40449"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: bug-gnu-emacs@gnu.org To: emacs-erc@gnu.org Cancel-Lock: sha1:FTGrZRqFc0k2W3C+/SjjTJW6lhA= Original-X-From: emacs-erc-bounces+sf-erc-help=m.gmane-mx.org@gnu.org Mon Jan 22 20:23:48 2024 Return-path: Envelope-to: sf-erc-help@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 1rRztb-000ACZ-HC for sf-erc-help@m.gmane-mx.org; Mon, 22 Jan 2024 20:23:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRztS-0005cb-OJ; Mon, 22 Jan 2024 14:23:39 -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 1rRztQ-0005cM-R3 for emacs-erc@gnu.org; Mon, 22 Jan 2024 14:23:36 -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 1rRztO-0005IP-LR for emacs-erc@gnu.org; Mon, 22 Jan 2024 14:23:36 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rRztL-0009lB-Gg for emacs-erc@gnu.org; Mon, 22 Jan 2024 20:23:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-erc@gnu.org Original-Followup-To: gmane.emacs.erc.general,gmane.emacs.bugs Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=sf-erc-help@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: emacs-erc@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General discussion about ERC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-erc-bounces+sf-erc-help=m.gmane-mx.org@gnu.org Original-Sender: emacs-erc-bounces+sf-erc-help=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.erc.general:2388 gmane.emacs.bugs:278713 Archived-At: >>>> 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? >> >> Leading. See the test for `erc-extract-command-from-line' >> to understand the behavior of `do-not-parse-args', which >> determines LINE. Actually, if we're doing away with >> `commandp', there should be no reason for "at most one," >> only "exactly one" (IIRC). > > So if and only if the initial char is a whitespace, it, and > only it, should be dropped. E.g. " line string " should be > transformed into " line string ". (defun erc-drop-leading-whitespace (str) (if (string-match " \\(.*\\)" str) (match-string 1 str) str) ) >>>> 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)))) If we can drop `erc--target' in the latest Emacs source as you say that means there is only this left (and (erc-server-process-alive) (erc--current-buffer-joined-p)) >>>> 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)))) If we again can drop `erc--target' and want `erc-server-connected' to be returned upon success we can do (and (erc--current-buffer-joined-p) erc-server-connected) If we unify those two tests it will be (defun erc-connected-and-joined-p () (and (erc-server-process-alive) (erc--current-buffer-joined-p) erc-server-connected)) -- underground experts united https://dataswamp.org/~incal