unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
@ 2023-01-22  8:30 Kamil Jońca
  2024-01-20  0:14 ` bug#61002: [PATCH] " Jakub Ječmínek
  0 siblings, 1 reply; 11+ messages in thread
From: Kamil Jońca @ 2023-01-22  8:30 UTC (permalink / raw)
  To: 61002


(I do not know if emacs list is the best one. If gnus have dedicated
list please tell me)

I have to resubscribe some of my groups.
As I know that most of articles I have read already, I wanted to score
them lower before first of January. But it seems that always all
articles are marked as scored:
key sequence

C-u
1
L
d
b
t
Tue, 16 Jul 2019 09:20:31 +0000 (UTC)

All articles are  marked as scored.
I would expect that only these before 16 jul 2019 will be marked.




In GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2022-12-20, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12101005
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-x=yes --with-x-toolkit=lucid
 --with-toolkit-scroll-bars --without-gsettings 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-OltuXQ/emacs-28.2+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LC_MESSAGES: en_GB.utf8
  value of $LC_TIME: C
  value of $LANG: pl_PL.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  shell-dirtrack-mode: t
  gnus-undo-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm hides /usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/fsm
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/srv hides /usr/share/emacs/site-lisp/elpa/srv-0.2/srv
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm-pkg hides /usr/share/emacs/site-lisp/elpa-src/fsm-0.2.1/fsm-pkg
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm-autoloads hides /usr/share/emacs/site-lisp/elpa-src/fsm-0.2.1/fsm-autoloads
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm hides /usr/share/emacs/site-lisp/elpa-src/fsm-0.2.1/fsm
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-wmii hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-wmii
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/srv hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/srv
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-festival hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-festival
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-screen hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-screen
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-ratpoison hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-ratpoison
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-gmail hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-gmail
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-autoloads hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-autoloads
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-httpupload hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-httpupload
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-libnotify hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-libnotify
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-awesome hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-awesome
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-notifications hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-notifications
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-xmessage hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-xmessage
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/fsm
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-ourversion hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-ourversion
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-pkg hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-pkg
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-sawfish hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-sawfish
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/hexrgb hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/hexrgb
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-tmux hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-tmux
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/srv hides /usr/share/emacs/site-lisp/elpa-src/srv-0.2/srv
/usr/share/emacs/site-lisp/elpa/srv-0.2/srv-autoloads hides /usr/share/emacs/site-lisp/elpa-src/srv-0.2/srv-autoloads
/usr/share/emacs/site-lisp/elpa/srv-0.2/srv-pkg hides /usr/share/emacs/site-lisp/elpa-src/srv-0.2/srv-pkg
/usr/share/emacs/site-lisp/flim/sasl hides /usr/share/emacs/28.2/lisp/net/sasl
/usr/share/emacs/site-lisp/sieve-mode hides /usr/share/emacs/28.2/lisp/net/sieve-mode

Features:
(shadow emacsbug sendmail appt w3m-form w3m-bookmark w3m timezone
w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-favicon w3m-image tab-line
w3m-proc w3m-util sort gnus-cite flow-fill mm-archive mail-extr
gnus-bcklg gnus-cus comp comp-cstr gnus-async qp gnus-ml disp-table
gnus-topic nndraft nnmh utf-7 rfc2104 network-stream nsm gnus-agent
gnus-srvr gnus-score nnvirtual gnus-msg nntp gnus-cache cus-start
add-log spamassassin-mode skeleton score-mode diary-lib diary-loaddefs
m4-mode vc-bzr mule-util info mhtml-mode css-mode color nroff-mode
rng-xsd xsd-regexp rng-cmpct js imenu fetchmail-mode make-mode autoconf
autoconf-mode rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap sgml-mode facemenu nxml-util nxml-enc xmltok vc-dir ewoc vc
edmacro kmacro pylint compile python tramp-sh tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell ls-lisp perl-mode
reveal sieve-mode org-element avl-tree generator ol-eww eww xdg
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt cl-extra help-mode speedbar ezimage dframe
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku
svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud
nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win ol-docview doc-view image-mode exif
ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex
iso8601 ol rx org-keys oc org-compat advice org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs conf-mode
muttrc-mode man cc-awk cc-mode cc-guess cc-menus cc-cmds cc-styles
cc-align jka-compr sql view thingatpt comint ansi-color ring dired-aux
dired dired-loaddefs vc-git diff-mode easy-mmode vc-dispatcher sh-script
smie executable server eudcb-ldap ldap eudc eudc-options-file cus-edit
pp eudc-vars nnir cc-fonts cc-engine cc-vars cc-defs yaml-mode warnings
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
desktop frameset cus-load finder-inf w3m-load package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting font-render-setting cairo x-toolkit x
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1160502 145690)
 (symbols 48 41607 5)
 (strings 32 164870 28136)
 (string-bytes 1 5503368)
 (vectors 16 79426)
 (vector-slots 8 2023882 82342)
 (floats 8 484 404)
 (intervals 56 79344 393)
 (buffers 992 956))

-- 
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: [PATCH] Re: bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2023-01-22  8:30 bug#61002: 28.2; Gnus - "Date" scoring scores all articles Kamil Jońca
@ 2024-01-20  0:14 ` Jakub Ječmínek
  2024-01-20 11:33   ` Jakub Ječmínek
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Ječmínek @ 2024-01-20  0:14 UTC (permalink / raw)
  To: 61002; +Cc: Lars Ingebrigtsen, Kamil Jońca

Tags: patch

Kamil Jońca <kjonca@poczta.onet.pl> writes:

> (I do not know if emacs list is the best one. If gnus have dedicated
> list please tell me)
>
> I have to resubscribe some of my groups.
> As I know that most of articles I have read already, I wanted to score
> them lower before first of January. But it seems that always all
> articles are marked as scored:
> key sequence
>
> C-u
> 1
> L
> d
> b
> t
> Tue, 16 Jul 2019 09:20:31 +0000 (UTC)
>
> All articles are  marked as scored.
> I would expect that only these before 16 jul 2019 will be marked.

Hi, thanks for the bug report! Maybe I'm missing something but it feels
like Gnus is providing invalid default value for the match element as it
should be integer. I would like to ask somebody who is more
knowledgeable about Gnus to confirm my hypothesis. If so, I've prepared
a patch which provides more meaningful default value - number of days
between today and entry at point. Please see below.

From e0269f4aa369182fdc81231815b36a05190149ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
Date: Sat, 20 Jan 2024 00:51:03 +0100
Subject: [PATCH] Provide valid match element for date key during interactive
 gnus-summary-increase-score

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): The user is given invalid
default match element value during interactive use of gnus-summary-increase-score
and gnus-summary-lower-score (date key). We fix that by providing more meaningful
default value - number of days between today and entry at point.
---
 lisp/gnus/gnus-score.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index bd19e7d7cd7..8199e94fd20 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -895,7 +895,11 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
                           (if (< score 0) "lower" "raise"))
                   (if (numberp match)
                       (int-to-string match)
-                    match))))
+                     (int-to-string
+                      (-
+                       (mod 86400 (car (time-convert (current-time) 1)))
+                       (mod 86400 (car (time-convert (gnus-date-get-time
+                                                      (gnus-date-iso8601 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)

I'm happy to make further changes if need be and sign the paperwork.


Best,

Jakub Ječmínek






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-01-20  0:14 ` bug#61002: [PATCH] " Jakub Ječmínek
@ 2024-01-20 11:33   ` Jakub Ječmínek
  2024-01-27  9:30     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Ječmínek @ 2024-01-20 11:33 UTC (permalink / raw)
  To: 61002; +Cc: Lars Ingebrigtsen, Kamil Jońca

I've made huge mistake in my previous patch (now everyone will know
that I'm terrible programmer).

Here's working solution of what I'm proposing:

From 0631de4d7be1d9891b3d42b77446ce6ea4d0c709 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
Date: Sat, 20 Jan 2024 00:51:03 +0100
Subject: [PATCH] Provide valid match element for date key during interactive
 gnus-summary-increase-score

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): The user is given invalid
default match element value during interactive use of gnus-summary-increase-score
and gnus-summary-lower-score (date key). We fix that by providing more meaningful
default value - number of days between today and entry at point.
---
 lisp/gnus/gnus-score.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index bd19e7d7cd7..46ccb14751d 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -895,7 +895,11 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
                           (if (< score 0) "lower" "raise"))
                   (if (numberp match)
                       (int-to-string match)
-                    match))))
+                     (int-to-string
+                      (-
+                       (/ (car (time-convert (current-time) 1)) 86400)
+                       (/ (car (time-convert (gnus-date-get-time (gnus-date-iso8601 match)) 1))
+                          86400)))))))

     ;; 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)

Best,

Jakub Ječmínek





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-01-20 11:33   ` Jakub Ječmínek
@ 2024-01-27  9:30     ` Eli Zaretskii
  2024-02-10  8:07       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-01-27  9:30 UTC (permalink / raw)
  To: Jakub Ječmínek, Eric Abrahamsen; +Cc: kjonca, larsi, 61002

> From: Jakub Ječmínek <jecminek.k@gmail.com>
> Date: Sat, 20 Jan 2024 12:33:11 +0100
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,
>  Kamil Jońca <kjonca@poczta.onet.pl>
> 
> I've made huge mistake in my previous patch (now everyone will know
> that I'm terrible programmer).
> 
> Here's working solution of what I'm proposing:

Eric, Lars: any comments?  Should this be installed?

> 
> >From 0631de4d7be1d9891b3d42b77446ce6ea4d0c709 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
> Date: Sat, 20 Jan 2024 00:51:03 +0100
> Subject: [PATCH] Provide valid match element for date key during interactive
>  gnus-summary-increase-score
> 
> * lisp/gnus/gnus-score.el (gnus-summary-score-entry): The user is given invalid
> default match element value during interactive use of gnus-summary-increase-score
> and gnus-summary-lower-score (date key). We fix that by providing more meaningful
> default value - number of days between today and entry at point.
> ---
>  lisp/gnus/gnus-score.el | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
> index bd19e7d7cd7..46ccb14751d 100644
> --- a/lisp/gnus/gnus-score.el
> +++ b/lisp/gnus/gnus-score.el
> @@ -895,7 +895,11 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
>                            (if (< score 0) "lower" "raise"))
>                    (if (numberp match)
>                        (int-to-string match)
> -                    match))))
> +                     (int-to-string
> +                      (-
> +                       (/ (car (time-convert (current-time) 1)) 86400)
> +                       (/ (car (time-convert (gnus-date-get-time (gnus-date-iso8601 match)) 1))
> +                          86400)))))))
> 
>      ;; 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)
> 
> Best,
> 
> Jakub Ječmínek
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-01-27  9:30     ` Eli Zaretskii
@ 2024-02-10  8:07       ` Eli Zaretskii
  2024-02-10 17:27         ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-02-10  8:07 UTC (permalink / raw)
  To: eric; +Cc: kjonca, larsi, jecminek.k, 61002

Ping!

> Cc: kjonca@poczta.onet.pl, larsi@gnus.org, 61002@debbugs.gnu.org
> Date: Sat, 27 Jan 2024 11:30:36 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Jakub Ječmínek <jecminek.k@gmail.com>
> > Date: Sat, 20 Jan 2024 12:33:11 +0100
> > Cc: Lars Ingebrigtsen <larsi@gnus.org>,
> >  Kamil Jońca <kjonca@poczta.onet.pl>
> > 
> > I've made huge mistake in my previous patch (now everyone will know
> > that I'm terrible programmer).
> > 
> > Here's working solution of what I'm proposing:
> 
> Eric, Lars: any comments?  Should this be installed?
> 
> > 
> > >From 0631de4d7be1d9891b3d42b77446ce6ea4d0c709 Mon Sep 17 00:00:00 2001
> > From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
> > Date: Sat, 20 Jan 2024 00:51:03 +0100
> > Subject: [PATCH] Provide valid match element for date key during interactive
> >  gnus-summary-increase-score
> > 
> > * lisp/gnus/gnus-score.el (gnus-summary-score-entry): The user is given invalid
> > default match element value during interactive use of gnus-summary-increase-score
> > and gnus-summary-lower-score (date key). We fix that by providing more meaningful
> > default value - number of days between today and entry at point.
> > ---
> >  lisp/gnus/gnus-score.el | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
> > index bd19e7d7cd7..46ccb14751d 100644
> > --- a/lisp/gnus/gnus-score.el
> > +++ b/lisp/gnus/gnus-score.el
> > @@ -895,7 +895,11 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
> >                            (if (< score 0) "lower" "raise"))
> >                    (if (numberp match)
> >                        (int-to-string match)
> > -                    match))))
> > +                     (int-to-string
> > +                      (-
> > +                       (/ (car (time-convert (current-time) 1)) 86400)
> > +                       (/ (car (time-convert (gnus-date-get-time (gnus-date-iso8601 match)) 1))
> > +                          86400)))))))
> > 
> >      ;; 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)
> > 
> > Best,
> > 
> > Jakub Ječmínek
> > 
> > 
> > 
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-02-10  8:07       ` Eli Zaretskii
@ 2024-02-10 17:27         ` Eric Abrahamsen
  2024-02-12 15:58           ` Jakub Ječmínek
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2024-02-10 17:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jecminek.k, larsi, kjonca, 61002

Eli Zaretskii <eliz@gnu.org> writes:

> Ping!
>
>> Cc: kjonca@poczta.onet.pl, larsi@gnus.org, 61002@debbugs.gnu.org
>> Date: Sat, 27 Jan 2024 11:30:36 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> 
>> > From: Jakub Ječmínek <jecminek.k@gmail.com>
>> > Date: Sat, 20 Jan 2024 12:33:11 +0100
>> > Cc: Lars Ingebrigtsen <larsi@gnus.org>,
>> >  Kamil Jońca <kjonca@poczta.onet.pl>
>> > 
>> > I've made huge mistake in my previous patch (now everyone will know
>> > that I'm terrible programmer).
>> > 
>> > Here's working solution of what I'm proposing:

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. Given that this is just providing a reasonable default value
for a user prompt, 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?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-02-10 17:27         ` Eric Abrahamsen
@ 2024-02-12 15:58           ` Jakub Ječmínek
  2024-02-17 17:41             ` Eric Abrahamsen
  2024-02-17 18:18             ` Philip Kaludercic
  0 siblings, 2 replies; 11+ messages in thread
From: Jakub Ječmínek @ 2024-02-12 15:58 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 61002, Eli Zaretskii, kjonca, larsi

Hi, thanks for the feedback!

Eric Abrahamsen <eric@ericabrahamsen.net> 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: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
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 header.
---
 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= header "date")
+                          (int-to-string
+                           (-
+                            (/ (car (time-convert (current-time) 1)) 86400)
+                            (/ (car (time-convert (gnus-date-get-time match) 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.

Best

Jakub Ječmínek





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-02-12 15:58           ` Jakub Ječmínek
@ 2024-02-17 17:41             ` Eric Abrahamsen
  2024-02-17 18:18             ` Philip Kaludercic
  1 sibling, 0 replies; 11+ messages in thread
From: Eric Abrahamsen @ 2024-02-17 17:41 UTC (permalink / raw)
  To: Jakub Ječmínek; +Cc: kjonca, Eli Zaretskii, 61002-done, larsi

Jakub Ječmínek <jecminek.k@gmail.com> writes:

> Hi, thanks for the feedback!
>
> Eric Abrahamsen <eric@ericabrahamsen.net> 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: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
> 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 header.
> ---
>  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= header "date")
> +                          (int-to-string
> +                           (-
> +                            (/ (car (time-convert (current-time) 1)) 86400)
> +                            (/ (car (time-convert (gnus-date-get-time match) 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.

Looks good! I've pushed, and am closing this bug, thanks.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-02-12 15:58           ` Jakub Ječmínek
  2024-02-17 17:41             ` Eric Abrahamsen
@ 2024-02-17 18:18             ` Philip Kaludercic
  2024-02-17 18:23               ` Philip Kaludercic
  1 sibling, 1 reply; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-17 18:18 UTC (permalink / raw)
  To: Jakub Ječmínek
  Cc: Eric Abrahamsen, kjonca, Eli Zaretskii, 61002, larsi

Jakub Ječmínek <jecminek.k@gmail.com> writes:

> Hi, thanks for the feedback!
>
> Eric Abrahamsen <eric@ericabrahamsen.net> 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: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
> 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 header.
> ---
>  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= header "date")
> +                          (int-to-string
> +                           (-
> +                            (/ (car (time-convert (current-time) 1)) 86400)
> +                            (/ (car (time-convert (gnus-date-get-time match) 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-variable 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-variable 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... 
  INFO     Scraping files for loaddefs...done
  INFO     Scraping files for loaddefs... 
  INFO     Scraping files for loaddefs...done
  GEN      finder-inf.el

Error: error ("Eager macro-expansion failure: (void-variable gnus-not-ignore)")
  signal(error ("Eager macro-expansion failure: (void-variable gnus-not-ignore)"))
  error("Eager macro-expansion failure: %S" (void-variable gnus-not-ignore))
  internal-macroexpand-for-load((eval-when-compile (require 'mm-decode) (require 'mm-view)) nil)
  eval-buffer(#<buffer  *load*-165045> nil "/home/philip/Source/emacs/lisp/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(#<buffer  *load*-129778> 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(#<buffer  *load*-532718> nil "/home/philip/Source/emacs/lisp/emacs-lisp/package.el" nil t)
  load-with-code-conversion("/home/philip/Source/emacs/lisp/emacs-lisp/package.el" "/home/philip/Source/emacs/lisp/emacs-lisp/package.el" nil t)
  require(package)
  eval-buffer(#<buffer  *load*> nil "/home/philip/Source/emacs/lisp/finder.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-keywords-make-dist" "." "./calc" "./calendar" "./cedet" "./cedet/ede" "./cedet/semantic" "./cedet/semantic/analyze" "./cedet/semantic/bovine" "./cedet/semantic/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)
--8<---------------cut here---------------end--------------->8---


> Best
>
> Jakub Ječmínek
>
>
>
>

-- 
Philip Kaludercic





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-02-17 18:18             ` Philip Kaludercic
@ 2024-02-17 18:23               ` Philip Kaludercic
  2024-02-17 18:41                 ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-17 18:23 UTC (permalink / raw)
  To: Jakub Ječmínek
  Cc: Eric Abrahamsen, 61002, Eli Zaretskii, kjonca, larsi

Philip Kaludercic <philipk@posteo.net> writes:

> Jakub Ječmínek <jecminek.k@gmail.com> writes:
>
>> Hi, thanks for the feedback!
>>
>> Eric Abrahamsen <eric@ericabrahamsen.net> 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: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
>> 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 header.
>> ---
>>  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= header "date")
>> +                          (int-to-string
>> +                           (-
>> +                            (/ (car (time-convert (current-time) 1)) 86400)
>> +                            (/ (car (time-convert (gnus-date-get-time match) 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!

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 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-variable 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-variable 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... 
>   INFO     Scraping files for loaddefs...done
>   INFO     Scraping files for loaddefs... 
>   INFO     Scraping files for loaddefs...done
>   GEN      finder-inf.el
>
> Error: error ("Eager macro-expansion failure: (void-variable gnus-not-ignore)")
>   signal(error ("Eager macro-expansion failure: (void-variable gnus-not-ignore)"))
>   error("Eager macro-expansion failure: %S" (void-variable gnus-not-ignore))
>   internal-macroexpand-for-load((eval-when-compile (require 'mm-decode) (require 'mm-view)) nil)
>   eval-buffer(#<buffer  *load*-165045> nil "/home/philip/Source/emacs/lisp/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(#<buffer  *load*-129778> 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(#<buffer  *load*-532718> nil "/home/philip/Source/emacs/lisp/emacs-lisp/package.el" nil t)
>   load-with-code-conversion("/home/philip/Source/emacs/lisp/emacs-lisp/package.el" "/home/philip/Source/emacs/lisp/emacs-lisp/package.el" nil t)
>   require(package)
>   eval-buffer(#<buffer  *load*> nil "/home/philip/Source/emacs/lisp/finder.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-keywords-make-dist" "." "./calc" "./calendar" "./cedet" "./cedet/ede" "./cedet/semantic" "./cedet/semantic/analyze" "./cedet/semantic/bovine" "./cedet/semantic/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čmínek
>>
>>
>>
>>

-- 
Philip Kaludercic





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
  2024-02-17 18:23               ` Philip Kaludercic
@ 2024-02-17 18:41                 ` Eric Abrahamsen
  0 siblings, 0 replies; 11+ messages in thread
From: Eric Abrahamsen @ 2024-02-17 18:41 UTC (permalink / raw)
  To: Philip Kaludercic
  Cc: 61002, Eli Zaretskii, kjonca, Jakub Ječmínek, larsi

Philip Kaludercic <philipk@posteo.net> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Jakub Ječmínek <jecminek.k@gmail.com> writes:
>>
>>> Hi, thanks for the feedback!
>>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> 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: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
>>> 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 header.
>>> ---
>>>  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= header "date")
>>> +                          (int-to-string
>>> +                           (-
>>> +                            (/ (car (time-convert (current-time) 1)) 86400)
>>> +                            (/ (car (time-convert (gnus-date-get-time match) 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!
>
> 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.

Yes, thank you! Sorry for not testing that better.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-17 18:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-22  8:30 bug#61002: 28.2; Gnus - "Date" scoring scores all articles Kamil Jońca
2024-01-20  0:14 ` bug#61002: [PATCH] " Jakub Ječmínek
2024-01-20 11:33   ` Jakub Ječmínek
2024-01-27  9:30     ` Eli Zaretskii
2024-02-10  8:07       ` Eli Zaretskii
2024-02-10 17:27         ` Eric Abrahamsen
2024-02-12 15:58           ` Jakub Ječmínek
2024-02-17 17:41             ` Eric Abrahamsen
2024-02-17 18:18             ` Philip Kaludercic
2024-02-17 18:23               ` Philip Kaludercic
2024-02-17 18:41                 ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).