erc-ircfmt.el: Transient-based formatting for Erc (Emacs 29+)
Alcor <[email protected]> Thu, 14 Mar 2024 19:07:05 +0100
| Newsgroups | gmane.emacs.erc.general |
|---|---|
| Message-ID | <[email protected]> |
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
(application/emacs-lisp, 7.1 KB) - not displayed
ircfmt1.png
(image/png, 162.6 KB) - not displayed
ircfmt2.png
(image/png, 177 KB) - not displayed