all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
@ 2024-04-01 21:44 Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-13  7:58 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-01 21:44 UTC (permalink / raw)
  To: 70134; +Cc: Eric Abrahamsen, larsi, Alex Bochannek

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

Tags: patch


Hello, I'm attaching a patch that enhances user experience when adding
Gnus scores interactively based on date header. This patch does multiple
things:

1. `char-to-type' variable is renamed to `char-to-types' and we allow it
to be mapped to multiple types. This is useful because date header
supports all these types for scoring - '<, '>, 'r, 'after, 'before, 'at
but only the last three were previously offered to the user when using
interactive scoring.

2. `gnus-summary-score-entry' now provides sensible defaults for each
date scoring type - if we're scoring based on integer value ('<, '>) we
offer number of days between now and entry at point (revised version of
what was introduced in bug#61002) and if we're scoring based on string
value ('after, 'before, 'at, 'r) we provide valid date string.

3. If the user scores articles based on date strings ('before, 'after,
'at, 'r), `gnus-summary-score-entry' will no longer cast the type to the
integer type.

4. `gnus-score-date' catches 'r type as well.

I'm also Cc'ing Alex who was the original author of '< '> date scoring
types. Please let me know what you think.


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2024-03-23 built on
 kuba-ThinkPad-T14-Gen-3
Repository revision: 7e32e8392ab77f9df08a1f11831cbba2242d721f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12201001
System Description: Ubuntu 22.04.4 LTS


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Show-all-date-options-when-adding-Gnus-scores-interactively.patch --]
[-- Type: text/patch; name=0001-Show-all-date-options-when-adding-Gnus-scores-interactively.patch, Size: 5434 bytes --]

From 64659d65c3b43960bc0347d5be035ec64779b0ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
Date: Sat, 30 Mar 2024 00:34:07 +0100
Subject: [PATCH] Show all date options when adding Gnus scores interactively

* lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
'char-to-type' variable to 'char-to-types' and allow multiple types
for each char.

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
default values for each scoring type and cast 'match' to number only
if necessary.
---
 lisp/gnus/gnus-score.el | 55 ++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 479b7496cf1..d7346581f2f 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -593,18 +593,18 @@ current score file."
 	    (?d "date" nil nil date)
 	    (?f "followup" nil nil string)
 	    (?t "thread" "message-id" nil string)))
-	 (char-to-type
+	 (char-to-types
 	  '((?s s "substring" string)
 	    (?e e "exact string" string)
 	    (?f f "fuzzy string" string)
-	    (?r r "regexp string" string)
+	    (?r r "regexp string" string date)
 	    (?z s "substring" body-string)
 	    (?p r "regexp string" body-string)
 	    (?b before "before date" date)
 	    (?a after "after date" date)
 	    (?n at "this date" date)
-	    (?< < "less than number" number)
-	    (?> > "greater than number" number)
+	    (?< < "less than number" number date)
+	    (?> > "greater than number" number date)
 	    (?= = "equal to number" number)))
 	 (current-score-file gnus-current-score-file)
 	 (char-to-perm
@@ -652,10 +652,9 @@ current score file."
 	  (let ((legal-types
 		 (delq nil
 		       (mapcar (lambda (s)
-				 (if (eq (nth 4 entry)
-					 (nth 3 s))
+				 (if (member (nth 4 entry) (cdddr s))
 				     s nil))
-			       char-to-type))))
+			       char-to-types))))
             (setq header-string
                   (format "%s header `%s' with match type (%s?): "
 			  (if increase "Increase" "Lower")
@@ -875,10 +874,18 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
   (when (eq type t)
     (setq type 'r))
   ;; Simplify matches...
-  (cond ((or (eq type 'r) (eq type 's) (eq type nil))
+  (cond ((or (and (eq type 'r) (not (string= header "date"))) (eq type 's) (eq type nil))
 	 (setq match (if match (gnus-simplify-subject-re match) "")))
 	((eq type 'f)
-	 (setq match (gnus-simplify-subject-fuzzy match))))
+	 (setq match (gnus-simplify-subject-fuzzy match)))
+        ;; Provide better default values if we're scoring on date header
+        ((string= header "date")
+         (setq match (if (or (eq type '<) (eq type '>))
+                         (format-seconds "%d"
+                                         (time-subtract
+                                          (current-time)
+                                          (gnus-date-get-time match)))
+                       (substring-no-properties (gnus-date-iso8601 match))))))
   (let ((score (gnus-score-delta-default score))
 	(header (downcase header))
 	new)
@@ -893,14 +900,9 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
 				 (t "permanent"))
 			   header
 			   (if (< score 0) "lower" "raise"))
-                   (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 (numberp match)
+		       (int-to-string match)
+		     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)
@@ -909,16 +911,13 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
       (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)
-			    '>)))))
+    (when (and (string= "date" (nth 0 (assoc header gnus-header-index)))
+               (or (eq type '<) (eq type '>)))
+      (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)))
 
     (unless (eq date 'now)
       ;; Add the score entry to the score file.
@@ -1806,7 +1805,7 @@ score in `gnus-newsgroup-scored' by SCORE."
 	   ((eq type 'at)
 	    (setq match-func 'string=
 		  match (gnus-date-iso8601 (nth 0 kill))))
-	   ((eq type 'regexp)
+	   ((or (eq type 'regexp) (eq type 'r))
 	    (setq match-func 'string-match
 		  match (nth 0 kill)))
 	   (t (error "Invalid match type: %s" type)))
-- 
2.39.3 (Apple Git-145)


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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-01 21:44 bug#70134: [PATCH] Show all date options when adding Gnus scores interactively Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-13  7:58 ` Eli Zaretskii
  2024-04-22  3:33   ` Eric Abrahamsen
  2024-05-22 21:34 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2024-04-13  7:58 UTC (permalink / raw)
  To: eric, Jakub Ječmínek; +Cc: 70134, larsi, alex

Ping!  Eric, any comments?

> Cc: Eric Abrahamsen <eric@ericabrahamsen.net>, larsi@gnus.org,
>  Alex Bochannek <alex@bochannek.com>
> Date: Mon, 01 Apr 2024 21:44:04 +0000
> From:  Jakub Ječmínek via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Hello, I'm attaching a patch that enhances user experience when adding
> Gnus scores interactively based on date header. This patch does multiple
> things:
> 
> 1. `char-to-type' variable is renamed to `char-to-types' and we allow it
> to be mapped to multiple types. This is useful because date header
> supports all these types for scoring - '<, '>, 'r, 'after, 'before, 'at
> but only the last three were previously offered to the user when using
> interactive scoring.
> 
> 2. `gnus-summary-score-entry' now provides sensible defaults for each
> date scoring type - if we're scoring based on integer value ('<, '>) we
> offer number of days between now and entry at point (revised version of
> what was introduced in bug#61002) and if we're scoring based on string
> value ('after, 'before, 'at, 'r) we provide valid date string.
> 
> 3. If the user scores articles based on date strings ('before, 'after,
> 'at, 'r), `gnus-summary-score-entry' will no longer cast the type to the
> integer type.
> 
> 4. `gnus-score-date' catches 'r type as well.
> 
> I'm also Cc'ing Alex who was the original author of '< '> date scoring
> types. Please let me know what you think.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-13  7:58 ` Eli Zaretskii
@ 2024-04-22  3:33   ` Eric Abrahamsen
  2024-04-24 22:52     ` Richard Stallman
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Abrahamsen @ 2024-04-22  3:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70134, Jakub Ječmínek, larsi, alex

Eli Zaretskii <eliz@gnu.org> writes:

> Ping!  Eric, any comments?

I have no comments! I don't know the scoring code, and fifteen minutes
of looking at the patch and its surroundings has left me none the wiser.
I don't know what it means to add multiple types to each char; I don't
know what a "type" is in this context. Jakub, do you think you could
enlighten me within a short paragraph or so? I'm also okay with just
chucking it in, and letting people in gnus.general know that things have
changed. There are a few hardcore scoring users there.

Thanks,
Eric





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-22  3:33   ` Eric Abrahamsen
@ 2024-04-24 22:52     ` Richard Stallman
  2024-04-24 23:08       ` Alex Bochannek
  0 siblings, 1 reply; 28+ messages in thread
From: Richard Stallman @ 2024-04-24 22:52 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 70134, kuba, eliz, larsi, alex

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I have no comments! I don't know the scoring code, and fifteen minutes
  > of looking at the patch and its surroundings has left me none the wiser.

This suggests to me that that code may need better comments to explain
its overall structure.  Do you think so?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-24 22:52     ` Richard Stallman
@ 2024-04-24 23:08       ` Alex Bochannek
  2024-05-01 19:27         ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 28+ messages in thread
From: Alex Bochannek @ 2024-04-24 23:08 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Eric Abrahamsen, 70134, eliz, larsi, kuba

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > I have no comments! I don't know the scoring code, and fifteen minutes
>   > of looking at the patch and its surroundings has left me none the wiser.
>
> This suggests to me that that code may need better comments to explain
> its overall structure.  Do you think so?

As Jakub mentioned, I am the author of that part of the Gnus scoring
code. I have not had a chance to look at the proposed patch, but I agree
that some explanations would be useful. I can look it over this weekend.

-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-24 23:08       ` Alex Bochannek
@ 2024-05-01 19:27         ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-07  2:53           ` Alex Bochannek
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-01 19:27 UTC (permalink / raw)
  To: Alex Bochannek; +Cc: Eric Abrahamsen, 70134, eliz, larsi, Richard Stallman


"Eric Abrahamsen" <eric@ericabrahamsen.net> writes:
> I have no comments! I don't know the scoring code, and fifteen minutes
> of looking at the patch and its surroundings has left me none the wiser.
> I don't know what it means to add multiple types to each char; I don't
> know what a "type" is in this context. Jakub, do you think you could
> enlighten me within a short paragraph or so? I'm also okay with just
> chucking it in, and letting people in gnus.general know that things have
> changed. There are a few hardcore scoring users there.

Sure, please let me know if need more context.

If you hit 'I' or 'L' on any article (in the Summary buffer) then Gnus
will walk you through the scoring process. Gnus first asks you which
header you're scoring on and presents you a bunch of characters (each
character represents one header: d - date, b - body, etc.). If you
choose date, for example, then Gnus asks you for 'match type' which is
basically a handler which will decide whether to lower/increase the
score. Which scoring types are presented depends on which header you're
scoring on but current implementation allows to bind only one character
to one type. But since Alex implemented integer scoring (currently bound
to `number' type) to date, I think we should extend it and present this
option to the user.


"Alex Bochannek" <alex@bochannek.com> writes:
> As Jakub mentioned, I am the author of that part of the Gnus scoring
> code. I have not had a chance to look at the proposed patch, but I agree
> that some explanations would be useful. I can look it over this weekend.

Thank you, your review is appreciated. Please do you happen to remember
why you used this form

(string= "date" (nth 0 (assoc header gnus-header-index)))

instead of this

(string= header "date")


Thanks!

Best

-- 
Kuba Ječmínek (http://kubajecminek.cz)






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-01 19:27         ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-07  2:53           ` Alex Bochannek
  2024-05-09 19:15             ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 28+ messages in thread
From: Alex Bochannek @ 2024-05-07  2:53 UTC (permalink / raw)
  To: Jakub Ječmínek
  Cc: Eric Abrahamsen, 70134, eliz, larsi, Richard Stallman

Jakub,

I finally had some time to look at these changes, apologies for the
delay.

Jakub Ječmínek <kuba@kubajecminek.cz> writes:

> "Alex Bochannek" <alex@bochannek.com> writes:
>> As Jakub mentioned, I am the author of that part of the Gnus scoring
>> code. I have not had a chance to look at the proposed patch, but I agree
>> that some explanations would be useful. I can look it over this weekend.
>
> Thank you, your review is appreciated. Please do you happen to remember

I like the approach and tested them out. The legal-types change in
gnus-summary-increase-score is straightforward and makes sense to me. I
have one stylistic comment: (nthcdr 3 s) seems to be easier to read to
me than (cdddr s), but I have no strong opinions on that.

> why you used this form
>
> (string= "date" (nth 0 (assoc header gnus-header-index)))
>
> instead of this
>
> (string= header "date")

My suspicion is that this started out as a copy of the integer
comparison right above that code and I never cleaned it up. Yes, feel
free to simplify, I don't remember any good reason why it needs to pick
apart a list. It also seems perfectly fine to remove the (eq type
'after) etc. stuff, it's not necessary anymore.

The rest of the changes in gnus-summary-score-entry look good. I think
some more help text or additional documentation about the defaults would
be useful. It gets a bit confusing what you are prompted for. Having
said that, I like the idea of pulling a default date from the current
message, it just surprised me.

I also think I might have found a bug in how the dates are written out
to the SCORE file. I interactively increased the score in the order of
<, r, n, b, and n as you can see below. Only the b, a, and n entries get
converted to the list format with the un-evaluated gnus-time after
another entry is written. Meaning the second and third entry below, the
"before" and "at," looked just like the topmost "at" entry before the
following entry was written.

("date"
  ("20240501" nil nil at)
  (#("20240502" 0 1
     (gnus-time
      (26163 14832)))
   nil nil before)
  (#("20240503T145117" 0 1
     (gnus-time
      (26165 23637)))
   nil nil at)
  (".*T031840" nil nil r)
  (2 nil nil <)

> Thanks!

Hope this is useful!

-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-07  2:53           ` Alex Bochannek
@ 2024-05-09 19:15             ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-09 23:59               ` Eric Abrahamsen
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-09 19:15 UTC (permalink / raw)
  To: Alex Bochannek; +Cc: Eric Abrahamsen, 70134, eliz, larsi, Richard Stallman

"Alex Bochannek" <alex@bochannek.com> writes:

> I finally had some time to look at these changes, apologies for the
> delay.

Thank you very much for your time and all your comments.

> I like the approach and tested them out. The legal-types change in
> gnus-summary-increase-score is straightforward and makes sense to me. I
> have one stylistic comment: (nthcdr 3 s) seems to be easier to read to
> me than (cdddr s), but I have no strong opinions on that.

Thank you, I used (nthcdr 3 s) instead.

> My suspicion is that this started out as a copy of the integer
> comparison right above that code and I never cleaned it up. Yes, feel
> free to simplify, I don't remember any good reason why it needs to pick
> apart a list. It also seems perfectly fine to remove the (eq type
> 'after) etc. stuff, it's not necessary anymore.

I've adjusted only the age scoring part (not the integer comparison)
because I did not studied that part of the code and there's still
possibility that it is needed somehow.

> The rest of the changes in gnus-summary-score-entry look good. I think
> some more help text or additional documentation about the defaults would
> be useful. It gets a bit confusing what you are prompted for. Having
> said that, I like the idea of pulling a default date from the current
> message, it just surprised me.

I've added a comment explaining the changes I made to the date
prompt. If you feel like the code needs more comments, please pinpoint
where and I will add them.

> I also think I might have found a bug in how the dates are written out
> to the SCORE file. I interactively increased the score in the order of
> <, r, n, b, and n as you can see below. Only the b, a, and n entries get
> converted to the list format with the un-evaluated gnus-time after
> another entry is written. Meaning the second and third entry below, the
> "before" and "at," looked just like the topmost "at" entry before the
> following entry was written.

I've found the reason why it happens and found a solution. The problem
is in the `gnus-date-get-time' macro. This macro accepts a single
argument - date - and returns a different one - time - with text
property added. However, this macro is written in such way that it
modifies the input argument as well. We can fix it by adding `copy-sequence'
function to the let form.

> Hope this is useful!

Very helpful yes.

I've also noticed that the change I proposed - moving the part of the
code which modifies match variable to the beginning of the
`gnus-summary-score-entry' function is a bad idea because we're
modifying input argument to the function. It would mean that if the user
called the function non interactively (without prompt):

(gnus-summary-score-entry "date" "55" '< 1000 nil)

then it would change "55" to different number based on article age. I've
moved that code back where it was. I attach the patch below.

Thank you,

Best

From 22c8bcc0b52b70baf9931d168a07fd69dbbd1e8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
Date: Thu, 9 May 2024 20:33:58 +0200
Subject: [PATCH] Show all date options when adding Gnus scores interactively

* lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
'char-to-type' variable to 'char-to-types' and bind all legal types
for date header.

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
default values for each scoring type and cast 'match' to number only
if necessary.
---
 lisp/gnus/gnus-score.el | 46 ++++++++++++++++++++---------------------
 lisp/gnus/gnus-util.el  |  2 +-
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 479b7496cf1..4e9e0083424 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -593,18 +593,18 @@ gnus-summary-increase-score
 	    (?d "date" nil nil date)
 	    (?f "followup" nil nil string)
 	    (?t "thread" "message-id" nil string)))
-	 (char-to-type
+	 (char-to-types
 	  '((?s s "substring" string)
 	    (?e e "exact string" string)
 	    (?f f "fuzzy string" string)
-	    (?r r "regexp string" string)
+	    (?r r "regexp string" string date)
 	    (?z s "substring" body-string)
 	    (?p r "regexp string" body-string)
 	    (?b before "before date" date)
 	    (?a after "after date" date)
 	    (?n at "this date" date)
-	    (?< < "less than number" number)
-	    (?> > "greater than number" number)
+	    (?< < "less than number" number date)
+	    (?> > "greater than number" number date)
 	    (?= = "equal to number" number)))
 	 (current-score-file gnus-current-score-file)
 	 (char-to-perm
@@ -652,10 +652,9 @@ gnus-summary-increase-score
 	  (let ((legal-types
 		 (delq nil
 		       (mapcar (lambda (s)
-				 (if (eq (nth 4 entry)
-					 (nth 3 s))
+				 (if (member (nth 4 entry) (nthcdr 3 s))
 				     s nil))
-			       char-to-type))))
+			       char-to-types))))
             (setq header-string
                   (format "%s header `%s' with match type (%s?): "
 			  (if increase "Increase" "Lower")
@@ -894,12 +893,16 @@ gnus-summary-score-entry
 			   header
 			   (if (< score 0) "lower" "raise"))
                    (cond ((numberp match) (int-to-string match))
+                         ;; Provide better defaults if we're scoring on date header
                          ((string= header "date")
-                          (int-to-string
-                           (-
-                            (/ (car (time-convert (current-time) 1)) 86400)
-                            (/ (car (time-convert (gnus-date-get-time match) 1))
-                               86400))))
+                          (if (or (eq type '<) (eq type '>))
+                              ;; Determine the time difference in days between today
+                              ;; and the article's date
+                              (format-seconds "%d"
+                                              (time-subtract
+                                               (current-time)
+                                               (gnus-date-get-time match)))
+                            (gnus-date-iso8601 match)))
                          (t match)))))
 
     ;; If this is an integer comparison, we transform from string to int.
@@ -909,16 +912,13 @@ gnus-summary-score-entry
       (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)
-			    '>)))))
+    (when (and (string= header "date")
+               (or (eq type '<) (eq type '>)))
+      (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)))
 
     (unless (eq date 'now)
       ;; Add the score entry to the score file.
@@ -1806,7 +1806,7 @@ gnus-score-date
 	   ((eq type 'at)
 	    (setq match-func 'string=
 		  match (gnus-date-iso8601 (nth 0 kill))))
-	   ((eq type 'regexp)
+	   ((or (eq type 'regexp) (eq type 'r))
 	    (setq match-func 'string-match
 		  match (nth 0 kill)))
 	   (t (error "Invalid match type: %s" type)))
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 0b0a9bbfc1d..6097f517be0 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -377,7 +377,7 @@ gnus-date-get-time
   "Convert DATE string to Emacs time.
 Cache the result as a text property stored in DATE."
   ;; Either return the cached value...
-  `(let ((d ,date))
+  `(let ((d (copy-sequence ,date)))
      (if (equal "" d)
 	 0
        (or (get-text-property 0 'gnus-time d)
-- 
2.34.1

-- 
Kuba Ječmínek (http://kubajecminek.cz)






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-09 19:15             ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-09 23:59               ` Eric Abrahamsen
  2024-05-10 20:04                 ` Eric Abrahamsen
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Abrahamsen @ 2024-05-09 23:59 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: 70134, Jakub Ječmínek, eliz, larsi, Richard Stallman

Jakub Ječmínek via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> "Alex Bochannek" <alex@bochannek.com> writes:
>
>> I finally had some time to look at these changes, apologies for the
>> delay.
>
> Thank you very much for your time and all your comments.

Thanks both to Alex for this response, and Jakub for your earlier
explanation of what's going on. I'll try to add some more docstrings
after this is resolved.

>> I like the approach and tested them out. The legal-types change in
>> gnus-summary-increase-score is straightforward and makes sense to me. I
>> have one stylistic comment: (nthcdr 3 s) seems to be easier to read to
>> me than (cdddr s), but I have no strong opinions on that.
>
> Thank you, I used (nthcdr 3 s) instead.
>
>> My suspicion is that this started out as a copy of the integer
>> comparison right above that code and I never cleaned it up. Yes, feel
>> free to simplify, I don't remember any good reason why it needs to pick
>> apart a list. It also seems perfectly fine to remove the (eq type
>> 'after) etc. stuff, it's not necessary anymore.
>
> I've adjusted only the age scoring part (not the integer comparison)
> because I did not studied that part of the code and there's still
> possibility that it is needed somehow.
>
>> The rest of the changes in gnus-summary-score-entry look good. I think
>> some more help text or additional documentation about the defaults would
>> be useful. It gets a bit confusing what you are prompted for. Having
>> said that, I like the idea of pulling a default date from the current
>> message, it just surprised me.
>
> I've added a comment explaining the changes I made to the date
> prompt. If you feel like the code needs more comments, please pinpoint
> where and I will add them.
>
>> I also think I might have found a bug in how the dates are written out
>> to the SCORE file. I interactively increased the score in the order of
>> <, r, n, b, and n as you can see below. Only the b, a, and n entries get
>> converted to the list format with the un-evaluated gnus-time after
>> another entry is written. Meaning the second and third entry below, the
>> "before" and "at," looked just like the topmost "at" entry before the
>> following entry was written.
>
> I've found the reason why it happens and found a solution. The problem
> is in the `gnus-date-get-time' macro. This macro accepts a single
> argument - date - and returns a different one - time - with text
> property added. However, this macro is written in such way that it
> modifies the input argument as well. We can fix it by adding `copy-sequence'
> function to the let form.

This is grim, thanks for finding it. I'm inclined to fix this first in a
stand-alone commit.

>> Hope this is useful!
>
> Very helpful yes.
>
> I've also noticed that the change I proposed - moving the part of the
> code which modifies match variable to the beginning of the
> `gnus-summary-score-entry' function is a bad idea because we're
> modifying input argument to the function. It would mean that if the user
> called the function non interactively (without prompt):
>
> (gnus-summary-score-entry "date" "55" '< 1000 nil)
>
> then it would change "55" to different number based on article age. I've
> moved that code back where it was. I attach the patch below.

Alex has commit access to Emacs -- Alex would you please commit and
close the bug once the two of you are happy with this?





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-09 23:59               ` Eric Abrahamsen
@ 2024-05-10 20:04                 ` Eric Abrahamsen
  2024-05-10 20:38                   ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Abrahamsen @ 2024-05-10 20:04 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: 70134, Jakub Ječmínek, eliz, larsi, Richard Stallman

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Jakub Ječmínek via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> "Alex Bochannek" <alex@bochannek.com> writes:
>>
>>> I finally had some time to look at these changes, apologies for the
>>> delay.
>>
>> Thank you very much for your time and all your comments.
>
> Thanks both to Alex for this response, and Jakub for your earlier
> explanation of what's going on. I'll try to add some more docstrings
> after this is resolved.
>
>>> I like the approach and tested them out. The legal-types change in
>>> gnus-summary-increase-score is straightforward and makes sense to me. I
>>> have one stylistic comment: (nthcdr 3 s) seems to be easier to read to
>>> me than (cdddr s), but I have no strong opinions on that.
>>
>> Thank you, I used (nthcdr 3 s) instead.
>>
>>> My suspicion is that this started out as a copy of the integer
>>> comparison right above that code and I never cleaned it up. Yes, feel
>>> free to simplify, I don't remember any good reason why it needs to pick
>>> apart a list. It also seems perfectly fine to remove the (eq type
>>> 'after) etc. stuff, it's not necessary anymore.
>>
>> I've adjusted only the age scoring part (not the integer comparison)
>> because I did not studied that part of the code and there's still
>> possibility that it is needed somehow.
>>
>>> The rest of the changes in gnus-summary-score-entry look good. I think
>>> some more help text or additional documentation about the defaults would
>>> be useful. It gets a bit confusing what you are prompted for. Having
>>> said that, I like the idea of pulling a default date from the current
>>> message, it just surprised me.
>>
>> I've added a comment explaining the changes I made to the date
>> prompt. If you feel like the code needs more comments, please pinpoint
>> where and I will add them.
>>
>>> I also think I might have found a bug in how the dates are written out
>>> to the SCORE file. I interactively increased the score in the order of
>>> <, r, n, b, and n as you can see below. Only the b, a, and n entries get
>>> converted to the list format with the un-evaluated gnus-time after
>>> another entry is written. Meaning the second and third entry below, the
>>> "before" and "at," looked just like the topmost "at" entry before the
>>> following entry was written.
>>
>> I've found the reason why it happens and found a solution. The problem
>> is in the `gnus-date-get-time' macro. This macro accepts a single
>> argument - date - and returns a different one - time - with text
>> property added. However, this macro is written in such way that it
>> modifies the input argument as well. We can fix it by adding `copy-sequence'
>> function to the let form.
>
> This is grim, thanks for finding it. I'm inclined to fix this first in a
> stand-alone commit.

And sure enough, the modification of the string is the point -- it's a
cache! From gnus-sum.el:

; Since this is called not only to sort the top-level threads, but
; also in recursive sorts to order the articles within a thread, each
; article will be processed many times.  Thus it speeds things up
; quite a bit to use gnus-date-get-time, which caches the time value.
(defun gnus-thread-latest-date (thread)
  "Return the highest article date in THREAD."
  (apply #'max
	 (mapcar (lambda (header) (float-time
				   (gnus-date-get-time
				    (mail-header-date header))))
		 (flatten-tree thread))))

Can we strip properties around the call, maybe?





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-10 20:04                 ` Eric Abrahamsen
@ 2024-05-10 20:38                   ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-10 21:27                     ` Eric Abrahamsen
  2024-05-14  2:00                     ` Alex Bochannek
  0 siblings, 2 replies; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-10 20:38 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Eli Zaretskii, larsi@gnus.org,
	Alex Bochannek, Richard Stallman

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

Apologies for the formatting, I’m writing this reply from my phone.

> And sure enough, the modification of the string is the point -- it's a
> cache! From gnus-sum.el:
>
> ; Since this is called not only to sort the top-level threads, but
> ; also in recursive sorts to order the articles within a thread, each
> ; article will be processed many times. Thus it speeds things up
> ; quite a bit to use gnus-date-get-time, which caches the time value.
> (defun gnus-thread-latest-date (thread)
> "Return the highest article date in THREAD."
> (apply #'max
> (mapcar (lambda (header) (float-time
> (gnus-date-get-time
> (mail-header-date header))))
> (flatten-tree thread))))
>
> Can we strip properties around the call, maybe?

I don’t think there’s need to do that. The change that I proposed in the patch should remove the unintended side effect (and thus fix the bug pointed by Alex) while keeping the caching behaviour intact (‘gnus-thread-latest-date’ code above will work as expected).

[-- Attachment #2: Type: text/html, Size: 1177 bytes --]

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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-10 20:38                   ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-10 21:27                     ` Eric Abrahamsen
  2024-05-14  2:00                     ` Alex Bochannek
  1 sibling, 0 replies; 28+ messages in thread
From: Eric Abrahamsen @ 2024-05-10 21:27 UTC (permalink / raw)
  To: 70134

Jakub Ječmínek via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> Apologies for the formatting, I’m writing this reply from my phone.
>
>> And sure enough, the modification of the string is the point -- it's a
>> cache! From gnus-sum.el:
>>
>> ; Since this is called not only to sort the top-level threads, but
>> ; also in recursive sorts to order the articles within a thread, each
>> ; article will be processed many times. Thus it speeds things up
>> ; quite a bit to use gnus-date-get-time, which caches the time value.
>> (defun gnus-thread-latest-date (thread)
>> "Return the highest article date in THREAD."
>> (apply #'max
>> (mapcar (lambda (header) (float-time
>> (gnus-date-get-time
>> (mail-header-date header))))
>> (flatten-tree thread))))
>>
>> Can we strip properties around the call, maybe?
>
> I don’t think there’s need to do that. The change that I proposed in
> the patch should remove the unintended side effect (and thus fix the
> bug pointed by Alex) while keeping the caching behaviour intact
> (‘gnus-thread-latest-date’ code above will work as expected).

Okay, thanks. I won't mess with it, then.






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-10 20:38                   ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-10 21:27                     ` Eric Abrahamsen
@ 2024-05-14  2:00                     ` Alex Bochannek
  2024-05-14 14:52                       ` Eric Abrahamsen
  1 sibling, 1 reply; 28+ messages in thread
From: Alex Bochannek @ 2024-05-14  2:00 UTC (permalink / raw)
  To: Jakub Ječmínek
  Cc: Eric Abrahamsen, 70134@debbugs.gnu.org, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Jakub,

I see that your changes to gnus-score.el have been committed, but not
the one you proposed to gnus-util.el yet. Let me know if you need me to
test anything!

-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-14  2:00                     ` Alex Bochannek
@ 2024-05-14 14:52                       ` Eric Abrahamsen
  2024-05-14 18:43                         ` Alex Bochannek
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Abrahamsen @ 2024-05-14 14:52 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: 70134@debbugs.gnu.org, Jakub Ječmínek, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Alex Bochannek <alex@bochannek.com> writes:

> Jakub,
>
> I see that your changes to gnus-score.el have been committed, but not
> the one you proposed to gnus-util.el yet. Let me know if you need me to
> test anything!

The commit from February was a different issue in the same area --
nothing from this bug report has been committed yet.

Thanks,
Eric





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-14 14:52                       ` Eric Abrahamsen
@ 2024-05-14 18:43                         ` Alex Bochannek
  2024-05-14 19:57                           ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 28+ messages in thread
From: Alex Bochannek @ 2024-05-14 18:43 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Jakub Ječmínek, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Alex Bochannek <alex@bochannek.com> writes:
>
>> Jakub,
>>
>> I see that your changes to gnus-score.el have been committed, but not
>> the one you proposed to gnus-util.el yet. Let me know if you need me to
>> test anything!
>
> The commit from February was a different issue in the same area --
> nothing from this bug report has been committed yet.

You are absolutely correct, of course, I mistook the log entry and
changes in that commit for what we are discussing here.

I have done some more testing with a fresh build and the most recent
patch works as Jakub intends. I would like to suggest to add a change to
(gnus) Summary Score Commands to include the new match types. Otherwise,
I believe this patch is good to go.

I don't think I have commit rights, by the way (usually larsi or eliz
did them for me), but I would be more than happy to do so if someone can
point me at instructions.

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index c5e4c885ccf..56f259db9a1 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -20093,6 +20093,9 @@ Summary Score Commands
 @item date
 @table @kbd
 
+@item r
+Regexp matching.
+
 @item b
 Before date.
 
@@ -20101,6 +20104,12 @@ Summary Score Commands
 
 @item n
 This date.
+
+@item <
+Less than days.
+
+@item >
+Greater than days.
 @end table
 
 @item number


-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-14 18:43                         ` Alex Bochannek
@ 2024-05-14 19:57                           ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-16 14:15                             ` Eric Abrahamsen
  0 siblings, 1 reply; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-14 19:57 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: Eric Abrahamsen, 70134@debbugs.gnu.org, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

"Alex Bochannek" <alex@bochannek.com> writes:
> I have done some more testing with a fresh build and the most recent
> patch works as Jakub intends. I would like to suggest to add a change to
> (gnus) Summary Score Commands to include the new match types. Otherwise,
> I believe this patch is good to go.

Thank you very much!

> diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
> index c5e4c885ccf..56f259db9a1 100644
> --- a/doc/misc/gnus.texi
> +++ b/doc/misc/gnus.texi
> @@ -20093,6 +20093,9 @@ Summary Score Commands
>  @item date
>  @table @kbd
>
> +@item r
> +Regexp matching.
> +
>  @item b
>  Before date.
>
> @@ -20101,6 +20104,12 @@ Summary Score Commands
>
>  @item n
>  This date.
> +
> +@item <
> +Less than days.
> +
> +@item >
> +Greater than days.
>  @end table
>
>  @item number
>
>
> --

I've applied the patch and added co-authored-by message.

From d69cf006f2e42da61714a179eb48a345a082fcf9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
Date: Thu, 9 May 2024 20:33:58 +0200
Subject: [PATCH] Show all date options when adding Gnus scores interactively

* lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
'char-to-type' variable to 'char-to-types' and bind all legal types
for date header.

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
default values for each scoring type and cast 'match' to number only
if necessary.

Co-authored-by: Alex Bochannek <alex@bochannek.com>
---
 doc/misc/gnus.texi      |  9 ++++++++
 lisp/gnus/gnus-score.el | 46 ++++++++++++++++++++---------------------
 lisp/gnus/gnus-util.el  |  2 +-
 3 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index c5e4c885ccf..56f259db9a1 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -20093,6 +20093,9 @@ Summary Score Commands
 @item date
 @table @kbd
 
+@item r
+Regexp matching.
+
 @item b
 Before date.
 
@@ -20101,6 +20104,12 @@ Summary Score Commands
 
 @item n
 This date.
+
+@item <
+Less than days.
+
+@item >
+Greater than days.
 @end table
 
 @item number
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 479b7496cf1..4e9e0083424 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -593,18 +593,18 @@ gnus-summary-increase-score
 	    (?d "date" nil nil date)
 	    (?f "followup" nil nil string)
 	    (?t "thread" "message-id" nil string)))
-	 (char-to-type
+	 (char-to-types
 	  '((?s s "substring" string)
 	    (?e e "exact string" string)
 	    (?f f "fuzzy string" string)
-	    (?r r "regexp string" string)
+	    (?r r "regexp string" string date)
 	    (?z s "substring" body-string)
 	    (?p r "regexp string" body-string)
 	    (?b before "before date" date)
 	    (?a after "after date" date)
 	    (?n at "this date" date)
-	    (?< < "less than number" number)
-	    (?> > "greater than number" number)
+	    (?< < "less than number" number date)
+	    (?> > "greater than number" number date)
 	    (?= = "equal to number" number)))
 	 (current-score-file gnus-current-score-file)
 	 (char-to-perm
@@ -652,10 +652,9 @@ gnus-summary-increase-score
 	  (let ((legal-types
 		 (delq nil
 		       (mapcar (lambda (s)
-				 (if (eq (nth 4 entry)
-					 (nth 3 s))
+				 (if (member (nth 4 entry) (nthcdr 3 s))
 				     s nil))
-			       char-to-type))))
+			       char-to-types))))
             (setq header-string
                   (format "%s header `%s' with match type (%s?): "
 			  (if increase "Increase" "Lower")
@@ -894,12 +893,16 @@ gnus-summary-score-entry
 			   header
 			   (if (< score 0) "lower" "raise"))
                    (cond ((numberp match) (int-to-string match))
+                         ;; Provide better defaults if we're scoring on date header
                          ((string= header "date")
-                          (int-to-string
-                           (-
-                            (/ (car (time-convert (current-time) 1)) 86400)
-                            (/ (car (time-convert (gnus-date-get-time match) 1))
-                               86400))))
+                          (if (or (eq type '<) (eq type '>))
+                              ;; Determine the time difference in days between today
+                              ;; and the article's date
+                              (format-seconds "%d"
+                                              (time-subtract
+                                               (current-time)
+                                               (gnus-date-get-time match)))
+                            (gnus-date-iso8601 match)))
                          (t match)))))
 
     ;; If this is an integer comparison, we transform from string to int.
@@ -909,16 +912,13 @@ gnus-summary-score-entry
       (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)
-			    '>)))))
+    (when (and (string= header "date")
+               (or (eq type '<) (eq type '>)))
+      (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)))
 
     (unless (eq date 'now)
       ;; Add the score entry to the score file.
@@ -1806,7 +1806,7 @@ gnus-score-date
 	   ((eq type 'at)
 	    (setq match-func 'string=
 		  match (gnus-date-iso8601 (nth 0 kill))))
-	   ((eq type 'regexp)
+	   ((or (eq type 'regexp) (eq type 'r))
 	    (setq match-func 'string-match
 		  match (nth 0 kill)))
 	   (t (error "Invalid match type: %s" type)))
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 0b0a9bbfc1d..6097f517be0 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -377,7 +377,7 @@ gnus-date-get-time
   "Convert DATE string to Emacs time.
 Cache the result as a text property stored in DATE."
   ;; Either return the cached value...
-  `(let ((d ,date))
+  `(let ((d (copy-sequence ,date)))
      (if (equal "" d)
 	 0
        (or (get-text-property 0 'gnus-time d)
-- 
2.34.1

Best

-- 
Kuba Ječmínek (http://kubajecminek.cz)






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-14 19:57                           ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-16 14:15                             ` Eric Abrahamsen
  2024-05-16 19:40                               ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Abrahamsen @ 2024-05-16 14:15 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: 70134@debbugs.gnu.org, Jakub Ječmínek, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Jakub Ječmínek via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> "Alex Bochannek" <alex@bochannek.com> writes:
>> I have done some more testing with a fresh build and the most recent
>> patch works as Jakub intends. I would like to suggest to add a change to
>> (gnus) Summary Score Commands to include the new match types. Otherwise,
>> I believe this patch is good to go.
>
> Thank you very much!
>
>> diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
>> index c5e4c885ccf..56f259db9a1 100644
>> --- a/doc/misc/gnus.texi
>> +++ b/doc/misc/gnus.texi
>> @@ -20093,6 +20093,9 @@ Summary Score Commands
>>  @item date
>>  @table @kbd
>>
>> +@item r
>> +Regexp matching.
>> +
>>  @item b
>>  Before date.
>>
>> @@ -20101,6 +20104,12 @@ Summary Score Commands
>>
>>  @item n
>>  This date.
>> +
>> +@item <
>> +Less than days.
>> +
>> +@item >
>> +Greater than days.
>>  @end table
>>
>>  @item number
>>
>>
>> --
>
> I've applied the patch and added co-authored-by message.
>
> From d69cf006f2e42da61714a179eb48a345a082fcf9 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
> Date: Thu, 9 May 2024 20:33:58 +0200
> Subject: [PATCH] Show all date options when adding Gnus scores interactively
>
> * lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
> 'char-to-type' variable to 'char-to-types' and bind all legal types
> for date header.
>
> * lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
> default values for each scoring type and cast 'match' to number only
> if necessary.
>
> Co-authored-by: Alex Bochannek <alex@bochannek.com>
> ---
>  doc/misc/gnus.texi      |  9 ++++++++
>  lisp/gnus/gnus-score.el | 46 ++++++++++++++++++++---------------------
>  lisp/gnus/gnus-util.el  |  2 +-
>  3 files changed, 33 insertions(+), 24 deletions(-)
>
> diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
> index c5e4c885ccf..56f259db9a1 100644
> --- a/doc/misc/gnus.texi
> +++ b/doc/misc/gnus.texi
> @@ -20093,6 +20093,9 @@ Summary Score Commands
>  @item date
>  @table @kbd
>  
> +@item r
> +Regexp matching.
> +
>  @item b
>  Before date.
>  
> @@ -20101,6 +20104,12 @@ Summary Score Commands
>  
>  @item n
>  This date.
> +
> +@item <
> +Less than days.
> +
> +@item >
> +Greater than days.
>  @end table
>  
>  @item number
> diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
> index 479b7496cf1..4e9e0083424 100644
> --- a/lisp/gnus/gnus-score.el
> +++ b/lisp/gnus/gnus-score.el
> @@ -593,18 +593,18 @@ gnus-summary-increase-score
>  	    (?d "date" nil nil date)
>  	    (?f "followup" nil nil string)
>  	    (?t "thread" "message-id" nil string)))
> -	 (char-to-type
> +	 (char-to-types
>  	  '((?s s "substring" string)
>  	    (?e e "exact string" string)
>  	    (?f f "fuzzy string" string)
> -	    (?r r "regexp string" string)
> +	    (?r r "regexp string" string date)
>  	    (?z s "substring" body-string)
>  	    (?p r "regexp string" body-string)
>  	    (?b before "before date" date)
>  	    (?a after "after date" date)
>  	    (?n at "this date" date)
> -	    (?< < "less than number" number)
> -	    (?> > "greater than number" number)
> +	    (?< < "less than number" number date)
> +	    (?> > "greater than number" number date)
>  	    (?= = "equal to number" number)))
>  	 (current-score-file gnus-current-score-file)
>  	 (char-to-perm
> @@ -652,10 +652,9 @@ gnus-summary-increase-score
>  	  (let ((legal-types
>  		 (delq nil
>  		       (mapcar (lambda (s)
> -				 (if (eq (nth 4 entry)
> -					 (nth 3 s))
> +				 (if (member (nth 4 entry) (nthcdr 3 s))
>  				     s nil))
> -			       char-to-type))))
> +			       char-to-types))))
>              (setq header-string
>                    (format "%s header `%s' with match type (%s?): "
>  			  (if increase "Increase" "Lower")
> @@ -894,12 +893,16 @@ gnus-summary-score-entry
>  			   header
>  			   (if (< score 0) "lower" "raise"))
>                     (cond ((numberp match) (int-to-string match))
> +                         ;; Provide better defaults if we're scoring on date header
>                           ((string= header "date")
> -                          (int-to-string
> -                           (-
> -                            (/ (car (time-convert (current-time) 1)) 86400)
> -                            (/ (car (time-convert (gnus-date-get-time match) 1))
> -                               86400))))
> +                          (if (or (eq type '<) (eq type '>))
> +                              ;; Determine the time difference in days between today
> +                              ;; and the article's date
> +                              (format-seconds "%d"
> +                                              (time-subtract
> +                                               (current-time)
> +                                               (gnus-date-get-time match)))
> +                            (gnus-date-iso8601 match)))
>                           (t match)))))
>  
>      ;; If this is an integer comparison, we transform from string to int.
> @@ -909,16 +912,13 @@ gnus-summary-score-entry
>        (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)
> -			    '>)))))
> +    (when (and (string= header "date")
> +               (or (eq type '<) (eq type '>)))
> +      (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)))
>  
>      (unless (eq date 'now)
>        ;; Add the score entry to the score file.
> @@ -1806,7 +1806,7 @@ gnus-score-date
>  	   ((eq type 'at)
>  	    (setq match-func 'string=
>  		  match (gnus-date-iso8601 (nth 0 kill))))
> -	   ((eq type 'regexp)
> +	   ((or (eq type 'regexp) (eq type 'r))
>  	    (setq match-func 'string-match
>  		  match (nth 0 kill)))
>  	   (t (error "Invalid match type: %s" type)))
> diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
> index 0b0a9bbfc1d..6097f517be0 100644
> --- a/lisp/gnus/gnus-util.el
> +++ b/lisp/gnus/gnus-util.el
> @@ -377,7 +377,7 @@ gnus-date-get-time
>    "Convert DATE string to Emacs time.
>  Cache the result as a text property stored in DATE."
>    ;; Either return the cached value...
> -  `(let ((d ,date))
> +  `(let ((d (copy-sequence ,date)))

My previous message about this macro still stands, though -- this change
would break other code's use of the macro as a "cache". Is there another
way to resolve the problem?





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-16 14:15                             ` Eric Abrahamsen
@ 2024-05-16 19:40                               ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-16 19:40 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Eli Zaretskii, larsi@gnus.org,
	Alex Bochannek, Richard Stallman

"Eric Abrahamsen" <eric@ericabrahamsen.net> writes:

> My previous message about this macro still stands, though -- this change
> would break other code's use of the macro as a "cache". Is there another
> way to resolve the problem?

Oh, shoot, I realized the mistake only when I wrote the ert tests as a
response to this message. I stand corrected, I'm sorry. I have to think about other
ways how to resolve the bug, though... I'm sending the patch without the
macro change:

From e281f37263ca6b307df9ca124d7d3121d86a2b11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
Date: Thu, 16 May 2024 21:38:01 +0200
Subject: [PATCH] Show all date options when adding Gnus scores interactively

* lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
'char-to-type' variable to 'char-to-types' and bind all legal types
for date header.

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
default values for each scoring type and cast 'match' to number only
if necessary.

Co-authored-by: Alex Bochannek <alex@bochannek.com>
---
 doc/misc/gnus.texi      |  9 ++++++++
 lisp/gnus/gnus-score.el | 46 ++++++++++++++++++++---------------------
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index c5e4c885ccf..56f259db9a1 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -20093,6 +20093,9 @@ Summary Score Commands
 @item date
 @table @kbd
 
+@item r
+Regexp matching.
+
 @item b
 Before date.
 
@@ -20101,6 +20104,12 @@ Summary Score Commands
 
 @item n
 This date.
+
+@item <
+Less than days.
+
+@item >
+Greater than days.
 @end table
 
 @item number
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 479b7496cf1..4e9e0083424 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -593,18 +593,18 @@ gnus-summary-increase-score
 	    (?d "date" nil nil date)
 	    (?f "followup" nil nil string)
 	    (?t "thread" "message-id" nil string)))
-	 (char-to-type
+	 (char-to-types
 	  '((?s s "substring" string)
 	    (?e e "exact string" string)
 	    (?f f "fuzzy string" string)
-	    (?r r "regexp string" string)
+	    (?r r "regexp string" string date)
 	    (?z s "substring" body-string)
 	    (?p r "regexp string" body-string)
 	    (?b before "before date" date)
 	    (?a after "after date" date)
 	    (?n at "this date" date)
-	    (?< < "less than number" number)
-	    (?> > "greater than number" number)
+	    (?< < "less than number" number date)
+	    (?> > "greater than number" number date)
 	    (?= = "equal to number" number)))
 	 (current-score-file gnus-current-score-file)
 	 (char-to-perm
@@ -652,10 +652,9 @@ gnus-summary-increase-score
 	  (let ((legal-types
 		 (delq nil
 		       (mapcar (lambda (s)
-				 (if (eq (nth 4 entry)
-					 (nth 3 s))
+				 (if (member (nth 4 entry) (nthcdr 3 s))
 				     s nil))
-			       char-to-type))))
+			       char-to-types))))
             (setq header-string
                   (format "%s header `%s' with match type (%s?): "
 			  (if increase "Increase" "Lower")
@@ -894,12 +893,16 @@ gnus-summary-score-entry
 			   header
 			   (if (< score 0) "lower" "raise"))
                    (cond ((numberp match) (int-to-string match))
+                         ;; Provide better defaults if we're scoring on date header
                          ((string= header "date")
-                          (int-to-string
-                           (-
-                            (/ (car (time-convert (current-time) 1)) 86400)
-                            (/ (car (time-convert (gnus-date-get-time match) 1))
-                               86400))))
+                          (if (or (eq type '<) (eq type '>))
+                              ;; Determine the time difference in days between today
+                              ;; and the article's date
+                              (format-seconds "%d"
+                                              (time-subtract
+                                               (current-time)
+                                               (gnus-date-get-time match)))
+                            (gnus-date-iso8601 match)))
                          (t match)))))
 
     ;; If this is an integer comparison, we transform from string to int.
@@ -909,16 +912,13 @@ gnus-summary-score-entry
       (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)
-			    '>)))))
+    (when (and (string= header "date")
+               (or (eq type '<) (eq type '>)))
+      (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)))
 
     (unless (eq date 'now)
       ;; Add the score entry to the score file.
@@ -1806,7 +1806,7 @@ gnus-score-date
 	   ((eq type 'at)
 	    (setq match-func 'string=
 		  match (gnus-date-iso8601 (nth 0 kill))))
-	   ((eq type 'regexp)
+	   ((or (eq type 'regexp) (eq type 'r))
 	    (setq match-func 'string-match
 		  match (nth 0 kill)))
 	   (t (error "Invalid match type: %s" type)))
-- 
2.34.1

-- 
Kuba Ječmínek (http://kubajecminek.cz)






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-01 21:44 bug#70134: [PATCH] Show all date options when adding Gnus scores interactively Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-13  7:58 ` Eli Zaretskii
@ 2024-05-22 21:34 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-22 23:30   ` Alex Bochannek
  2024-05-26 22:09 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-22 21:34 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Eli Zaretskii, larsi@gnus.org,
	Alex Bochannek, Richard Stallman

Ping :).  Is there anything else that needs to be resolved before this is
installed?  We can create different subtask for the bug that Alex pointed
out.






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-22 21:34 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-22 23:30   ` Alex Bochannek
  2024-05-23  2:50     ` Eric Abrahamsen
  0 siblings, 1 reply; 28+ messages in thread
From: Alex Bochannek @ 2024-05-22 23:30 UTC (permalink / raw)
  To: Jakub Ječmínek
  Cc: Eric Abrahamsen, 70134@debbugs.gnu.org, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Jakub,

Jakub Ječmínek <kuba@kubajecminek.cz> writes:

> Ping :).  Is there anything else that needs to be resolved before this is
> installed?  We can create different subtask for the bug that Alex pointed
> out.

I did some testing again and the functionality you describe works
perfectly fine. I still would prefer the bug I pointed out to be fixed
before merging.

My concern is that with the change applied, adding a new date-header
scoring rule interactively will rewrite some existing date rules in the
SCORE file. Expectedly not just entries created interactively, but any
entries in the list regardless of how they were created. In my testing,
I found this to be the case for all entries that are not using the new
match types for dates (i.e, for `before', `after', and `at', not for
`r', `<', or `>'.)

I am perfectly happy to be overruled, I just think it will be confusing
to the users. If however a patch for this is forthcoming quickly, I am
OK with merging it.

-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-22 23:30   ` Alex Bochannek
@ 2024-05-23  2:50     ` Eric Abrahamsen
  2024-05-26 14:22       ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Abrahamsen @ 2024-05-23  2:50 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: 70134@debbugs.gnu.org, Jakub Ječmínek, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Alex Bochannek <alex@bochannek.com> writes:

> Jakub,
>
> Jakub Ječmínek <kuba@kubajecminek.cz> writes:
>
>> Ping :).  Is there anything else that needs to be resolved before this is
>> installed?  We can create different subtask for the bug that Alex pointed
>> out.
>
> I did some testing again and the functionality you describe works
> perfectly fine. I still would prefer the bug I pointed out to be fixed
> before merging.
>
> My concern is that with the change applied, adding a new date-header
> scoring rule interactively will rewrite some existing date rules in the
> SCORE file. Expectedly not just entries created interactively, but any
> entries in the list regardless of how they were created. In my testing,
> I found this to be the case for all entries that are not using the new
> match types for dates (i.e, for `before', `after', and `at', not for
> `r', `<', or `>'.)
>
> I am perfectly happy to be overruled, I just think it will be confusing
> to the users. If however a patch for this is forthcoming quickly, I am
> OK with merging it.

Can we maybe hoist the `copy-sequence` up into the caller, to get a
similar effect?





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-23  2:50     ` Eric Abrahamsen
@ 2024-05-26 14:22       ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-26 14:22 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Eli Zaretskii, larsi@gnus.org,
	Alex Bochannek, Richard Stallman

"Eric Abrahamsen" <eric@ericabrahamsen.net> writes:

> Can we maybe hoist the `copy-sequence` up into the caller, to get a
> similar effect?

We can strip the text properties right before the end of
`gnus-score-date' function.  What do you think?


-- 
Kuba Ječmínek (http://kubajecminek.cz)






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-01 21:44 bug#70134: [PATCH] Show all date options when adding Gnus scores interactively Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-13  7:58 ` Eli Zaretskii
  2024-05-22 21:34 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-26 22:09 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-29 21:23 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-08-07 20:22 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  4 siblings, 0 replies; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-26 22:09 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Eli Zaretskii, larsi@gnus.org,
	Alex Bochannek, Richard Stallman

Jakub Ječmínek <kuba@kubajecminek.cz> writes:

> "Eric Abrahamsen" <eric@ericabrahamsen.net> writes:
>
>> Can we maybe hoist the `copy-sequence` up into the caller, to get a
>> similar effect?
>
> We can strip the text properties right before the end of
> `gnus-score-date' function.  What do you think?

Oops, forgot to attach a patch.

From 2a8081c9a7b3d6ce6842f3559d15a8f1b7872b83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
Date: Thu, 16 May 2024 21:38:01 +0200
Subject: [PATCH] Show all date options when adding Gnus scores interactively

* lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
'char-to-type' variable to 'char-to-types' and bind all legal types
for date header.

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
default values for each scoring type and cast 'match' to number only
if necessary.

Co-authored-by: Alex Bochannek <alex@bochannek.com>
---
 doc/misc/gnus.texi      |  9 ++++++++
 lisp/gnus/gnus-score.el | 48 +++++++++++++++++++++--------------------
 2 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index c5e4c885ccf..56f259db9a1 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -20093,6 +20093,9 @@ Summary Score Commands
 @item date
 @table @kbd
 
+@item r
+Regexp matching.
+
 @item b
 Before date.
 
@@ -20101,6 +20104,12 @@ Summary Score Commands
 
 @item n
 This date.
+
+@item <
+Less than days.
+
+@item >
+Greater than days.
 @end table
 
 @item number
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 479b7496cf1..31ce1328e37 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -593,18 +593,18 @@ gnus-summary-increase-score
 	    (?d "date" nil nil date)
 	    (?f "followup" nil nil string)
 	    (?t "thread" "message-id" nil string)))
-	 (char-to-type
+	 (char-to-types
 	  '((?s s "substring" string)
 	    (?e e "exact string" string)
 	    (?f f "fuzzy string" string)
-	    (?r r "regexp string" string)
+	    (?r r "regexp string" string date)
 	    (?z s "substring" body-string)
 	    (?p r "regexp string" body-string)
 	    (?b before "before date" date)
 	    (?a after "after date" date)
 	    (?n at "this date" date)
-	    (?< < "less than number" number)
-	    (?> > "greater than number" number)
+	    (?< < "less than number" number date)
+	    (?> > "greater than number" number date)
 	    (?= = "equal to number" number)))
 	 (current-score-file gnus-current-score-file)
 	 (char-to-perm
@@ -652,10 +652,9 @@ gnus-summary-increase-score
 	  (let ((legal-types
 		 (delq nil
 		       (mapcar (lambda (s)
-				 (if (eq (nth 4 entry)
-					 (nth 3 s))
+				 (if (member (nth 4 entry) (nthcdr 3 s))
 				     s nil))
-			       char-to-type))))
+			       char-to-types))))
             (setq header-string
                   (format "%s header `%s' with match type (%s?): "
 			  (if increase "Increase" "Lower")
@@ -894,12 +893,16 @@ gnus-summary-score-entry
 			   header
 			   (if (< score 0) "lower" "raise"))
                    (cond ((numberp match) (int-to-string match))
+                         ;; Provide better defaults if we're scoring on date header
                          ((string= header "date")
-                          (int-to-string
-                           (-
-                            (/ (car (time-convert (current-time) 1)) 86400)
-                            (/ (car (time-convert (gnus-date-get-time match) 1))
-                               86400))))
+                          (if (or (eq type '<) (eq type '>))
+                              ;; Determine the time difference in days between today
+                              ;; and the article's date
+                              (format-seconds "%d"
+                                              (time-subtract
+                                               (current-time)
+                                               (gnus-date-get-time match)))
+                            (gnus-date-iso8601 match)))
                          (t match)))))
 
     ;; If this is an integer comparison, we transform from string to int.
@@ -909,16 +912,13 @@ gnus-summary-score-entry
       (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)
-			    '>)))))
+    (when (and (string= header "date")
+               (or (eq type '<) (eq type '>)))
+      (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)))
 
     (unless (eq date 'now)
       ;; Add the score entry to the score file.
@@ -1806,7 +1806,7 @@ gnus-score-date
 	   ((eq type 'at)
 	    (setq match-func 'string=
 		  match (gnus-date-iso8601 (nth 0 kill))))
-	   ((eq type 'regexp)
+	   ((or (eq type 'regexp) (eq type 'r))
 	    (setq match-func 'string-match
 		  match (nth 0 kill)))
 	   (t (error "Invalid match type: %s" type)))
@@ -1833,6 +1833,8 @@ gnus-score-date
 		 (gnus-score-set 'touched '(t) alist)
 		 (setcdr entries (cdr rest))
 		 (setq rest entries)))
+          (when (stringp (nth 0 kill))
+            (set-text-properties 0 1 nil (nth 0 kill)))
 	  (setq entries rest)))))
   nil)
 
-- 
2.34.1








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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-01 21:44 bug#70134: [PATCH] Show all date options when adding Gnus scores interactively Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (2 preceding siblings ...)
  2024-05-26 22:09 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-29 21:23 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-30  0:16   ` Alex Bochannek
  2024-08-07 20:22 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  4 siblings, 1 reply; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-29 21:23 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: 70134@debbugs.gnu.org, Eli Zaretskii, larsi@gnus.org,
	Alex Bochannek, Richard Stallman

Ping.


Jakub Ječmínek <kuba@kubajecminek.cz> writes:

> Jakub Ječmínek <kuba@kubajecminek.cz> writes:
>
>> "Eric Abrahamsen" <eric@ericabrahamsen.net> writes:
>>
>>> Can we maybe hoist the `copy-sequence` up into the caller, to get a
>>> similar effect?
>>
>> We can strip the text properties right before the end of
>> `gnus-score-date' function.  What do you think?
>
> Oops, forgot to attach a patch.
>
>>From 2a8081c9a7b3d6ce6842f3559d15a8f1b7872b83 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
> Date: Thu, 16 May 2024 21:38:01 +0200
> Subject: [PATCH] Show all date options when adding Gnus scores interactively
>
> * lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
> 'char-to-type' variable to 'char-to-types' and bind all legal types
> for date header.
>
> * lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
> default values for each scoring type and cast 'match' to number only
> if necessary.
>
> Co-authored-by: Alex Bochannek <alex@bochannek.com>
> ---
>  doc/misc/gnus.texi      |  9 ++++++++
>  lisp/gnus/gnus-score.el | 48 +++++++++++++++++++++--------------------
>  2 files changed, 34 insertions(+), 23 deletions(-)
>
> diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
> index c5e4c885ccf..56f259db9a1 100644
> --- a/doc/misc/gnus.texi
> +++ b/doc/misc/gnus.texi
> @@ -20093,6 +20093,9 @@ Summary Score Commands
>  @item date
>  @table @kbd
>  
> +@item r
> +Regexp matching.
> +
>  @item b
>  Before date.
>  
> @@ -20101,6 +20104,12 @@ Summary Score Commands
>  
>  @item n
>  This date.
> +
> +@item <
> +Less than days.
> +
> +@item >
> +Greater than days.
>  @end table
>  
>  @item number
> diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
> index 479b7496cf1..31ce1328e37 100644
> --- a/lisp/gnus/gnus-score.el
> +++ b/lisp/gnus/gnus-score.el
> @@ -593,18 +593,18 @@ gnus-summary-increase-score
>  	    (?d "date" nil nil date)
>  	    (?f "followup" nil nil string)
>  	    (?t "thread" "message-id" nil string)))
> -	 (char-to-type
> +	 (char-to-types
>  	  '((?s s "substring" string)
>  	    (?e e "exact string" string)
>  	    (?f f "fuzzy string" string)
> -	    (?r r "regexp string" string)
> +	    (?r r "regexp string" string date)
>  	    (?z s "substring" body-string)
>  	    (?p r "regexp string" body-string)
>  	    (?b before "before date" date)
>  	    (?a after "after date" date)
>  	    (?n at "this date" date)
> -	    (?< < "less than number" number)
> -	    (?> > "greater than number" number)
> +	    (?< < "less than number" number date)
> +	    (?> > "greater than number" number date)
>  	    (?= = "equal to number" number)))
>  	 (current-score-file gnus-current-score-file)
>  	 (char-to-perm
> @@ -652,10 +652,9 @@ gnus-summary-increase-score
>  	  (let ((legal-types
>  		 (delq nil
>  		       (mapcar (lambda (s)
> -				 (if (eq (nth 4 entry)
> -					 (nth 3 s))
> +				 (if (member (nth 4 entry) (nthcdr 3 s))
>  				     s nil))
> -			       char-to-type))))
> +			       char-to-types))))
>              (setq header-string
>                    (format "%s header `%s' with match type (%s?): "
>  			  (if increase "Increase" "Lower")
> @@ -894,12 +893,16 @@ gnus-summary-score-entry
>  			   header
>  			   (if (< score 0) "lower" "raise"))
>                     (cond ((numberp match) (int-to-string match))
> +                         ;; Provide better defaults if we're scoring on date header
>                           ((string= header "date")
> -                          (int-to-string
> -                           (-
> -                            (/ (car (time-convert (current-time) 1)) 86400)
> -                            (/ (car (time-convert (gnus-date-get-time match) 1))
> -                               86400))))
> +                          (if (or (eq type '<) (eq type '>))
> +                              ;; Determine the time difference in days between today
> +                              ;; and the article's date
> +                              (format-seconds "%d"
> +                                              (time-subtract
> +                                               (current-time)
> +                                               (gnus-date-get-time match)))
> +                            (gnus-date-iso8601 match)))
>                           (t match)))))
>  
>      ;; If this is an integer comparison, we transform from string to int.
> @@ -909,16 +912,13 @@ gnus-summary-score-entry
>        (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)
> -			    '>)))))
> +    (when (and (string= header "date")
> +               (or (eq type '<) (eq type '>)))
> +      (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)))
>  
>      (unless (eq date 'now)
>        ;; Add the score entry to the score file.
> @@ -1806,7 +1806,7 @@ gnus-score-date
>  	   ((eq type 'at)
>  	    (setq match-func 'string=
>  		  match (gnus-date-iso8601 (nth 0 kill))))
> -	   ((eq type 'regexp)
> +	   ((or (eq type 'regexp) (eq type 'r))
>  	    (setq match-func 'string-match
>  		  match (nth 0 kill)))
>  	   (t (error "Invalid match type: %s" type)))
> @@ -1833,6 +1833,8 @@ gnus-score-date
>  		 (gnus-score-set 'touched '(t) alist)
>  		 (setcdr entries (cdr rest))
>  		 (setq rest entries)))
> +          (when (stringp (nth 0 kill))
> +            (set-text-properties 0 1 nil (nth 0 kill)))
>  	  (setq entries rest)))))
>    nil)






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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-29 21:23 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-30  0:16   ` Alex Bochannek
  2024-05-30  9:01     ` Andrea Corallo
  0 siblings, 1 reply; 28+ messages in thread
From: Alex Bochannek @ 2024-05-30  0:16 UTC (permalink / raw)
  To: Jakub Ječmínek
  Cc: Eric Abrahamsen, 70134@debbugs.gnu.org, Eli Zaretskii,
	larsi@gnus.org, Richard Stallman

Jakub,

Jakub Ječmínek <kuba@kubajecminek.cz> writes:

> Ping.
>
> Jakub Ječmínek <kuba@kubajecminek.cz> writes:
>
>> Oops, forgot to attach a patch.

Tested it again against top-of-tree and this patch resolves the previous
issue. I think it's ready to merge!

I am curious if you think adding support of the `=' match type for the
date header makes sense? As I was testing this change, I found myself
reaching for that, but I am not entirely convinced it's actually a
useful feature. Either way, please don't hold up this change for that.

As I mentioned before, I would be happy to merge if someone points me at
instructions. In the past, eliz and larsi have merged changes I have
submitted.

>>>From 2a8081c9a7b3d6ce6842f3559d15a8f1b7872b83 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <kuba@kubajecminek.cz>
>> Date: Thu, 16 May 2024 21:38:01 +0200
>> Subject: [PATCH] Show all date options when adding Gnus scores interactively
>>
>> * lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
>> 'char-to-type' variable to 'char-to-types' and bind all legal types
>> for date header.
>>
>> * lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
>> default values for each scoring type and cast 'match' to number only
>> if necessary.
>>
>> Co-authored-by: Alex Bochannek <alex@bochannek.com>
>> ---
>>  doc/misc/gnus.texi      |  9 ++++++++
>>  lisp/gnus/gnus-score.el | 48 +++++++++++++++++++++--------------------
>>  2 files changed, 34 insertions(+), 23 deletions(-)
>>
>> diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
>> index c5e4c885ccf..56f259db9a1 100644
>> --- a/doc/misc/gnus.texi
>> +++ b/doc/misc/gnus.texi
>> @@ -20093,6 +20093,9 @@ Summary Score Commands
>>  @item date
>>  @table @kbd
>>  
>> +@item r
>> +Regexp matching.
>> +
>>  @item b
>>  Before date.
>>  
>> @@ -20101,6 +20104,12 @@ Summary Score Commands
>>  
>>  @item n
>>  This date.
>> +
>> +@item <
>> +Less than days.
>> +
>> +@item >
>> +Greater than days.
>>  @end table
>>  
>>  @item number
>> diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
>> index 479b7496cf1..31ce1328e37 100644
>> --- a/lisp/gnus/gnus-score.el
>> +++ b/lisp/gnus/gnus-score.el
>> @@ -593,18 +593,18 @@ gnus-summary-increase-score
>>  	    (?d "date" nil nil date)
>>  	    (?f "followup" nil nil string)
>>  	    (?t "thread" "message-id" nil string)))
>> -	 (char-to-type
>> +	 (char-to-types
>>  	  '((?s s "substring" string)
>>  	    (?e e "exact string" string)
>>  	    (?f f "fuzzy string" string)
>> -	    (?r r "regexp string" string)
>> +	    (?r r "regexp string" string date)
>>  	    (?z s "substring" body-string)
>>  	    (?p r "regexp string" body-string)
>>  	    (?b before "before date" date)
>>  	    (?a after "after date" date)
>>  	    (?n at "this date" date)
>> -	    (?< < "less than number" number)
>> -	    (?> > "greater than number" number)
>> +	    (?< < "less than number" number date)
>> +	    (?> > "greater than number" number date)
>>  	    (?= = "equal to number" number)))
>>  	 (current-score-file gnus-current-score-file)
>>  	 (char-to-perm
>> @@ -652,10 +652,9 @@ gnus-summary-increase-score
>>  	  (let ((legal-types
>>  		 (delq nil
>>  		       (mapcar (lambda (s)
>> -				 (if (eq (nth 4 entry)
>> -					 (nth 3 s))
>> +				 (if (member (nth 4 entry) (nthcdr 3 s))
>>  				     s nil))
>> -			       char-to-type))))
>> +			       char-to-types))))
>>              (setq header-string
>>                    (format "%s header `%s' with match type (%s?): "
>>  			  (if increase "Increase" "Lower")
>> @@ -894,12 +893,16 @@ gnus-summary-score-entry
>>  			   header
>>  			   (if (< score 0) "lower" "raise"))
>>                     (cond ((numberp match) (int-to-string match))
>> +                         ;; Provide better defaults if we're scoring on date header
>>                           ((string= header "date")
>> -                          (int-to-string
>> -                           (-
>> -                            (/ (car (time-convert (current-time) 1)) 86400)
>> -                            (/ (car (time-convert (gnus-date-get-time match) 1))
>> -                               86400))))
>> +                          (if (or (eq type '<) (eq type '>))
>> +                              ;; Determine the time difference in days between today
>> +                              ;; and the article's date
>> +                              (format-seconds "%d"
>> +                                              (time-subtract
>> +                                               (current-time)
>> +                                               (gnus-date-get-time match)))
>> +                            (gnus-date-iso8601 match)))
>>                           (t match)))))
>>  
>>      ;; If this is an integer comparison, we transform from string to int.
>> @@ -909,16 +912,13 @@ gnus-summary-score-entry
>>        (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)
>> -			    '>)))))
>> +    (when (and (string= header "date")
>> +               (or (eq type '<) (eq type '>)))
>> +      (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)))
>>  
>>      (unless (eq date 'now)
>>        ;; Add the score entry to the score file.
>> @@ -1806,7 +1806,7 @@ gnus-score-date
>>  	   ((eq type 'at)
>>  	    (setq match-func 'string=
>>  		  match (gnus-date-iso8601 (nth 0 kill))))
>> -	   ((eq type 'regexp)
>> +	   ((or (eq type 'regexp) (eq type 'r))
>>  	    (setq match-func 'string-match
>>  		  match (nth 0 kill)))
>>  	   (t (error "Invalid match type: %s" type)))
>> @@ -1833,6 +1833,8 @@ gnus-score-date
>>  		 (gnus-score-set 'touched '(t) alist)
>>  		 (setcdr entries (cdr rest))
>>  		 (setq rest entries)))
>> +          (when (stringp (nth 0 kill))
>> +            (set-text-properties 0 1 nil (nth 0 kill)))
>>  	  (setq entries rest)))))
>>    nil)
>

-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-30  0:16   ` Alex Bochannek
@ 2024-05-30  9:01     ` Andrea Corallo
  2024-05-30 16:30       ` Alex Bochannek
  0 siblings, 1 reply; 28+ messages in thread
From: Andrea Corallo @ 2024-05-30  9:01 UTC (permalink / raw)
  To: Alex Bochannek
  Cc: 70134-done@debbugs.gnu.org, Richard Stallman, Eric Abrahamsen,
	Jakub Ječmínek, larsi@gnus.org, Eli Zaretskii

Alex Bochannek <alex@bochannek.com> writes:

> Jakub,
>
> Jakub Ječmínek <kuba@kubajecminek.cz> writes:
>
>> Ping.
>>
>> Jakub Ječmínek <kuba@kubajecminek.cz> writes:
>>
>>> Oops, forgot to attach a patch.
>
> Tested it again against top-of-tree and this patch resolves the previous
> issue. I think it's ready to merge!
>
> I am curious if you think adding support of the `=' match type for the
> date header makes sense? As I was testing this change, I found myself
> reaching for that, but I am not entirely convinced it's actually a
> useful feature. Either way, please don't hold up this change for that.
>
> As I mentioned before, I would be happy to merge if someone points me at
> instructions. In the past, eliz and larsi have merged changes I have
> submitted.

I've installed the patch so I'm closing this.

Alex do you have write access?

Thanks

  Andrea





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-05-30  9:01     ` Andrea Corallo
@ 2024-05-30 16:30       ` Alex Bochannek
  0 siblings, 0 replies; 28+ messages in thread
From: Alex Bochannek @ 2024-05-30 16:30 UTC (permalink / raw)
  To: Andrea Corallo
  Cc: 70134-done@debbugs.gnu.org, Richard Stallman, Eric Abrahamsen,
	Jakub Ječmínek, larsi@gnus.org, Eli Zaretskii

Andrea Corallo <acorallo@gnu.org> writes:

> I've installed the patch so I'm closing this.
>
> Alex do you have write access?

I don't believe I do, no.

-- 
Alex.





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

* bug#70134: [PATCH] Show all date options when adding Gnus scores interactively
  2024-04-01 21:44 bug#70134: [PATCH] Show all date options when adding Gnus scores interactively Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (3 preceding siblings ...)
  2024-05-29 21:23 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-08-07 20:22 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
  4 siblings, 0 replies; 28+ messages in thread
From: Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-07 20:22 UTC (permalink / raw)
  To: 70134-done

Commited as 39b704e36e308783dcec791d333fca317c6a5202 so I'm closing this.






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

end of thread, other threads:[~2024-08-07 20:22 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-01 21:44 bug#70134: [PATCH] Show all date options when adding Gnus scores interactively Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13  7:58 ` Eli Zaretskii
2024-04-22  3:33   ` Eric Abrahamsen
2024-04-24 22:52     ` Richard Stallman
2024-04-24 23:08       ` Alex Bochannek
2024-05-01 19:27         ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-07  2:53           ` Alex Bochannek
2024-05-09 19:15             ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 23:59               ` Eric Abrahamsen
2024-05-10 20:04                 ` Eric Abrahamsen
2024-05-10 20:38                   ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-10 21:27                     ` Eric Abrahamsen
2024-05-14  2:00                     ` Alex Bochannek
2024-05-14 14:52                       ` Eric Abrahamsen
2024-05-14 18:43                         ` Alex Bochannek
2024-05-14 19:57                           ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-16 14:15                             ` Eric Abrahamsen
2024-05-16 19:40                               ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-22 21:34 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-22 23:30   ` Alex Bochannek
2024-05-23  2:50     ` Eric Abrahamsen
2024-05-26 14:22       ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-26 22:09 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 21:23 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30  0:16   ` Alex Bochannek
2024-05-30  9:01     ` Andrea Corallo
2024-05-30 16:30       ` Alex Bochannek
2024-08-07 20:22 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.