Re: 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]> Sat, 13 Jan 2024 03:50:02 +0100
Newsgroups gmane.emacs.erc.general
Message-ID <[email protected]>
-- 
underground experts united
https://dataswamp.org/~incal
0001-Functions-for-ERC.patch (text/x-diff, 2.6 KB)
From fa8ae9dcc306d16cccdd6aa7c2bac242b90adbdb Mon Sep 17 00:00:00 2001
From: Emanuel Berg <[email protected]>
Date: Sat, 13 Jan 2024 03:40:05 +0100
Subject: [PATCH] Functions for ERC.

`erc-cmd-GMSG', `erc-cmd-GME' and `erc-cmd-AME' was added.
`erc-cmd-AMSG' was changed so that it does what the docstring says.
* lisp/erc/erc.el: functions were added/modified to/in this file.

(bug#68401)
---
 lisp/erc/erc.el | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 478683a77f5..aeb7722b563 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -4016,16 +4016,44 @@ 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: ")
+(defun erc-cmd-GMSG (line)
+  "Send LINE to all channels on all networks you are on.
+Interactively, prompt for the line of text to send."
+  (interactive "sSend to all channels: ")
   (setq line (erc-trim-string line))
   (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)))
+(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)))
     (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.
+Interactively, prompt for the line of text to send."
+  (interactive "sSend action to all channels: ")
+  (erc-with-all-buffers-of-server nil
+    (lambda () (erc-channel-p (erc-default-target)))
+    (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.
+Interactively, prompt for the line of text to send."
+  (interactive "sSend action to all channels on this network: ")
+  (erc-with-all-buffers-of-server erc-server-process
+    (lambda () (erc-channel-p (erc-default-target)))
+    (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.
 
-- 
2.39.2