From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alex Bochannek Newsgroups: gmane.emacs.bugs Subject: bug#43270: 27.1; [PATCH] Enhance gnus-score-date to support scoring by article age Date: Thu, 10 Sep 2020 17:58:30 -0700 Message-ID: References: <878sdk7g1h.fsf@gnus.org> <87een97owr.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27616"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) Cc: 43270@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 11 02:59:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1kGXPC-0006zc-MA for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Sep 2020 02:59:10 +0200 Original-Received: from localhost ([::1]:39058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGXPB-0006h0-LQ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Sep 2020 20:59:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGXP4-0006gq-QH for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 20:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGXP4-0005fM-Gv for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 20:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kGXP4-0007yR-E2 for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 20:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Sep 2020 00:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43270 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed patch Original-Received: via spool by 43270-submit@debbugs.gnu.org id=B43270.159978592430627 (code B ref 43270); Fri, 11 Sep 2020 00:59:02 +0000 Original-Received: (at 43270) by debbugs.gnu.org; 11 Sep 2020 00:58:44 +0000 Original-Received: from localhost ([127.0.0.1]:41769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGXOm-0007xv-7h for submit@debbugs.gnu.org; Thu, 10 Sep 2020 20:58:44 -0400 Original-Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:33541 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGXOg-0007xc-FQ for 43270@debbugs.gnu.org; Thu, 10 Sep 2020 20:58:42 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.lapseofthought.com (Postfix) with ESMTP id 4Bncnh22X4z3jjWL; Thu, 10 Sep 2020 17:58:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at lapseofthought.com Original-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 cDsNp128PB-5; Thu, 10 Sep 2020 17:58:31 -0700 (PDT) Original-Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:45d2:a739:aa89:6e4b]) (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 4Bncng0SF8z3jhbH; Thu, 10 Sep 2020 17:58:31 -0700 (PDT) In-Reply-To: <87een97owr.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 10 Sep 2020 15:16:20 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187786 Archived-At: --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> Looks like I inverted the logic for '<'. New patch attached. > > Thanks; applied. Thanks, Lars! Below is another small patch to also support article age in interactive scoring. I wasn't sure about the error handling, so feel free to change that if there is a preferred style. -- Alex. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gnus-score.el.diff Content-Description: Modify gnus-summary-score-entry to support interactive article scoring by age diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 6a0e8ceb99..fce7b68db1 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -862,6 +862,18 @@ gnus-summary-score-entry (setq match (string-to-number match))) (set-text-properties 0 (length match) nil match)) + ;; Modify match and type for article age scoring. + (if (string= "date" (nth 0 (assoc header gnus-header-index))) + (let ((age (string-to-number match))) + (if (or (< age 0) + (string= "0" match)) + (user-error "Article age must be a positive number")) + (setq match age + type (cond ((eq type 'after) + '<) + ((eq type 'before) + '>))))) + (unless (eq date 'now) ;; Add the score entry to the score file. (when (= score gnus-score-interactive-default-score) --=-=-=--