emacs-erc
[Top][All Lists]
Advanced

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

Re: declarative syntax to ERC show/hide messages by "type"


From: Corwin Brust
Subject: Re: declarative syntax to ERC show/hide messages by "type"
Date: Mon, 28 Dec 2020 00:04:03 -0600

I'll send the next to emacs-devel.

On Thu, Dec 10, 2020 at 8:09 PM Corwin Brust <corwin@bru.st> wrote:

> I was able to achieve this with a small hack into erc.el (attached
> with an extra) plus an additional bit in my init scripts, as such:

I have supplied link to a git repo with an updated version of the
patch and a more stand-alone source-file for this "feature".

> I also have a semi working interactive command that may, if it
> cooperates, provide a per buffer customization that is then retained
> for reuse if I Custom-save.  Once it does cooperate it should be easy
> enough to make it also DTRT when called from e.g. erc-join-hook.

The interactive command seems to work fairly well now.

> As an aside, in case it is unclear: this RFC would be different
> behavior from erc-hide-list (or erc-track-exclude-types) which aiu
> discard messages of the undesired types.
>
> Please let me know your thoughts, questions, and ideas.  And thanks to
> Amin and the many various IRC and points etc. for encouragement and
> wisdom.  As always, these fine people likely wrote the great bits of
> any particularly handy code I shared, except the many typos which
> obviously I have carefully added all by myself. :)

I have created a git repository with sourcehut for this.

 https://git.sr.ht/~mplscorwin/erc-hide-line/tree

Mostly, this is a somewhat tidied-up version of the same one-line
patch (You may recall that will add the parsed IRC command for each
message into a text property. A slightly changed version is available
from the repo linked above) but now includes "erc-hide-line", an
interactive command to toggle show/hide for a channel, writing back to
the customizable variable value but not saving out the changes (yet).
This is handy to toggle display of some types of messages, and I'll
probably add support for a negative prefix argument which will
suppress setting the variable (but will still apply the change to
buffer-invisibility-spec).  In any case, it has two completing
prompts, first for a channel name, then for a comma separated list of
commands to ignore.  You can also enter t at the first prompt to set
the defaults (stored in the "t" entry, along with channel setting as
an alist in `erc-hl-channels') or use blank/nil to use the current
buffer, given it is a connected ERC buffer.

Finally, I wanted to call out that the "keywords" in our mini-DSL have
changed to avoid collision with key built-ins.  We now support:
:none  - ignore any remaining args, show all messages
:only - ignore any defaults/prior args, consider remaining args (and
keywords) only.
:drop - remove remaining args, from e.g. defaults/prior set
:plus - add remaining args, the default but useful after a :drop

So:  given
defaults of A B C
A setting of :drop B :plus D
should yield
A C D

Now that most everything is a standalone package, in addition to the
prefix argument for the interactive command, I thought next to attempt
turning this into a bonafide ERC module.  Sorry for the hasty notes
here; there is a test file around the DSL that may shed some light and
please do question any thinking which seems yet unclear.  tia for any
comments and suggestions and thanks as always to JP, bandali, etc.
nice people for correspondence off-list/online/et. al.

-- 
Corwin
corwin@bru.st



reply via email to

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