From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#61002: 28.2; Gnus - "Date" scoring scores all articles. Date: Sat, 17 Feb 2024 18:23:47 +0000 Message-ID: <87msrzgdak.fsf@posteo.net> References: <878rhvhsyu.fsf@alfa.kjonca> <86ttmz86o3.fsf@gnu.org> <86h6igvj1n.fsf@gnu.org> <87bk8oz0u0.fsf@ericabrahamsen.net> <87plwvgdio.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39433"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eric Abrahamsen , 61002@debbugs.gnu.org, Eli Zaretskii , kjonca@poczta.onet.pl, larsi@gnus.org To: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 17 19:24:51 2024 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 1rbPMo-0009yq-Tm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Feb 2024 19:24:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbPMh-0000wk-Ny; Sat, 17 Feb 2024 13:24:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbPMg-0000wT-Dq for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 13:24:42 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbPMg-0002b4-5r for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 13:24:42 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rbPN0-0007wx-4T for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 13:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Feb 2024 18:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61002 X-GNU-PR-Package: emacs Original-Received: via spool by 61002-submit@debbugs.gnu.org id=B61002.170819425730504 (code B ref 61002); Sat, 17 Feb 2024 18:25:02 +0000 Original-Received: (at 61002) by debbugs.gnu.org; 17 Feb 2024 18:24:17 +0000 Original-Received: from localhost ([127.0.0.1]:33846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbPMG-0007vw-8y for submit@debbugs.gnu.org; Sat, 17 Feb 2024 13:24:17 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:36015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbPME-0007vj-Mq for 61002@debbugs.gnu.org; Sat, 17 Feb 2024 13:24:15 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 11DCF240104 for <61002@debbugs.gnu.org>; Sat, 17 Feb 2024 19:23:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708194229; bh=InZ34BlGmpnWppTJKR6IyrOaMGVtFSQFip+lDbAnbmg=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=VWg/NgzRr036E1Sn/m604ydRtQ7ryjs6hhLQl0nXY9Ivn9NhKMddjh7/ulv10Z3xK hjztkvs7316oGORnS61/W2SLKT4V2p7Ad9t60EWjkEs3L809uc3zvhY079Vj+65HpJ 0+4HV5y6GBl87qheoRMUqwqzENQ0a0GmEQDlaLIFcFm9CeY+aV/R5ItaZKiWUziGtI Lab2tIsGaJsrWlPFJrqixSM9WCNesjjQmwKPXEslTXGFn2rM1bwoqkoA2uKKmoLCTp dgpqqeztizBRjqx/NYU1zSpRTxLUw2cJXt5rEcirX/fIEggRa0kaGMr9uwX3H39U9m 7UeLgDN0easdg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Tccd02Xn4z6tyH; Sat, 17 Feb 2024 19:23:48 +0100 (CET) In-Reply-To: <87plwvgdio.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 17 Feb 2024 18:18:55 +0000") X-Hashcash: 1:20:240217:eliz@gnu.org::xOMTrdnrzECbW21V:1UF X-Hashcash: 1:20:240217:jecminek.k@gmail.com::a7lqLTPqlk9YFPaO:fX1 X-Hashcash: 1:20:240217:larsi@gnus.org::HnNdzGhbBJgFnQ8o:0z8u X-Hashcash: 1:20:240217:61002@debbugs.gnu.org::/HGXQFECSa5bDtWj:0YJt X-Hashcash: 1:20:240217:kjonca@poczta.onet.pl::CqPUYn40x2A4Rc6M:39i8 X-Hashcash: 1:20:240217:eric@ericabrahamsen.net::IY3i75omSfaY/ZLP:4teU Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280142 Archived-At: Philip Kaludercic writes: > Jakub Je=C4=8Dm=C3=ADnek writes: > >> Hi, thanks for the feedback! >> >> Eric Abrahamsen writes: >> >>> Thanks for the ping. TBH I've never used scoring in Gnus, so this is new >>> territory for me. I tried the patch and it worked correctly, but... >>> >>> The patch is doing this: >>> >>> (gnus-date-get-time (gnus-date-iso8601 match)) >>> >>> This is the definition of `gnus-date-iso8601': >>> >>> (defun gnus-date-iso8601 (date) >>> "Convert the DATE to YYYYMMDDTHHMMSS." >>> (condition-case () >>> (gnus-time-iso8601 (gnus-date-get-time date)) >>> (error ""))) >>> >>> So error handling aside, the patch ends up doing the equivalent of: >>> >>> (let ((ds "Sun, 22 Jan 2023 09:30:17 +0100")) >>> (gnus-date-get-time >>> (gnus-time-iso8601 >>> (gnus-date-get-time ds)))) >>> >>> which effectively round-trips the date string through two different >>> formats. >> >> You're right. I've replaced the offending form with this: >> >> (car (time-convert (gnus-date-get-time match) 1)) >> >>> [...] I think we should just keep the inner >>> `gnus-date-get-time' call, and wrap the whole `int-to-string' form in a >>> `condition-case'. If anything at all goes wrong we really don't care, we >>> can just skip it and return a "1" or something. >>> >>> WDYT? >> >> I believe that error handling is now redundant, because even if we try to >> parse invalid date using `gnus-date-get-time' we still end up with valid >> value (0). >> >> (/ (car (time-convert (gnus-date-get-time "invalid date") 1)) 86400) >> >> But, there's one important thing I failed to realize - the code I wrote >> would break prompts for other headers. Therefore I propose we add `cond' >> and distinguish which header we're scoring on. >> >> Please let me know what you think, here's the patch: >> >>>>>From 4e2174503c1d69345536929a22483ae309048271 Mon Sep 17 00:00:00 2001 >> From: =3D?UTF-8?q?Jakub=3D20Je=3DC4=3D8Dm=3DC3=3DADnek?=3D >> Date: Mon, 12 Feb 2024 14:03:24 +0100 >> Subject: [PATCH] Provide valid match string when scoring on date header >> (Bug#61002) >> >> * lisp/gnus/gnus-score.el (gnus-summary-score-entry): Fix invalid >> default match string when creating score file interactively on date head= er. >> --- >> lisp/gnus/gnus-score.el | 11 ++++++++--- >> 1 file changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el >> index bd19e7d7cd7..479b7496cf1 100644 >> --- a/lisp/gnus/gnus-score.el >> +++ b/lisp/gnus/gnus-score.el >> @@ -893,9 +893,14 @@ If optional argument `EXTRA' is non-nil, it's a non= -standard overview header." >> (t "permanent")) >> header >> (if (< score 0) "lower" "raise")) >> - (if (numberp match) >> - (int-to-string match) >> - match)))) >> + (cond ((numberp match) (int-to-string match)) >> + ((string=3D header "date") >> + (int-to-string >> + (- >> + (/ (car (time-convert (current-time) 1)) 86= 400) >> + (/ (car (time-convert (gnus-date-get-time m= atch) 1)) >> + 86400)))) >> + (t match))))) >> >> ;; If this is an integer comparison, we transform from string to in= t. >> (if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-intege= r) >> -- >> 2.39.3 (Apple Git-145) >> >> The patch should be correctly indented even though it doesn't look like >> it is. The reason is that previous lines contain mixture of tabs and >> spaces. > > This results in an error while building Emacs! Turns out this was due to the above change, but a typo in the previous commit (db5e84af202532b138918295ea6dd1b0ea910d78). I have taken the liberty to push a commit fixing the issue. Hope that is ok with everyone. > ELC org/ox.elc > > In toplevel form: > org/ox.el:82:11: Error: Eager macro-expansion failure: (void-variable gnu= s-not-ignore) > make[3]: *** [Makefile:335: org/ox.elc] Error 1 > ELC org/ox-texinfo.elc > > In toplevel form: > org/ox-texinfo.el:33:11: Error: Eager macro-expansion failure: (void-vari= able gnus-not-ignore) > make[3]: *** [Makefile:335: org/ox-texinfo.elc] Error 1 > ELC org/org-element.elc > > In toplevel form: > org/org-element.el:68:11: Error: Eager macro-expansion failure: (void-var= iable gnus-not-ignore) > make[3]: *** [Makefile:335: org/org-element.elc] Error 1 > make[3]: Target 'compile-targets' not remade because of errors. > make[3]: Leaving directory '/home/philip/Source/emacs/lisp' > make[2]: *** [Makefile:382: main-first] Error 2 > GEN autoloads > INFO Scraping files for loaddefs...=20 > INFO Scraping files for loaddefs...done > INFO Scraping files for loaddefs...=20 > INFO Scraping files for loaddefs...done > GEN finder-inf.el > > Error: error ("Eager macro-expansion failure: (void-variable gnus-not-ign= ore)") > signal(error ("Eager macro-expansion failure: (void-variable gnus-not-i= gnore)")) > error("Eager macro-expansion failure: %S" (void-variable gnus-not-ignor= e)) > internal-macroexpand-for-load((eval-when-compile (require 'mm-decode) (= require 'mm-view)) nil) > eval-buffer(# nil "/home/philip/Source/emacs/lis= p/url/url.el" nil t) > load-with-code-conversion("/home/philip/Source/emacs/lisp/url/url.el" "= /home/philip/Source/emacs/lisp/url/url.el" nil t) > require(url) > eval-buffer(# nil "/home/philip/Source/emacs/lis= p/net/browse-url.el" nil t) > load-with-code-conversion("/home/philip/Source/emacs/lisp/net/browse-ur= l.el" "/home/philip/Source/emacs/lisp/net/browse-url.el" nil t) > require(browse-url) > eval-buffer(# nil "/home/philip/Source/emacs/lis= p/emacs-lisp/package.el" nil t) > load-with-code-conversion("/home/philip/Source/emacs/lisp/emacs-lisp/pa= ckage.el" "/home/philip/Source/emacs/lisp/emacs-lisp/package.el" nil t) > require(package) > eval-buffer(# nil "/home/philip/Source/emacs/lisp/finde= r.el" nil t) > load-with-code-conversion("/home/philip/Source/emacs/lisp/finder.el" "/= home/philip/Source/emacs/lisp/finder.el" nil t) > load("finder" nil t) > command-line-1(("-l" "finder" "--eval" "(setq generated-finder-keywords= -file (unmsys--file-name \"./finder-inf.el\"))" "-f" "finder-compile-keywor= ds-make-dist" "." "./calc" "./calendar" "./cedet" "./cedet/ede" "./cedet/se= mantic" "./cedet/semantic/analyze" "./cedet/semantic/bovine" "./cedet/seman= tic/decorate" "./cedet/semantic/symref" "./cedet/semantic/wisent" "./cedet/= srecode" "./emacs-lisp" "./emulation" "./erc" "./eshell" "./gnus" "./image"= "./international" "./language" "./mail" "./mh-e" "./net" "./nxml" "./org" = "./play" "./progmodes" "./textmodes" "./url" "./use-package" "./vc")) > command-line() > normal-top-level() > Eager macro-expansion failure: (void-variable gnus-not-ignore) > > >> Best >> >> Jakub Je=C4=8Dm=C3=ADnek >> >> >> >> --=20 Philip Kaludercic