[Top][All Lists]

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

/ame source

From: Emanuel Berg
Subject: /ame source
Date: Tue, 02 Jan 2024 02:09:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hello, as was discussed on #erc the other day, as we have
/amsg AKA `erc-cmd-AMSG' 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.

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)

(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) ))

(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)) )
        (ring-remove erc-input-ring 0)
        (erc-send-input (ring-ref erc-input-ring n))
        (ring-remove erc-input-ring 0) )
    (message "No data") ))

(provide 'erc-misc)

underground experts united

reply via email to

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