[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cm
From: |
Emanuel Berg |
Subject: |
bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt |
Date: |
Tue, 23 Jan 2024 07:20:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>>> (defun erc-drop-leading-whitespace (str)
>>>> (if (string-match "^ \\(.*\\)$" str)
>>>> (match-string 1 str)
>>>> str) )
>>>
>>> Why not use `string-prefix-p' and `substring' to
>>> accomplish this? Also, please name this using the internal
>>> "--" convention, something like
>>> `erc--drop-initial-space-char' or
>>> `erc--drop-single-leading-space'.
>>
>> Good idea to use `string-prefix-p' and `substring', but it
>> hasn't anything to do with ERC at this point - it should be
>> put in some string manipulation library and then ERC should
>> `require' it. [...]
Someone told me (thanks) there is already
a `string-remove-prefix' to do this so that whole thing can
be dropped.
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/erc/erc-misc.el
;;
;; Make erc-cmd-AMSG session-local, add /GMSG /AME /GME
;;
;; * lisp/erc/erc.el (erc-cmd-AMSG): Make good on behavior described in
;; the doc string by limiting damage to the current connection.
;; (erc-cmd-GMSG, erc-cmd-GME, erc-cmd-AME): New functions, all IRC
;; "slash commands". (Bug#68401)
(require 'erc)
(defun erc--connected-and-joined-p ()
(and (erc--current-buffer-joined-p)
erc-server-connected))
(defun erc-cmd-GMSG (line)
"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))))
(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 (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))))
(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))))
(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))))
(put 'erc-cmd-AME 'do-not-parse-args t)
(provide 'erc-misc)
--
underground experts united
https://dataswamp.org/~incal
- bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt, (continued)
- 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
- 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, 2024/01/12
- 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
- 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, 2024/01/12
- Message not available
- Message not available
- Message not available
- Message not available
- 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, 2024/01/22
- bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt, J.P., 2024/01/22
- Message not available
- Message not available
- bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt, J.P., 2024/01/22
- Message not available
- Message not available
- Message not available
- 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, 2024/01/22
- 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, 2024/01/22
- 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 <=
- 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, 2024/01/23
- bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt, J.P., 2024/01/23
- Message not available
- 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, 2024/01/23
- bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt, J.P., 2024/01/23
- Message not available
- 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, 2024/01/23
Message not available
- Message not available
- Message not available
- 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, 2024/01/23
- bug#68401: 30.0.50; ERC 5.6-git: `erc-cmd-GMSG', `erc-cmd-AMSG', `erc-cmd-GME', `erc-cmd-AME'. 2nd attempt, J.P., 2024/01/23
- Message not available
- 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, 2024/01/23
- 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, 2024/01/23
- 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, 2024/01/24