Re: /ame source

Emanuel Berg <[email protected]> Fri, 05 Jan 2024 02:52:26 +0100
Newsgroups gmane.emacs.erc.general
Message-ID <[email protected]>
J.P. wrote:

> I wonder if we should instead change the behavior to match
> the doc string because I thought only commands that start
> with G ("global") are meant to affect all servers. IOW, why
> not copy the existing functionality to a /GMSG and make
> /AMSG only affect channels on the current server?

If we want AME and GME, here they are.

Not sure if that warning part of the docstring can be used
repeatedly without copying/hardcoding it each time - if so,
that would be better.

(defun erc-cmd-GME (line)
  "Send LINE as an action to all channels on all networks.
\nWarning: Use of this function is considered spamming;
         it is included for testing purposes only."
  (interactive "sSend action to all channels on all networks: ")
  (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.
\nWarning: Use of this function is considered spamming;
         it is included for testing purposes only."
  (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)

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