GNU bug report logs - #18156
Thread sorting before loose threads are gathered

Previous Next

Packages: gnus, emacs;

Reported by: Michael Welsh Duggan <mwd <at> md5i.com>

Date: Thu, 31 Jul 2014 00:02:01 UTC

Severity: minor

Merged with 21462

Found in version 25.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18156 in the body.
You can then email your comments to 18156 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bugs <at> gnus.org:
bug#18156; Package gnus. (Thu, 31 Jul 2014 00:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Welsh Duggan <mwd <at> md5i.com>:
New bug report received and forwarded. Copy sent to bugs <at> gnus.org. (Thu, 31 Jul 2014 00:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Welsh Duggan <mwd <at> md5i.com>
To: submit <at> debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)
Subject: Thread sorting before loose threads are gathered
Date: Wed, 30 Jul 2014 20:00:59 -0400
[Message part 1 (text/plain, inline)]
Thread sorting happens before loose threads are gathered.  See the
definition of `gnus-summary-prepare'.  Threads are made, then cut, then
sorted, and then gathered.  I believe they should be made, cut,
gathered, and then sorted.  A consequence of the current order is that
using `gnus-thread-sort-by-most-recent-{number,date}' in the
`gnus-thread-sort-functions' will not pay attention to all messages in a
gathered thread.

I have verified that changing the order does the right thing, but some
functions that may be used in sorting do not know how to handle gathered
threads.  An example is `gnus-thread-latest-date' which will choke on
the string at the car of a gathered thread.  I made a change to
`gnus-thread-latest-date' so it understands gathered threads, but it may
make more sense to do this in the function(s) that call the sort
functions rather than testing that all sorting functions know how to
handle gathered threads.

I include the patch I was testing with.  It is only valid with respect
to the sorting functions I was working with, and as such isn't suitable
to commit in its current state.

[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 61cf7ec..8295227 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -4146,9 +4146,9 @@ If SELECT-ARTICLES, only select those articles from GROUP."
     (when gnus-newsgroup-headers
       (gnus-summary-prepare-threads
        (if gnus-show-threads
-	   (gnus-sort-gathered-threads
-	    (funcall gnus-summary-thread-gathering-function
-		     (gnus-sort-threads
+           (gnus-sort-threads
+            (gnus-sort-gathered-threads
+             (funcall gnus-summary-thread-gathering-function
 		      (gnus-cut-threads (gnus-make-threads)))))
 	 ;; Unthreaded display.
 	 (gnus-sort-articles gnus-newsgroup-headers))))
@@ -5109,7 +5109,8 @@ Unscored articles will be counted as having a score of zero."
 	 (mapcar (lambda (header) (gnus-float-time
 				   (gnus-date-get-time
 				    (mail-header-date header))))
-		 (message-flatten-list thread))))
+		 (let ((x (message-flatten-list thread)))
+                   (if (stringp (car x)) (cdr x) x)))))
 
 (defun gnus-thread-total-score-1 (root)
   ;; This function find the total score of the thread below ROOT.
[Message part 3 (text/plain, inline)]

Ma Gnus v0.8
GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, X toolkit)
 of 2014-07-13 on maru2
200 news.gmane.org InterNetNews NNRP server INN 2.5.1 ready (posting ok)
100 Legal commands
  ARTICLE [message-ID|number]
  AUTHINFO USER name|PASS password|GENERIC program [argument ...]
  BODY [message-ID|number]
  CAPABILITIES [keyword]
  DATE
  GROUP newsgroup
  HDR header [message-ID|range]
  HEAD [message-ID|number]
  HELP
  IHAVE message-ID
  LAST
  LIST [ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|DISTRIB.PATS|DISTRIBUTIONS|HEADERS [MSGID|RANGE]|MODERATORS|MOTD|NEWSGROUPS [wildmat]|OVERVIEW.FMT|SUBSCRIPTIONS]
  LISTGROUP [newsgroup [range]]
  MODE READER
  NEWGROUPS [yy]yymmdd hhmmss [GMT]
  NEWNEWS wildmat [yy]yymmdd hhmmss [GMT]
  NEXT
  OVER [range]
  POST
  QUIT
  STARTTLS
  STAT [message-ID|number]
  XGTITLE [wildmat]
  XHDR header [message-ID|range]
  XOVER [range]
  XPAT header message-ID|range pattern [pattern ...]
Report problems to <usenet <at> ger.gmane.org>.
.
382 Begin TLS negotiation now
100 Legal commands
  ARTICLE [message-ID|number]
  AUTHINFO USER name|PASS password|GENERIC program [argument ...]
  BODY [message-ID|number]
  CAPABILITIES [keyword]
  DATE
  GROUP newsgroup
  HDR header [message-ID|range]
  HEAD [message-ID|number]
  HELP
  IHAVE message-ID
  LAST
  LIST [ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|DISTRIB.PATS|DISTRIBUTIONS|HEADERS [MSGID|RANGE]|MODERATORS|MOTD|NEWSGROUPS [wildmat]|OVERVIEW.FMT|SUBSCRIPTIONS]
  LISTGROUP [newsgroup [range]]
  MODE READER
  NEWGROUPS [yy]yymmdd hhmmss [GMT]
  NEWNEWS wildmat [yy]yymmdd hhmmss [GMT]
  NEXT
  OVER [range]
  POST
  QUIT
  STARTTLS
  STAT [message-ID|number]
  XGTITLE [wildmat]
  XHDR header [message-ID|range]
  XOVER [range]
  XPAT header message-ID|range pattern [pattern ...]
Report problems to <usenet <at> ger.gmane.org>.
.

-- 
Michael Welsh Duggan
(md5i <at> md5i.com)

Information forwarded to bugs <at> gnus.org:
bug#18156; Package gnus. (Wed, 25 Jan 2017 18:23:02 GMT) Full text and rfc822 format available.

Message #8 received at 18156 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Welsh Duggan <mwd <at> md5i.com>
Cc: 18156 <at> debbugs.gnu.org
Subject: Re: bug#18156: Thread sorting before loose threads are gathered
Date: Wed, 25 Jan 2017 19:22:27 +0100
Michael Welsh Duggan <mwd <at> md5i.com> writes:

> Thread sorting happens before loose threads are gathered.  See the
> definition of `gnus-summary-prepare'.  Threads are made, then cut, then
> sorted, and then gathered.  I believe they should be made, cut,
> gathered, and then sorted.  A consequence of the current order is that
> using `gnus-thread-sort-by-most-recent-{number,date}' in the
> `gnus-thread-sort-functions' will not pay attention to all messages in a
> gathered thread.

No, but you have `gnus-sort-gathered-threads-function' to sort inside
the gathered threads, so I think the current algorithm is correct...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug reassigned from package 'gnus' to 'emacs,gnus'. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 18:31:02 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 5.130008. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 18:31:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18156 <at> debbugs.gnu.org and Michael Welsh Duggan <mwd <at> md5i.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 18:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18156; Package emacs,gnus. (Thu, 26 Jan 2017 14:00:02 GMT) Full text and rfc822 format available.

Message #17 received at 18156 <at> debbugs.gnu.org (full text, mbox):

From: Michael Welsh Duggan <mwd <at> cert.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 18156 <at> debbugs.gnu.org
Subject: Re: bug#18156: Thread sorting before loose threads are gathered
Date: Thu, 26 Jan 2017 08:58:35 -0500
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Michael Welsh Duggan <mwd <at> md5i.com> writes:
>
>> Thread sorting happens before loose threads are gathered.  See the
>> definition of `gnus-summary-prepare'.  Threads are made, then cut, then
>> sorted, and then gathered.  I believe they should be made, cut,
>> gathered, and then sorted.  A consequence of the current order is that
>> using `gnus-thread-sort-by-most-recent-{number,date}' in the
>> `gnus-thread-sort-functions' will not pay attention to all messages in a
>> gathered thread.
>
> No, but you have `gnus-sort-gathered-threads-function' to sort inside
> the gathered threads, so I think the current algorithm is correct...

Correct or incorrect, it doesn't allow me to do what I want to do.  Here
is my use case:  I want to sort the threads in my summary buffer,
post-gathering, by the date of the most recent article in the thread.
If threads (not the articles in threads) are sorted before they are
gathered, this seems less than possible.

-- 
Michael Welsh Duggan
(mwd <at> cert.org)




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#18156; Package emacs,gnus. (Thu, 26 Jan 2017 14:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 18156 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Welsh Duggan <mwd <at> cert.org>
Cc: 18156 <at> debbugs.gnu.org
Subject: Re: bug#18156: Thread sorting before loose threads are gathered
Date: Thu, 26 Jan 2017 15:19:47 +0100
Michael Welsh Duggan <mwd <at> cert.org> writes:

> Correct or incorrect, it doesn't allow me to do what I want to do.  Here
> is my use case:  I want to sort the threads in my summary buffer,
> post-gathering, by the date of the most recent article in the thread.
> If threads (not the articles in threads) are sorted before they are
> gathered, this seems less than possible.

Hm...  I see...

Well, your sorting function could emulate the gathering and then do the
sorting based on that emulation.  The sorting functions should have
access to everything necessary to do so.

The reason I'm less than enthusiastic about changing the order of things
here is that this is really, really old code, and lots people have written
their own sorting functions based on the way it works.  Changing the
order will lead to breakages.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Forcibly Merged 18156 21462. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 26 Jan 2017 21:22:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 21462 <at> debbugs.gnu.org and Michael Welsh Duggan <mwd <at> md5i.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 26 Jan 2017 21:22:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 24 Feb 2017 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.