hush native-comp warns by moving erc req out from eval-when-compile
silence byte-compilation warnings with eval-when-compile
catch readme up with reality
erc-hide-lines - toggle display of IRC message visibility
This package allows toggling of visibility of IRC messages based on default and per channel lists of "types" (e.g. IRC commands, such as JOIN, QUIT, etc).
;; hide/show in current buffer
M-x erc-hide-lines-toggle RET
;; hide specific messages in a channel
M-x erc-hide-lines RET #emacs RET JOIN,QUIT,PART RET
;; hide all but PRIVMSG by default
M-x erc-hide-lines RET t RET :most
;; hide nothing in #emacs
M-x erc-hide-lines RET #emacs RET :none RET
You can find the source for this module from: https://git.sr.ht/~mplscorwin/erc-hide-line
To use this module save erc-hide-line.el
somewhere on your load-path
.
Then you can do something like:
(require 'erc-hide-line)
(add-to-list 'erc-modules hide-line)
(erc-update-modules)
Create default and per channel using the customizing interface:
M-x customize-group RET erc-hide-line RET
Or add code to your emacs configuration all at once, using setq
:
(setq 'erc-hl-channels
'((t :most) ;; hide most things, by default
("#emacs" :most :drop MODE) ;; show mode changes
("#libera" :none)));; show everything
Or incrementally, with add-to-list
:
(add-to-list 'erc-hl-channels
'("#nethack" JOIN PART QUIT))
Or, for the defaults or channels you know exist, with setcrd
:
;; change defaults to ignore join, part, quit and AWAY/301
(setcdr (assoc t erc-hl-channels) '(JOIN PART QUIT AWAY s301))
See 6 for detail on using keywords (e.g. :none
, :drop
). For a table
of IRC type codes and meanings see erc-hl-commands
(e.g, with C-h v
or
by visiting the module's source).
You can quickly toggle display of messages between showing all
messages and hiding based on the default set (for the channel, if
any) using the interactive erc-hide-lines-toggle
command.
Loading this module binds this toggle to C-h M-H
.
The interactive command erc-hide-lines
allows interactively setting
the modes. By default (e.g. pressing RET
without entering a channel
name) this operates on the current buffer, given it is an ERC buffer.
This command is also available while not connected, in which case
completion for channel is from those already configured. You can
enter t
at the channel prompt to change the defaults, i.e. the types
to hide for channels that have not been expressly configured.
Once you select a channel the command prompts for a list of types, defaulting to the type list for the selected channel, or the defaults.
After entering/adjusting the types to hide the command will update
erc-hl-channels
but does not save customizations (e.g. to persist
across Emacs sessions). Be sure to use, e.g. customize-save
if you
wish to persist changes made interactively across Emacs sessions.
See the documentation for erc-hide-lines
(e.g. with C-h f
) for more
detailed information.
Both interactively and when configuring erc-hl-channels
, a simple
declarative "domain specific language" allows adjustment of the
message types to hide.
Considering the interactive use as:
<CHANNEL> RET <TYPES>
And the format for configuration of erc-hl-channels
as:
(<CHANNEL> <TYPES>)
Then types may be one or more (or lists of one or more) of:
Value | Meaning |
:none | show all types, ignore anything following |
:most | hide all types |
:only | show only what follows, ignore anything preceding |
:drop | hide what follows |
:plus | add what follows |
An obtuse example:
(add-to-list 'erc-hl-channels
(list "#dungeon" ;; only for #dungeon
;; start with the defaults
(append (assoc t erc-hl-channels)
;; show PART and QUIT
'( :drop (JOIN PART QUIT)
;; hide MODE change/notif
:add MODE s324))))
Copyright (C) 2020 Corwin Brust
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.