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:18:55 +0000 Message-ID: <87plwvgdio.fsf@posteo.net> References: <878rhvhsyu.fsf@alfa.kjonca> <86ttmz86o3.fsf@gnu.org> <86h6igvj1n.fsf@gnu.org> <87bk8oz0u0.fsf@ericabrahamsen.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="15181"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eric Abrahamsen , kjonca@poczta.onet.pl, Eli Zaretskii , 61002@debbugs.gnu.org, 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:19:57 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 1rbPI4-0003hp-VU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Feb 2024 19:19:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbPHx-0007KB-5g; Sat, 17 Feb 2024 13:19:49 -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 1rbPHq-0007DK-DG for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 13:19:43 -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 1rbPHq-0001NG-4y for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 13:19:42 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rbPIA-0007pq-4Q for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 13:20: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:20: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.170819396930054 (code B ref 61002); Sat, 17 Feb 2024 18:20:02 +0000 Original-Received: (at 61002) by debbugs.gnu.org; 17 Feb 2024 18:19:29 +0000 Original-Received: from localhost ([127.0.0.1]:33841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbPHb-0007of-Ud for submit@debbugs.gnu.org; Sat, 17 Feb 2024 13:19:28 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:39011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbPHZ-0007oO-R9 for 61002@debbugs.gnu.org; Sat, 17 Feb 2024 13:19:26 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B4C95240027 for <61002@debbugs.gnu.org>; Sat, 17 Feb 2024 19:18:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708193939; bh=CWZ62rCjrXNVc1RtF3/45nc9J3MKCpPZuadcWBgi7JQ=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=UsfCO9M1qY5L/E+L5iVejOi8tBiUwNkJ//Dh7IENAGaQEVe5WKH1wz7fBtB6Se1si Y6+T8u1kQRztcbspRtRGJlFQNv01WiZTKLhgM7LNmBrCq7Yn/ABQFpKNKSjzA4msid JRB9t9cmifkbV++Bv7l6L99e0N9KEcwKjOalGEPo7cdqCe9e9rgRmSNkb3qaut0hFq uoiBUFyIPVCNKa8FxqDa7i3JL3nsQIzYw9MFui8H4LK7HVTJV6VhiJz5YFZdtWygNd MQV/K3xobfkA1zXyDC2ZIg01X3g7Vq+HH51NEqMIqQlHiO1FJ5E2BRrzwca0qttFwc eeRMVh7+PsK4A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TccWP13Kmz9rxB; Sat, 17 Feb 2024 19:18:56 +0100 (CET) In-Reply-To: ("Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?="'s message of "Mon, 12 Feb 2024 16:58:30 +0100") X-Hashcash: 1:20:240217:larsi@gnus.org::dd7sgm9Bg2xH4XCR:YLk X-Hashcash: 1:20:240217:kjonca@poczta.onet.pl::XZUO8nNrTi0tWQba:02zd X-Hashcash: 1:20:240217:eric@ericabrahamsen.net::xEPFSvOS+PVFGbdy:0Y8N X-Hashcash: 1:20:240217:eliz@gnu.org::TLwFmGDE4wxEEBET:1h4c X-Hashcash: 1:20:240217:61002@debbugs.gnu.org::aoVfymnskXqR0bcK:2FtI X-Hashcash: 1:20:240217:jecminek.k@gmail.com::jTjpAe4BhOFuecJ2:81q9 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:280141 Archived-At: 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 heade= r. > --- > 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)) 864= 00) > + (/ (car (time-convert (gnus-date-get-time ma= tch) 1)) > + 86400)))) > + (t match))))) > > ;; If this is an integer comparison, we transform from string to int. > (if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-integer) > -- > 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! --8<---------------cut here---------------start------------->8--- ELC org/ox.elc In toplevel form: org/ox.el:82:11: Error: Eager macro-expansion failure: (void-variable gnus-= 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-variab= le 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-varia= ble 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-ignor= e)") signal(error ("Eager macro-expansion failure: (void-variable gnus-not-ign= ore)")) error("Eager macro-expansion failure: %S" (void-variable gnus-not-ignore)) internal-macroexpand-for-load((eval-when-compile (require 'mm-decode) (re= quire 'mm-view)) nil) eval-buffer(# nil "/home/philip/Source/emacs/lisp/= url/url.el" nil t) load-with-code-conversion("/home/philip/Source/emacs/lisp/url/url.el" "/h= ome/philip/Source/emacs/lisp/url/url.el" nil t) require(url) eval-buffer(# nil "/home/philip/Source/emacs/lisp/= net/browse-url.el" nil t) load-with-code-conversion("/home/philip/Source/emacs/lisp/net/browse-url.= el" "/home/philip/Source/emacs/lisp/net/browse-url.el" nil t) require(browse-url) eval-buffer(# nil "/home/philip/Source/emacs/lisp/= emacs-lisp/package.el" nil t) load-with-code-conversion("/home/philip/Source/emacs/lisp/emacs-lisp/pack= age.el" "/home/philip/Source/emacs/lisp/emacs-lisp/package.el" nil t) require(package) eval-buffer(# nil "/home/philip/Source/emacs/lisp/finder.= el" nil t) load-with-code-conversion("/home/philip/Source/emacs/lisp/finder.el" "/ho= me/philip/Source/emacs/lisp/finder.el" nil t) load("finder" nil t) command-line-1(("-l" "finder" "--eval" "(setq generated-finder-keywords-f= ile (unmsys--file-name \"./finder-inf.el\"))" "-f" "finder-compile-keywords= -make-dist" "." "./calc" "./calendar" "./cedet" "./cedet/ede" "./cedet/sema= ntic" "./cedet/semantic/analyze" "./cedet/semantic/bovine" "./cedet/semanti= c/decorate" "./cedet/semantic/symref" "./cedet/semantic/wisent" "./cedet/sr= ecode" "./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) --8<---------------cut here---------------end--------------->8--- > Best > > Jakub Je=C4=8Dm=C3=ADnek > > > > --=20 Philip Kaludercic