GNU bug report logs - #43413
28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alex Bochannek <alex@HIDDEN>; Keywords: patch fixed; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 43413 <at> debbugs.gnu.org:


Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 17:43:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 17 13:43:54 2020
Received: from localhost ([127.0.0.1]:38922 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIxwo-0007oc-AR
	for submit <at> debbugs.gnu.org; Thu, 17 Sep 2020 13:43:54 -0400
Received: from quimby.gnus.org ([95.216.78.240]:43760)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kIxwm-0007oO-A3
 for 43413 <at> debbugs.gnu.org; Thu, 17 Sep 2020 13:43:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=d/szENQ6xw67hmvQkKWql9Njx6aClVdJA0Zr8ct7s7I=; b=oIQRDIBDaV4tf89DI+7s32RuKz
 gCvLEDJM3a/iuDE4MCZ3/F3L7PfMkQK/Z11Vj5iQMmU0oPDZkroRAwX2JUcKCgBIvs5tUIK+6QWs1
 +OgNv+T1k7Q3yEC3vrXrQfMGs975NtolZ8bHpuQZDK5XpmkC3HsN6CBp8eXPNTsUtiJA=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kIxwd-0003BC-0p; Thu, 17 Sep 2020 19:43:45 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Alex Bochannek <alex@HIDDEN>
Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support
 user-defined scoring functions
References: <m2k0wvbiy9.fsf@HIDDEN> <875z8f9pbs.fsf@HIDDEN>
 <m2een1d21e.fsf@HIDDEN> <87v9gcphr8.fsf@HIDDEN>
 <m2mu1ob8s7.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEW4xMRuaZIqKkT/
 //8985ebAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+QJEREZOApSeX4AAAFLSURBVCjPTdC/asMwEAbw
 M7gdOqXgQMnWoaXkKRyoO7tgmSZzHWI9RbJ0dqAJjaa0WMb6nrJ3iv9Ei/Tjk04nEV1GkPopUkmW
 ZncAzkSfX2ht3aEwcDgLKqLGwPYIcJL5si2YHYzVcXeG7ifvKd12eC7+zgM0mmrA6hrGF1VKSUdL
 ICZex7wOKZxQrDnmZLZ+Ke2WsWc8gXuL+fyB9z0ariD45jM5zyDA7DKiNdBwYrBLu1dzAkkGJJEs
 FouUG0QyocCq48oJtvxHNn8rXP9hXBSCKJJEJWqjUU8VSe+JyjRayuWeOL7JtNv0l1Com9YXkFdF
 +tjO4V3Qg9atHNP4KYmreYCnRevhGG6+O43Qe97mcEH+245YSgc9SvUxoqgij5NAVSHDdkktcNpD
 uXA6lsYrt9thhWpmLGB9B6jnAp948yh9AT8kUVfjH1Zi8EUZV0QkAAAAJXRFWHRkYXRlOmNyZWF0
 ZQAyMDIwLTA5LTE3VDE3OjI1OjU2KzAwOjAw3Ylm7AAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0w
 OS0xN1QxNzoyNTo1NiswMDowMKzU3lAAAAAASUVORK5CYII=
X-Now-Playing: African Head Charge's _Drastic Season_: "Many Generations"
Date: Thu, 17 Sep 2020 19:43:41 +0200
In-Reply-To: <m2mu1ob8s7.fsf@HIDDEN> (Alex Bochannek's message of "Thu, 
 17 Sep 2020 10:41:28 -0700")
Message-ID: <87zh5omh82.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Alex Bochannek <alex@HIDDEN> writes: > Did some
 testing
 and it looks good. Is there a unit test framework I > could use for Elisp
 code, by the way? That could be useful for simple > utility functions that
 just transform some input (e.g., [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 43413
Cc: 43413 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alex Bochannek <alex@HIDDEN> writes:

> Did some testing and it looks good. Is there a unit test framework I
> could use for Elisp code, by the way? That could be useful for simple
> utility functions that just transform some input (e.g., the patch I
> suggested in #43441.)

Yes, ert.  The test files are under test/lisp -- just have a peek at
them; it's pretty self-explanatory. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43413; Package emacs. Full text available.

Message received at 43413 <at> debbugs.gnu.org:


Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 17:41:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 17 13:41:44 2020
Received: from localhost ([127.0.0.1]:38908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIxui-0007ke-DH
	for submit <at> debbugs.gnu.org; Thu, 17 Sep 2020 13:41:44 -0400
Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:55308
 helo=mail.lapseofthought.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1kIxuc-0007kM-BS
 for 43413 <at> debbugs.gnu.org; Thu, 17 Sep 2020 13:41:42 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.lapseofthought.com (Postfix) with ESMTP id 4BskmC6PL5z3jhwb;
 Thu, 17 Sep 2020 10:41:31 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at lapseofthought.com
Received: from mail.lapseofthought.com ([127.0.0.1])
 by localhost (mail.lapseofthought.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id c7SZRtzlDAn2; Thu, 17 Sep 2020 10:41:31 -0700 (PDT)
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:2ce3:5dd8:d854:dc01])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4BskmB6pwSz3jhdp;
 Thu, 17 Sep 2020 10:41:30 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support
 user-defined scoring functions
References: <m2k0wvbiy9.fsf@HIDDEN> <875z8f9pbs.fsf@HIDDEN>
 <m2een1d21e.fsf@HIDDEN> <87v9gcphr8.fsf@HIDDEN>
Date: Thu, 17 Sep 2020 10:41:28 -0700
In-Reply-To: <87v9gcphr8.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Thu,
 17 Sep 2020 17:03:55 +0200")
Message-ID: <m2mu1ob8s7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 2.4 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Lars Ingebrigtsen <larsi@HIDDEN> writes: > Alex Bochannek
 <alex@HIDDEN> writes: > >> Please ignore the previous patch I sent
 that used let-forms, I found a >> bug in it. I cleaned it up some more and
 I am attaching a new >> patch. Tha [...] 
 Content analysis details:   (2.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 TVD_RCVD_IP            Message was received from an IP address
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 1.0 FORGED_SPF_HELO        No description available.
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 43413
Cc: 43413 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Alex Bochannek <alex@HIDDEN> writes:
>
>> Please ignore the previous patch I sent that used let-forms, I found a
>> bug in it. I cleaned it up some more and I am attaching a new
>> patch. Thanks again for the feedback!
>
> Thanks, applied to Emacs 28 with some minor stylistic changes.  Well,
> they looked minor to me, but I didn't actually test the resulting code,
> so you should probably do so.  :-)

Did some testing and it looks good. Is there a unit test framework I
could use for Elisp code, by the way? That could be useful for simple
utility functions that just transform some input (e.g., the patch I
suggested in #43441.)

Thanks!

-- 
Alex. <abochannek@HIDDEN>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43413; Package emacs. Full text available.
bug marked as fixed in version 28.1, send any further explanations to 43413 <at> debbugs.gnu.org and Alex Bochannek <alex@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 43413 <at> debbugs.gnu.org:


Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 15:04:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 17 11:04:12 2020
Received: from localhost ([127.0.0.1]:38592 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIvSF-0003UL-Th
	for submit <at> debbugs.gnu.org; Thu, 17 Sep 2020 11:04:12 -0400
Received: from quimby.gnus.org ([95.216.78.240]:41830)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kIvSB-0003Tv-Fp
 for 43413 <at> debbugs.gnu.org; Thu, 17 Sep 2020 11:04:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dPsE6C2eadldSTJCb/tnbefUZyBkdwZdBe9ePmKXkVQ=; b=cdvKimuKztCyCiWlxIm50tHQKO
 QipH+92mmSJBRe5lLJcL72meMuBOzo/5GZnEoFCoz7kZwcWIOsxVFyVaMOjndgHkWODQUmITbkB3j
 76rGSbNdNvzDjiHRlVNJMzSMGqc9G72Q5eRWpepCf2LNaoFi/H4f13ILfem2NRcBvDhk=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kIvS0-0001ex-QC; Thu, 17 Sep 2020 17:03:59 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Alex Bochannek <alex@HIDDEN>
Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support
 user-defined scoring functions
References: <m2k0wvbiy9.fsf@HIDDEN> <875z8f9pbs.fsf@HIDDEN>
 <m2een1d21e.fsf@HIDDEN>
X-Now-Playing: PJ Harvey's _Dry Demos_: "O Stella"
Date: Thu, 17 Sep 2020 17:03:55 +0200
In-Reply-To: <m2een1d21e.fsf@HIDDEN> (Alex Bochannek's message of "Wed, 
 16 Sep 2020 11:11:57 -0700")
Message-ID: <87v9gcphr8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Alex Bochannek <alex@HIDDEN> writes: > Please ignore
 the previous patch I sent that used let-forms, I found a > bug in it. I cleaned
 it up some more and I am attaching a new > patch. Thanks again for the
 feedback!
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 43413
Cc: 43413 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alex Bochannek <alex@HIDDEN> writes:

> Please ignore the previous patch I sent that used let-forms, I found a
> bug in it. I cleaned it up some more and I am attaching a new
> patch. Thanks again for the feedback!

Thanks, applied to Emacs 28 with some minor stylistic changes.  Well,
they looked minor to me, but I didn't actually test the resulting code,
so you should probably do so.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43413; Package emacs. Full text available.

Message received at 43413 <at> debbugs.gnu.org:


Received: (at 43413) by debbugs.gnu.org; 16 Sep 2020 18:12:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 16 14:12:12 2020
Received: from localhost ([127.0.0.1]:35842 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIbue-0005oX-BT
	for submit <at> debbugs.gnu.org; Wed, 16 Sep 2020 14:12:12 -0400
Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:16106
 helo=mail.lapseofthought.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1kIbuW-0005nx-Sp
 for 43413 <at> debbugs.gnu.org; Wed, 16 Sep 2020 14:12:10 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.lapseofthought.com (Postfix) with ESMTP id 4Bs7Tp5v1Zz3jjyr;
 Wed, 16 Sep 2020 11:11:58 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at lapseofthought.com
Received: from mail.lapseofthought.com ([127.0.0.1])
 by localhost (mail.lapseofthought.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id LXllExmxh-h0; Wed, 16 Sep 2020 11:11:57 -0700 (PDT)
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:4872:ffca:52c3:4605])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4Bs7Tn5mV2z3jhlV;
 Wed, 16 Sep 2020 11:11:57 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support
 user-defined scoring functions
References: <m2k0wvbiy9.fsf@HIDDEN> <875z8f9pbs.fsf@HIDDEN>
Date: Wed, 16 Sep 2020 11:11:57 -0700
In-Reply-To: <875z8f9pbs.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 15 Sep 2020 14:50:15 +0200")
Message-ID: <m2een1d21e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 2.4 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Lars Ingebrigtsen <larsi@HIDDEN> writes: > Alex Bochannek
 <alex@HIDDEN> writes: > >> Although it's only ~40 lines of Elisp and
 ~30 lines of Texinfo, I am >> pretty sure it's the largest code change I
 have submitted to Emacs and I >> w [...] 
 Content analysis details:   (2.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 TVD_RCVD_IP            Message was received from an IP address
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 FORGED_SPF_HELO        No description available.
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 43413
Cc: 43413 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Alex Bochannek <alex@HIDDEN> writes:
>
>> Although it's only ~40 lines of Elisp and ~30 lines of Texinfo, I am
>> pretty sure it's the largest code change I have submitted to Emacs and I
>> would not be surprised if I violated some coding standards. I have spent
>> a fair amount of time with testing, but cannot rule out corner cases, of
>> course. Let me know if you want me to make any improvements before
>> accepting this patch.
>
> Looks pretty good, but the main problem is neglecting to let-bind
> variables.  byte-compiling is a good way to catch these errors:

Please ignore the previous patch I sent that used let-forms, I found a
bug in it. I cleaned it up some more and I am attaching a new
patch. Thanks again for the feedback!


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline
Content-Description: New gnus-score-func to support user-defined scoring functions (code)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index ffc6b8ca34..2bc9980852 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -497,6 +497,7 @@ gnus-header-index
     ("head" -1 gnus-score-body)
     ("body" -1 gnus-score-body)
     ("all" -1 gnus-score-body)
+    (score-fn -1 nil)
     ("followup" 2 gnus-score-followup)
     ("thread" 5 gnus-score-thread)))
 
@@ -1175,14 +1176,20 @@ gnus-score-edit-file-at-point
       (when format
 	(gnus-score-pretty-print))
       (when (consp rule) ;; the rule exists
-	(setq rule (mapconcat #'(lambda (obj)
-				  (regexp-quote (format "%S" obj)))
-			      rule
-			      sep))
-	(goto-char (point-min))
-	(re-search-forward rule nil t)
-	;; make it easy to use `kill-sexp':
-	(goto-char (1- (match-beginning 0)))))))
+	(let (move)
+	  (setq rule (if (symbolp (car rule))
+			 (format "(%S)" (car rule))
+		       (mapconcat #'(lambda (obj)
+				      (regexp-quote (format "%S" obj)))
+				  rule
+				  sep)))
+	  (goto-char (point-min))
+	  (setq move (if (string-match "(.*)" rule)
+			 0
+		       -1))
+	  (re-search-forward rule nil t)
+	  ;; make it easy to use `kill-sexp':
+	  (goto-char (+ move (match-beginning 0))))))))
 
 (defun gnus-score-load-file (file)
   ;; Load score file FILE.  Returns a list a retrieved score-alists.
@@ -1232,6 +1239,7 @@ gnus-score-load-file
     (let ((mark (car (gnus-score-get 'mark alist)))
 	  (expunge (car (gnus-score-get 'expunge alist)))
 	  (mark-and-expunge (car (gnus-score-get 'mark-and-expunge alist)))
+	  (score-fn (car (gnus-score-get 'score-fn alist)))
 	  (files (gnus-score-get 'files alist))
 	  (exclude-files (gnus-score-get 'exclude-files alist))
 	  (orphan (car (gnus-score-get 'orphan alist)))
@@ -1567,10 +1575,14 @@ gnus-score-headers
 			    (gnus-message
 			     7 "Scoring on headers or body skipped.")
 			    nil)
+			;; Run score-fn
+			(if (eq header 'score-fn)
+			    (setq new (gnus-score-func scores trace))
 			;; Call the scoring function for this type of "header".
 			(setq new (funcall (nth 2 entry) scores header
-					   now expire trace)))
+					   now expire trace))))
 		  (push new news))))
+
 	    (when (gnus-buffer-live-p gnus-summary-buffer)
 	      (let ((scored gnus-newsgroup-scored))
 		(with-current-buffer gnus-summary-buffer
@@ -1636,6 +1648,35 @@ gnus-score-orphans
 		 (not (string= id "")))
 	(gnus-score-lower-thread thread score)))))
 
+(declare-function cl-pairlis "cl-lib")
+
+(defun gnus-score-func (scores &optional trace)
+  (let (articles alist entries)
+    (while scores
+      (setq articles gnus-scores-articles
+	    alist (car scores)
+	    scores (cdr scores)
+	    entries (assoc 'score-fn alist))
+      (dolist (score-fn (cdr entries))
+	(let ((score-fn (car score-fn))
+	      article-alist score fn-score)
+	  (dolist (art articles)
+	    (setq article-alist
+		  (cl-pairlis
+		   '(number subject from date id
+			    refs chars lines xref extra)
+		   (car art))
+		  score (cdr art))
+	    (if (integerp (setq fn-score (funcall score-fn
+						  article-alist score)))
+		(setcdr art (+ score fn-score)))
+	    (setq score (cdr art))
+	    (when trace
+	      (if (integerp fn-score)
+		  (push (cons (car-safe (rassq alist gnus-score-cache))
+			      (list score-fn fn-score))
+			gnus-score-trace)))))))))
+
 (defun gnus-score-integer (scores header now expire &optional trace)
   (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
 	entries alist)

--=-=-=
Content-Type: text/plain


-- 
Alex. <abochannek@HIDDEN>

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43413; Package emacs. Full text available.

Message received at 43413 <at> debbugs.gnu.org:


Received: (at 43413) by debbugs.gnu.org; 15 Sep 2020 12:50:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 08:50:34 2020
Received: from localhost ([127.0.0.1]:57679 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIAPq-0002cT-0D
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 08:50:34 -0400
Received: from quimby.gnus.org ([95.216.78.240]:44290)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kIAPl-0002cC-Qz
 for 43413 <at> debbugs.gnu.org; Tue, 15 Sep 2020 08:50:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Sj5eO1IckHdUseLpXu5A4qXsBRXUycJ+JeSPTMH2bFU=; b=OHynQl/MZWm3XB4jCsWQs0d3vq
 NLz8luIMsOozhTOmlh8yi2jy9f6sVQVzdHYpU61G5WUpqBBbIAefu3w3pym36GJCUriAq/4umVInK
 FCbu+oev2N7XY2fG2c+KPxJxvm71jlhe9zt0qNHZwkJPs+7LyCHKZOj6fW/j5qqp6rxA=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kIAPY-0000Hy-BG; Tue, 15 Sep 2020 14:50:21 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Alex Bochannek <alex@HIDDEN>
Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support
 user-defined scoring functions
References: <m2k0wvbiy9.fsf@HIDDEN>
X-Now-Playing: Saito Koji's _433-1_: "433_016"
Date: Tue, 15 Sep 2020 14:50:15 +0200
In-Reply-To: <m2k0wvbiy9.fsf@HIDDEN> (Alex Bochannek's message of "Tue, 
 15 Sep 2020 00:25:02 -0700")
Message-ID: <875z8f9pbs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Alex Bochannek <alex@HIDDEN> writes: > Although it's
 only ~40 lines of Elisp and ~30 lines of Texinfo, I am > pretty sure it's
 the largest code change I have submitted to Emacs and I > would not be
 surprised if I violated some coding sta [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 43413
Cc: 43413 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alex Bochannek <alex@HIDDEN> writes:

> Although it's only ~40 lines of Elisp and ~30 lines of Texinfo, I am
> pretty sure it's the largest code change I have submitted to Emacs and I
> would not be surprised if I violated some coding standards. I have spent
> a fair amount of time with testing, but cannot rule out corner cases, of
> course. Let me know if you want me to make any improvements before
> accepting this patch.

Looks pretty good, but the main problem is neglecting to let-bind
variables.  byte-compiling is a good way to catch these errors:

In gnus-score-edit-file-at-point:
gnus/gnus-score.el:1190:23: Warning: assignment to free variable `move'
gnus/gnus-score.el:1190:23: Warning: reference to free variable `move'

In gnus-score-func:
gnus/gnus-score.el:1657:35: Warning: assignment to free variable `articles'
gnus/gnus-score.el:1654:36: Warning: assignment to free variable `alist'
gnus/gnus-score.el:1669:46: Warning: reference to free variable `alist'
gnus/gnus-score.el:1655:28: Warning: assignment to free variable `entries'
gnus/gnus-score.el:1655:28: Warning: reference to free variable `entries'
gnus/gnus-score.el:1670:35: Warning: reference to free variable `articles'
gnus/gnus-score.el:1667:32: Warning: assignment to free variable `art'
gnus/gnus-score.el:1659:22: Warning: reference to free variable `art'
gnus/gnus-score.el:1665:53: Warning: assignment to free variable
    `article-alist'
gnus/gnus-score.el:1665:67: Warning: assignment to free variable `score'
gnus/gnus-score.el:1665:67: Warning: reference to free variable
    `article-alist'
gnus/gnus-score.el:1666:34: Warning: reference to free variable `score'
gnus/gnus-score.el:1666:40: Warning: assignment to free variable `fn-score'
gnus/gnus-score.el:1670:44: Warning: reference to free variable `fn-score'

In end of data:
gnus/gnus-score.el:3146:1: Warning: the function `cl-pairlis' might not be
    defined at runtime.

> +	(if (string-match "(.*)" rule)
> +	    (setq move 0) (setq move -1))

Even if the branches here are short, we prefer to write that as

	(if (string-match "(.*)" rule)
	    (setq move 0)
	  (setq move -1))

Or even better:

(setq move
      (if (string-match "(.*)" rule)
	  0
	-1))

	      
> +    (dolist (score-fn (cdr entries))
> +      (let ((score-fn (car score-fn)))
> +	    (while (setq art (pop articles))

And this could probably be a

  (dolist (art articles)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43413; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Sep 2020 07:25:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 03:25:51 2020
Received: from localhost ([127.0.0.1]:57082 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kI5La-0000XF-L2
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 03:25:50 -0400
Received: from lists.gnu.org ([209.51.188.17]:51250)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1kI5LW-0000X5-O2
 for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 03:25:48 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38280)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alex@HIDDEN>)
 id 1kI5LW-0002CS-IA
 for bug-gnu-emacs@HIDDEN; Tue, 15 Sep 2020 03:25:46 -0400
Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:16834
 helo=mail.lapseofthought.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alex@HIDDEN>)
 id 1kI5LU-0004Fw-6r
 for bug-gnu-emacs@HIDDEN; Tue, 15 Sep 2020 03:25:46 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.lapseofthought.com (Postfix) with ESMTP id 4BrF9t68Fqz3jj6m
 for <bug-gnu-emacs@HIDDEN>; Tue, 15 Sep 2020 00:25:06 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at lapseofthought.com
Received: from mail.lapseofthought.com ([127.0.0.1])
 by localhost (mail.lapseofthought.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id FaYnpTG1XSbi for <bug-gnu-emacs@HIDDEN>;
 Tue, 15 Sep 2020 00:25:03 -0700 (PDT)
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:613c:aee8:5b8c:2c55])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4BrF9q3PY4z3jhxj
 for <bug-gnu-emacs@HIDDEN>; Tue, 15 Sep 2020 00:25:03 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; [PATCH] New gnus-score-func to support user-defined
 scoring functions
Date: Tue, 15 Sep 2020 00:25:02 -0700
Message-ID: <m2k0wvbiy9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: softfail client-ip=50.0.39.243; envelope-from=alex@HIDDEN;
 helo=mail.lapseofthought.com
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/15 03:25:37
X-ACL-Warn: Detected OS   = Linux 2.2.x-3.x [generic] [fuzzy]
X-Spam_score_int: 2
X-Spam_score: 0.2
X-Spam_bar: /
X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, FORGED_SPF_HELO=1,
 KHOP_HELO_FCRDNS=0.399, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.665,
 TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Hello!

As I was modifying gnus-score.el, it occurred to me that a way to
specify user-defined scoring functions could be useful in cases where
even advanced scoring isn't sufficient. I put together some code and
documentation for that.

Although it's only ~40 lines of Elisp and ~30 lines of Texinfo, I am
pretty sure it's the largest code change I have submitted to Emacs and I
would not be surprised if I violated some coding standards. I have spent
a fair amount of time with testing, but cannot rule out corner cases, of
course. Let me know if you want me to make any improvements before
accepting this patch.

Thanks!


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=gnus-score.el.diff
Content-Description: New gnus-score-func to support user-defined scoring functions (code)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index ffc6b8ca34..b1b9082d9f 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -497,6 +497,7 @@ gnus-header-index
     ("head" -1 gnus-score-body)
     ("body" -1 gnus-score-body)
     ("all" -1 gnus-score-body)
+    (score-fn -1 nil)
     ("followup" 2 gnus-score-followup)
     ("thread" 5 gnus-score-thread)))
 
@@ -1175,14 +1176,18 @@ gnus-score-edit-file-at-point
       (when format
 	(gnus-score-pretty-print))
       (when (consp rule) ;; the rule exists
-	(setq rule (mapconcat #'(lambda (obj)
-				  (regexp-quote (format "%S" obj)))
-			      rule
-			      sep))
+	(setq rule (if (symbolp (car rule))
+		       (format "(%S)" (car rule))
+		     (mapconcat #'(lambda (obj)
+				    (regexp-quote (format "%S" obj)))
+				rule
+				sep)))
 	(goto-char (point-min))
+	(if (string-match "(.*)" rule)
+	    (setq move 0) (setq move -1))
 	(re-search-forward rule nil t)
 	;; make it easy to use `kill-sexp':
-	(goto-char (1- (match-beginning 0)))))))
+	(goto-char (+ move (match-beginning 0)))))))
 
 (defun gnus-score-load-file (file)
   ;; Load score file FILE.  Returns a list a retrieved score-alists.
@@ -1232,6 +1237,7 @@ gnus-score-load-file
     (let ((mark (car (gnus-score-get 'mark alist)))
 	  (expunge (car (gnus-score-get 'expunge alist)))
 	  (mark-and-expunge (car (gnus-score-get 'mark-and-expunge alist)))
+	  (score-fn (car (gnus-score-get 'score-fn alist)))
 	  (files (gnus-score-get 'files alist))
 	  (exclude-files (gnus-score-get 'exclude-files alist))
 	  (orphan (car (gnus-score-get 'orphan alist)))
@@ -1567,10 +1573,14 @@ gnus-score-headers
 			    (gnus-message
 			     7 "Scoring on headers or body skipped.")
 			    nil)
+			;; Run score-fn
+			(if (eq header 'score-fn)
+			    (setq new (gnus-score-func scores trace))
 			;; Call the scoring function for this type of "header".
 			(setq new (funcall (nth 2 entry) scores header
-					   now expire trace)))
+					   now expire trace))))
 		  (push new news))))
+
 	    (when (gnus-buffer-live-p gnus-summary-buffer)
 	      (let ((scored gnus-newsgroup-scored))
 		(with-current-buffer gnus-summary-buffer
@@ -1636,6 +1646,30 @@ gnus-score-orphans
 		 (not (string= id "")))
 	(gnus-score-lower-thread thread score)))))
 
+(defun gnus-score-func (scores &optional trace)
+  (while scores
+    (setq articles gnus-scores-articles
+	  alist (car scores)
+	  scores (cdr scores)
+	  entries (assoc 'score-fn alist))
+    (dolist (score-fn (cdr entries))
+      (let ((score-fn (car score-fn)))
+	    (while (setq art (pop articles))
+	      (setq article-alist
+		    (cl-pairlis
+		     '(number subject from date id
+			      refs chars lines xref extra)
+		     (car art))
+		    score (cdr art))
+	      (if (integerp (setq fn-score (funcall score-fn
+						    article-alist score)))
+		  (setcdr art (+ score fn-score)))
+	      (setq score (cdr art))
+	      (when trace
+		(push (cons (car-safe (rassq alist gnus-score-cache))
+			    (list score-fn fn-score))
+		      gnus-score-trace)))))))
+
 (defun gnus-score-integer (scores header now expire &optional trace)
   (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
 	entries alist)

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=gnus.texi.diff
Content-Description: New gnus-score-func to support user-defined scoring functions (doc)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 50eeb3efa3..c9f7491d5b 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -20394,6 +20394,36 @@ Score File Format
 @end enumerate
 
 @cindex score file atoms
+@item score-fn
+The value of this entry should be one or more user-defined function
+names in parentheses. Each function will be called in order and the
+returned value is required to be an integer.
+
+@example
+        (score-fn (custom-scoring))
+@end example
+
+The user-defined function is called with an associative list with the
+keys @code{number subject from date id refs chars lines xref extra}
+followed by the article's score before the function is run.
+
+The following (somewhat contrived) example shows how to use a
+user-defined function that increases an article's score by 10 if the
+year of the article's date is also mentioned in its subject.
+
+@example
+        (defun custom-scoring (article-alist score)
+          (let ((subject (cdr (assoc 'subject article-alist)))
+                (date (cdr (assoc 'date article-alist))))
+            (if (string-match (number-to-string
+                               (nth 5 (parse-time-string date)))
+                              subject)
+                10)))
+@end example
+
+@code{score-fn} entries are permanent and can only be added or
+modified directly in the @code{SCORE} file.
+
 @item mark
 The value of this entry should be a number.  Any articles with a score
 lower than this number will be marked as read.

--=-=-=
Content-Type: text/plain


-- 
Alex. <abochannek@HIDDEN>

--=-=-=--




Acknowledgement sent to Alex Bochannek <alex@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#43413; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 17 Sep 2020 17:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.