[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
erc-ircfmt.el: Transient-based formatting for Erc (Emacs 29+)
From: |
Alcor |
Subject: |
erc-ircfmt.el: Transient-based formatting for Erc (Emacs 29+) |
Date: |
Thu, 14 Mar 2024 19:07:05 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello Erc'ers,
attached to this message is a proposal for a transient.el-based
IRC formatting [1] menu for Erc, allowing interactive formatting of
selected text regions with IRC formatting codes.
The attached Lisp program `erc-ircfmt.el' adds a new C-c q
keybinding to the Erc keymap, which is bound to an interactive function
`erc-fmt'.
`erc-fmt' provides a transient [2] menu where both text formatting
(bold, italicized, underlined) styles and foreground/background colors
can be selected, inserting the corresponding control code(s) at point,
or enclosing a region with them (if active).
I've been using this code for several months now, and it can be
considered fairly well-tested. A few screenshots showcasing the
transient prefixes are also attached. A recent version of Emacs (29+)
including transient.el is required.
The initial idea behind this was to bring Erc to "feature parity" with
rcirc. Emacs 29's NEWS mentions the following:
> *** New formatting commands.
> Most IRC clients (including rcirc) support basic formatting using
> control codes. Under the 'C-c C-f' prefix a few commands have been
> added to insert these automatically. For example, if a region is
> active and 'C-c C-f C-b' is invoked, markup is inserted for the region
> to be highlighted in bold.
Contrary to what the NEWS file claims, Erc does not support the
aforementioned prefixes/keybinds, and the aim of this extension is to
rectify this. Unfortunately, C-c C-f is already bound to
`erc-toggle-flood-control', therefore this code uses C-c q as an
alternative keybind (Many thanks to Corwin for the recommendation).
Comments/feedback are appreciated. If desirable, it might be possible to
include this code (or something similar) in erc-goodies.el, so Erc can
provide this functionality OOTB.
Cheers,
-A
[1] https://modern.ircdocs.horse/formatting.html
[2] https://www.gnu.org/software/emacs/manual/html_mono/transient.html
erc-ircfmt.el
Description: application/emacs-lisp
ircfmt1.png
Description: PNG image
ircfmt2.png
Description: PNG image
- erc-ircfmt.el: Transient-based formatting for Erc (Emacs 29+),
Alcor <=