[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /ame source

From: J.P.
Subject: Re: /ame source
Date: Tue, 02 Jan 2024 06:54:13 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

Emanuel Berg <incal@dataswamp.org> writes:

> Hello, as was discussed on #erc the other day, as we have
> /amsg AKA `erc-cmd-AMSG'

>From what I could gather it sounded like /amsg is either bugged or its
doc string needs attention. If that's so, Someone should fix it.

> it makes sense to have to have /ame
> as well.
> I added it to a file with two other useful ERC goodies,
> probably they can be included as well but they are not needed
> for /ame.

Please send separate patches against the source tree to the bug tracker.
If that's not possible, perhaps someone can do so on your behalf or at
least just file wishlist items without any accompanying patches.

> Enjoy :)
> ;;; -*- lexical-binding: t -*-
> ;;
> ;; this file:
> ;;   https://dataswamp.org/~incal/emacs-init/erc/erc-misc.el
> (require 'erc)
> (require 'erc-ring)
> (defun erc-cmd-AME (line)
>   "Send LINE as an action to all channels on all networks you are on.
> \nWarning: Use of this function is considered spamming;
>          it is included for testing purposes only.
> \nAlso see /amsg, `erc-cmd-AMSG'."
>   (interactive "sSend action to all channels you're on: ")
>   (erc-with-all-buffers-of-server nil
>     (lambda () (erc-channel-p (erc-default-target)))
>     (erc-cmd-ME line) ))
> (put 'erc-cmd-AME 'do-not-parse-args t)

Does this consider parted buffers? What about disconnected ones? Should
it be echoed when `command-indicator' is active?

> (defun erc-sort-list (col)
>   "Use after /list.
> Sort table by  column COL.
> A negative value will reverse the result after sorting."
>   (interactive (list (read-number "column [- to reverse]: " -2)))
>   (let ((colu (abs col))
>         (buffer-read-only nil)
>         (beg (point-min))
>         (end (point-max)) )
>     (if (= colu 1)
>         (sort-fields colu beg end)
>       (sort-numeric-fields colu beg end) )
>     (when (< col 0)
>       (reverse-region beg end) )
>     (goto-char beg) ))

Last I checked, /list is fundamentally broken in its understanding of
the IRC protocol [1]. If that's true, we should fix it before or at
least while adding to it.

> (defun erc-cmd-R (&optional n)
>   "Resend the most recent or Nth `erc' message/command.
> The most recent message, the default, has index N = 0."
>   (or n (setq n 0))
>   (if (and erc-input-ring
>            (< (1+ n) (ring-length erc-input-ring)) )
>       (progn
>         (ring-remove erc-input-ring 0)
>         (erc-send-input (ring-ref erc-input-ring n))
>         (ring-remove erc-input-ring 0) )
>     (message "No data") ))

Seems you've offered this up before. I've found something prepared in
response to the last time but ultimately left unsent, perhaps because I
felt it unproductive to encourage contributions outside of the tracker.

> (provide 'erc-misc)

[1] https://lists.gnu.org/archive/html/emacs-erc/2022-03/msg00005.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]