emacs-devel
[Top][All Lists]
Advanced

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

Rmail filter, or using sieve - was Re: Concern about new binding.


From: Jean Louis
Subject: Rmail filter, or using sieve - was Re: Concern about new binding.
Date: Sat, 13 Feb 2021 14:32:14 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Richard Stallman <rms@gnu.org> [2021-02-13 06:27]:
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> 
> Thanks for explaining the search operators, but I still don't see how
> to do this:
> 
> > How would I direct notmuch to recognize all messages which were sent
> > to bug-gnu-emacs but not emacs-devel, and propose a change in the
> > Emacs user interface?  The second criterion seems to require
> > humanlike understanding, not text processing.

With `notmuch' I cannot help much. `notmuch' and `mu' tools are
indexers of email, so they index it into the database and offer query
searches.

Reference:
https://www.djcbsoftware.nl/code/mu/

`notmuch' never worked for me, so I use `mu' tools. I am using Maildir
format and you probably not.

But the concept on how it works could also probably work in `notmuch'
I just did not yet see the package for Emacs and how it works.

In general, I would just create a hyperlink or function of that kind
that uses the query, so if program is `mu' or function name requires
QUERY as parameter, I would juse use parameter name similar like:

(to:bug-gnu-emacs OR cc:bug-gnu-emacs) NOT emacs-devel

But in general, as that is simple search, I would not be using indexed
database. I would use filtering. I do not know `rmail' functionality,
I believe it does read headers as some meta data. I may be wrong.

I am reading emails as following:

- on server side, all emails TO:/CC: for emacs-devel go to folder
  emacs-devel, they do not mix with gnu-help-emacs and other mailing
  lists

- if email still goes to one of them there will be some mixtures, but
  minimized

- when I read then emacs-devel with mutt, to filter out those sent to
  gnu-help-emacs I just filter by query (I press `l'):

  "! ~C help-gnu-emacs"

  as ~C stands both for TO: field and CC: fields and ~ stands for
  NOT. So filtering is easy and mutt read headers before opening all
  messages.

>From that view point it would be best to implement display filter or
listing filter in RMAIL. 

I can read here:
https://www.emacswiki.org/emacs/Rmail

that back in time existed variable `rmail-message-filter' Maybe
similar variable could be introduced to Rmail today.

I can see there exists spam filter functionality:

,----
| rsf-definitions-alist is a variable defined in ‘rmail-spam-filter.el’.
| Its value is nil
| 
|   You can customize this variable.
| 
| Documentation:
| A list of rules (definitions) matching spam messages.
| Each rule is an alist, with elements of the form (FIELD . REGEXP).
| The recognized FIELDS are: from, to, subject, content-type,
| x-spam-status, and contents.  The "contents" element refers to
| the entire text of the message; all the other elements refer to
| message headers of the same name.
`----

I would rather include there `cc' field as well, and maybe `header'
field as well.

Then I assume that spam functionality moves spam to (defcustom
rsf-file "~/XRMAIL-SPAM"

The same functionality could be generalized to have a definition of
the filter in a list and to define where to save such emails.

You could as well use spam functionality to move or copy some messages
to separate file and read them from the newly generated file. You
could chane `rsf-file' variable to some other name while using such
temporarily spam filter that basically sorts messages you wants.

But I am not sure if Rmail's spam filter supports negative match, like
NOT help-gnu-emacs

Easier would be to use `mutt' temporarily as then you could filter out
right away specific emails, including save them into separate
folders. You could later read same mailboxes by using Rmail.

Another solution would be to use `sieve' from GNU Mailutils to sort
messages in various folders. Then you would invoke the sieve command,
messages would be sorted and you would use rmail as usual to read them
and answer them.

The sieve script would be something like this below, but may syntax
may be wrong:


,----
| require "fileinto";
| 
| if address ["to", "cc"] "emacs-devel@gnu.org" and address ["to", "cc"]
|        not "help-gnu-emacs@gnu.org" {
|        fileinto "INBOX.only-emacs-devel";
| }
`----

You would then read INBOX.only-emacs-devel as it would not include
those others.

The sieve script you would run as:

$ sieve -f /home/rms/INBOX-OR-RMAIL my-sieve-script

and then invoke sieve when you need it.

I am including Sergey Poznyakoff as he is maintainer of GNU Mailutils
and can comment on this request better.

Jean



reply via email to

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