bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt

Emanuel Berg <[email protected]> Wed, 24 Jan 2024 03:01:11 +0100
Newsgroups gmane.emacs.bugs,gmane.emacs.erc.general
Message-ID <[email protected]>
tags: patch

J.P. wrote:

> You can't just use the lambda, but you can lose it entirely
> in favor of your predicate.

Done.


-- 
underground experts united
https://dataswamp.org/~incal
0005-Removed-lambda-connectivity-check-that-is-now-not-ne.patch (text/x-diff, 2.3 KB)
From fa37950454f6c7536c00a1cc7ec6c00a8b4b4b6b Mon Sep 17 00:00:00 2001
From: Emanuel Berg <[email protected]>
Date: Wed, 24 Jan 2024 02:54:46 +0100
Subject: [PATCH 5/5] Removed lambda connectivity check that is now not needed

Removed lambda, `erc-connected-and-joined-p' is used instead.
* lisp/erc/erc.el (erc-cmd-AMSG, erc-cmd-GMSG, erc-cmd-AME, erc-cmd-GME):
this happened in these functions.
(bug#68401)
---
 lisp/erc/erc.el | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index e89733e7871..25401c15ae7 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -4012,9 +4012,8 @@ erc-cmd-GMSG
   "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)))
-    (when (erc--connected-and-joined-p)
-      (erc-send-message line))))
+      #'erc--connected-and-joined-p
+    (erc-send-message line)))
 (put 'erc-cmd-GMSG 'do-not-parse-args t)
 
 (defun erc-cmd-AMSG (line)
@@ -4023,25 +4022,22 @@ erc-cmd-AMSG
   (interactive "sSend to all channels on this network: ")
   (setq line (string-remove-prefix " " line))
   (erc-with-all-buffers-of-server erc-server-process
-      (lambda () (erc-channel-p (erc-default-target)))
-    (when (erc--connected-and-joined-p)
-      (erc-send-message line))))
+      #'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
-      (lambda () (erc-channel-p (erc-default-target)))
-    (when (erc--connected-and-joined-p)
-      (erc-cmd-ME line))))
+      (erc--connected-and-joined-p)
+    (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
-      (lambda () (erc-channel-p (erc-default-target)))
-    (when (erc--connected-and-joined-p)
-      (erc-cmd-ME line))))
+      #'erc--connected-and-joined-p
+    (erc-cmd-ME line)))
 (put 'erc-cmd-AME 'do-not-parse-args t)
 
 (defun erc-cmd-SAY (line)
-- 
2.39.2