unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-erc@gnu.org
Cc: bug-gnu-emacs@gnu.org
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 18:00:26 +0100	[thread overview]
Message-ID: <87ttn5job9.fsf@dataswamp.org> (raw)
In-Reply-To: 87plxt2yjx.fsf@neverwas.me

J.P. wrote:

>>> 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  ".

Also, at this point, only "erc-cmd-AMSG" and "erc-cmd-GMSG"
has the trim line, and the reason is it is present in the
original `erc-cmd-AMSG'.

Should we also have the new one in `erc-cmd-AME' and
`erc-cmd-GME'?

>>>>    (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?
>
> If you want to factor out a common helper function, fine by
> me. AFAICT such a thing would need to include
> `erc-with-all-buffers-of-server' to be effective unless the
> predicates you've named alone result in meaningful code
> reuse. (Not sure how an `erc-connected-physical-p' would be
> any different than the existing 'erc-server-process-alive',
> though I suppose an `erc-connected-logical-p' could be
> useful if it just returns `erc-server-connected'.)

Okay, I'm on it, stay tuned.

> If you applied the unit-test patch atop your commit, you
> won't be able to "git commit --amend" your previous changes.
> See the "-i, --interactive" option for git-rebase(1), then
> maybe rearrange things so your patch comes *after* the test.
> You can always "git rebase --abort" if you mess up.
> And there's always #git on Libera.

No, I didn't do the unit test, let's agree on the source
first, after that it will be interesting to try it.

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2024-01-22 17:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87v87yvnly.fsf@dataswamp.org>
2024-01-12 12:08 ` bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt Eli Zaretskii
2024-01-12 14:12   ` Emanuel Berg
2024-01-12 14:39     ` Eli Zaretskii
2024-01-13  2:09       ` Emanuel Berg
2024-01-13  2:31         ` Emanuel Berg
2024-01-13  2:45           ` Emanuel Berg
2024-01-13  7:23           ` Eli Zaretskii
2024-01-14  9:11             ` Emanuel Berg
     [not found] ` <834jfikb4d.fsf@gnu.org>
2024-01-12 12:36   ` Emanuel Berg
     [not found]   ` <87ply6vidl.fsf@dataswamp.org>
2024-01-12 14:03     ` Eli Zaretskii
2024-01-12 14:30       ` Emanuel Berg
     [not found]   ` <87mstavias.fsf@dataswamp.org>
     [not found]     ` <87wmseoskl.fsf@dataswamp.org>
2024-01-19  2:58       ` J.P.
2024-01-22 10:18         ` Emanuel Berg
2024-01-22 15:11           ` J.P.
2024-01-22 17:00             ` Emanuel Berg [this message]
2024-01-22 19:23               ` Emanuel Berg
     [not found]                 ` <87y1ch851b.fsf@igel.home>
2024-01-22 21:05                   ` Emanuel Berg
2024-01-22 21:27                 ` J.P.
2024-01-23  4:25                   ` Emanuel Berg
2024-01-23  4:32                     ` Emanuel Berg
2024-01-23  6:20                       ` Emanuel Berg
2024-01-23 13:31                         ` Emanuel Berg
2024-01-24  0:36                           ` J.P.
2024-01-24  0:56                             ` Emanuel Berg
2024-01-24  1:38                               ` J.P.
2024-01-24  2:01                                 ` Emanuel Berg
2024-01-23 13:42         ` Emanuel Berg
2024-01-24  0:34           ` J.P.
2024-01-24  1:28             ` Emanuel Berg
2024-01-24  1:38               ` Emanuel Berg
2024-01-24 11:15               ` Emanuel Berg
2024-01-24 11:55                 ` Emanuel Berg
2024-02-05  0:52                   ` Emanuel Berg
2024-02-06  3:44                     ` J.P.
2024-02-11  1:58                       ` Emanuel Berg
2024-02-11  2:27                       ` Emanuel Berg
2024-02-11  3:30                         ` Emanuel Berg
2024-02-11  3:52                           ` Emanuel Berg
2024-02-14  1:42                             ` J.P.
2024-02-17  5:21                               ` Emanuel Berg
2024-02-17  8:52                               ` Emanuel Berg
2024-02-21  1:11                                 ` J.P.
     [not found]                                 ` <87ttm2boza.fsf@neverwas.me>
2024-02-21  1:16                                   ` Emanuel Berg
2024-03-01  0:18                                     ` J.P.
2024-01-12 10:43 Emanuel Berg

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=87ttn5job9.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=emacs-erc@gnu.org \
    /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).