From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 15 03:25:51 2020 Received: (at submit) by debbugs.gnu.org; 15 Sep 2020 07:25:51 +0000 Received: from localhost ([127.0.0.1]:57082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kI5La-0000XF-L2 for submit@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 ) id 1kI5LW-0000X5-O2 for submit@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 ) id 1kI5LW-0002CS-IA for bug-gnu-emacs@gnu.org; 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 ) id 1kI5LU-0004Fw-6r for bug-gnu-emacs@gnu.org; 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 ; 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 ; 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 ; Tue, 15 Sep 2020 00:25:03 -0700 (PDT) From: Alex Bochannek To: bug-gnu-emacs@gnu.org 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: 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@bochannek.com; 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 15 08:50:34 2020 Received: (at 43413) by debbugs.gnu.org; 15 Sep 2020 12:50:34 +0000 Received: from localhost ([127.0.0.1]:57679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIAPq-0002cT-0D for submit@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 ) id 1kIAPl-0002cC-Qz for 43413@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 ) id 1kIAPY-0000Hy-BG; Tue, 15 Sep 2020 14:50:21 +0200 From: Lars Ingebrigtsen To: Alex Bochannek Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions References: X-Now-Playing: Saito Koji's _433-1_: "433_016" Date: Tue, 15 Sep 2020 14:50:15 +0200 In-Reply-To: (Alex Bochannek's message of "Tue, 15 Sep 2020 00:25:02 -0700") Message-ID: <875z8f9pbs.fsf@gnus.org> 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 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alex Bochannek 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 16 14:12:12 2020 Received: (at 43413) by debbugs.gnu.org; 16 Sep 2020 18:12:12 +0000 Received: from localhost ([127.0.0.1]:35842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIbue-0005oX-BT for submit@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 ) id 1kIbuW-0005nx-Sp for 43413@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 To: Lars Ingebrigtsen Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions References: <875z8f9pbs.fsf@gnus.org> Date: Wed, 16 Sep 2020 11:11:57 -0700 In-Reply-To: <875z8f9pbs.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 15 Sep 2020 14:50:15 +0200") Message-ID: 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 writes: > Alex Bochannek 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Alex Bochannek 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 17 11:04:12 2020 Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 15:04:12 +0000 Received: from localhost ([127.0.0.1]:38592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIvSF-0003UL-Th for submit@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 ) id 1kIvSB-0003Tv-Fp for 43413@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 ) id 1kIvS0-0001ex-QC; Thu, 17 Sep 2020 17:03:59 +0200 From: Lars Ingebrigtsen To: Alex Bochannek Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions References: <875z8f9pbs.fsf@gnus.org> X-Now-Playing: PJ Harvey's _Dry Demos_: "O Stella" Date: Thu, 17 Sep 2020 17:03:55 +0200 In-Reply-To: (Alex Bochannek's message of "Wed, 16 Sep 2020 11:11:57 -0700") Message-ID: <87v9gcphr8.fsf@gnus.org> 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 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alex Bochannek 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 From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 17 11:04:14 2020 Received: (at control) by debbugs.gnu.org; 17 Sep 2020 15:04:14 +0000 Received: from localhost ([127.0.0.1]:38595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIvSI-0003Ua-6m for submit@debbugs.gnu.org; Thu, 17 Sep 2020 11:04:14 -0400 Received: from quimby.gnus.org ([95.216.78.240]:41844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIvSG-0003U8-FA for control@debbugs.gnu.org; Thu, 17 Sep 2020 11:04:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WurVc9fHqcIUxdjWne0FlwjugJXoim/+OYFngM8YWuo=; b=eGCJFHkKfAHeK5oRWDi6vreOiW asGOqhWWrJAmBpCTp6BU46A5DDZMrm1uYcta1KP76PrV+Kn5He2Hyy7kn4RFT/53uJcxKe1H6TCdR TJHQ4qbacbaZ8u2crYEGrdZx5YcCr7kpJnaHaVq5Mu1qBLJu0P2U0/ARaHElZI9x2QTY=; 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 ) id 1kIvS8-0001f7-Ma for control@debbugs.gnu.org; Thu, 17 Sep 2020 17:04:06 +0200 Date: Thu, 17 Sep 2020 17:04:03 +0200 Message-Id: <87tuvwphr0.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #43413 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: tags 43413 fixed close 43413 28.1 quit 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: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 43413 fixed close 43413 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 17 13:41:44 2020 Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 17:41:44 +0000 Received: from localhost ([127.0.0.1]:38908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIxui-0007ke-DH for submit@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 ) id 1kIxuc-0007kM-BS for 43413@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 To: Lars Ingebrigtsen Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions References: <875z8f9pbs.fsf@gnus.org> <87v9gcphr8.fsf@gnus.org> Date: Thu, 17 Sep 2020 10:41:28 -0700 In-Reply-To: <87v9gcphr8.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 17 Sep 2020 17:03:55 +0200") Message-ID: 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 writes: > Alex Bochannek 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Lars Ingebrigtsen writes: > Alex Bochannek 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. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 17 13:43:54 2020 Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 17:43:54 +0000 Received: from localhost ([127.0.0.1]:38922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIxwo-0007oc-AR for submit@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 ) id 1kIxwm-0007oO-A3 for 43413@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 ) id 1kIxwd-0003BC-0p; Thu, 17 Sep 2020 19:43:45 +0200 From: Lars Ingebrigtsen To: Alex Bochannek Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions References: <875z8f9pbs.fsf@gnus.org> <87v9gcphr8.fsf@gnus.org> 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: (Alex Bochannek's message of "Thu, 17 Sep 2020 10:41:28 -0700") Message-ID: <87zh5omh82.fsf@gnus.org> 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 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alex Bochannek 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 From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 17 16:32:52 2020 Received: (at 43413) by debbugs.gnu.org; 17 Sep 2020 20:32:52 +0000 Received: from localhost ([127.0.0.1]:39214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJ0aK-00081t-Am for submit@debbugs.gnu.org; Thu, 17 Sep 2020 16:32:52 -0400 Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:6247 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJ0aF-00081d-JT for 43413@debbugs.gnu.org; Thu, 17 Sep 2020 16:32:51 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.lapseofthought.com (Postfix) with ESMTP id 4BspYj1qGkz3jh7Z; Thu, 17 Sep 2020 13:32:41 -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 zr-PMDr8OpHF; Thu, 17 Sep 2020 13:32:40 -0700 (PDT) Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:4103:8b6d:b32d:d4a8]) (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 4BspYh1TPzz3jhdp; Thu, 17 Sep 2020 13:32:40 -0700 (PDT) From: Alex Bochannek To: Lars Ingebrigtsen Subject: Re: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions References: <875z8f9pbs.fsf@gnus.org> <87v9gcphr8.fsf@gnus.org> <87zh5omh82.fsf@gnus.org> Date: Thu, 17 Sep 2020 13:32:39 -0700 In-Reply-To: <87zh5omh82.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 17 Sep 2020 19:43:41 +0200") Message-ID: 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 writes: > Alex Bochannek 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 >> util [...] 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Lars Ingebrigtsen writes: > Alex Bochannek 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. Thanks, that helps. Should have probably looked first before asking and it's good to get an authoritative answer that this is the recommended approach. -- Alex. From unknown Wed Jun 18 00:24:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 16 Oct 2020 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator