From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.devel Subject: Rmail filter, or using sieve - was Re: Concern about new binding. Date: Sat, 13 Feb 2021 14:32:14 +0300 Message-ID: References: <20210202134950.vybbpf3iewbymfjo.ref@Ergus> <20210202134950.vybbpf3iewbymfjo@Ergus> <87zh0mmr54.fsf@gmail.com> <87tuqunw6q.fsf@telefonica.net> <835z3a5miu.fsf@gnu.org> <87pn1f2dlf.fsf@melete.silentflame.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5996"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) Cc: ofv@wanadoo.es, eliz@gnu.org, emacs-devel@gnu.org, gray@gnu.org.ua, spwhitton@spwhitton.name To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 13 12:33:44 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAtBI-0001SD-4z for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Feb 2021 12:33:44 +0100 Original-Received: from localhost ([::1]:56256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAtBH-0000H1-6r for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Feb 2021 06:33:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAtAl-0008FZ-P0 for emacs-devel@gnu.org; Sat, 13 Feb 2021 06:33:11 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:46071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAtAj-0000WK-AZ; Sat, 13 Feb 2021 06:33:11 -0500 Original-Received: from localhost ([::ffff:197.157.0.47]) (AUTH: PLAIN securesender, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001E078.000000006027B8F1.000070B1; Sat, 13 Feb 2021 04:33:04 -0700 Mail-Followup-To: Richard Stallman , spwhitton@spwhitton.name, ofv@wanadoo.es, eliz@gnu.org, emacs-devel@gnu.org, gray@gnu.org.ua Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264601 Archived-At: * Richard Stallman [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