unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42334: 28.0.50; gnus-thread-sort-functions vs. loose threads
@ 2020-07-12 13:05 Kévin Le Gouguec
  2020-07-19  0:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Kévin Le Gouguec @ 2020-07-12 13:05 UTC (permalink / raw)
  To: 42334

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

Hello,

I try to configure gnus-thread-sort-functions so that threads are sorted
from least recently updated (at the top) to most recently updated (at
the bottom):

#+begin_src elisp
(setq gnus-thread-sort-functions '(gnus-thread-sort-by-number
                                   (not gnus-thread-sort-by-most-recent-date)))
#+end_src

The above works as intended most of the time, except when loose threads
are involved.  To reproduce:

- copy the attached emacs-devel.mbox to /tmp,
- copy the attached init.el somewhere,
- install gnus-mock from ELPA,
- evaluate the following, with init.el in default-directory:

#+begin_src elisp
(let ((gnus-mock-init-file (expand-file-name "init.el"))
      (gnus-mock-emacs-program (expand-file-name "src/emacs" source-directory)))
  (package-initialize)
  (gnus-mock-start))
#+end_src

This produces the following summary buffer:

20200708T163331 Philip K.               Re: Updating dired-guess-shell-alist-default
20200708T170847     Stefan Monnier          
20200708T163824 João Távora             Re: Byte-compilation warnings after merging eldoc changes

AFAICT, the first thread should be sorted last, since it has been
updated more recently than the second thread.  What leads me to believe
that this issue is linked to loose threads is that if we ask Gnus not to
gather those…

#+begin_src elisp
;; Evaluate:
(setq gnus-summary-make-false-root nil)
;; Then refresh with M-g.
#+end_src

… then the issue goes away:

20200708T163331 Philip K.               Re: Updating dired-guess-shell-alist-default
20200708T163824 João Távora             Re: Byte-compilation warnings after merging eldoc changes
20200708T170847 Stefan Monnier          Re: Updating dired-guess-shell-alist-default


Is this indeed a bug, or am I missing something?

Thank you for your time.


PS: when playing with this example, if you happen to set
gnus-summary-make-false-root to 'dummy, and notice that both the dummy
root *and* the first message display the subject line, note that I
already sent a report (and a patch) over at bug#40520.



[-- Attachment #2: emacs-devel.mbox --]
[-- Type: application/mbox, Size: 17769 bytes --]

[-- Attachment #3: init.el --]
[-- Type: application/emacs-lisp, Size: 289 bytes --]

[-- Attachment #4: Type: text/plain, Size: 757 bytes --]



In GNU Emacs 28.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-07-04 built on hirondell
Repository revision: 5d1bac0ac951e25d0b0b39a9919f13053162d5df
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Configured using:
 'configure --with-xwidgets --with-cairo'

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

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

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

* bug#42334: 28.0.50; gnus-thread-sort-functions vs. loose threads
  2020-07-12 13:05 bug#42334: 28.0.50; gnus-thread-sort-functions vs. loose threads Kévin Le Gouguec
@ 2020-07-19  0:13 ` Lars Ingebrigtsen
  2020-07-19  9:42   ` Kévin Le Gouguec
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-07-19  0:13 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: 42334

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

> Is this indeed a bug, or am I missing something?

It's an artefact of the way Gnus does these things.  This is the code:

	   (gnus-sort-gathered-threads
	    (funcall gnus-summary-thread-gathering-function
		     (gnus-sort-threads
		      (gnus-cut-threads (gnus-make-threads)))))

First we sort the threads, then we gather loose threads, and then we
sort the loose threads individually.

So there's no way to do sorting (globally) after the threads have been
gathered.

Changing the order all this happens in would be possible, but it would
change how this all behaves.  So to fix this, we'd have to add yet
another sort -- on the outside, after doing all this, and this would
require a new set of sorting predicates, because the structure of a
gathered thread is different than the structure of a normal thread.

So you couldn't use gnus-thread-sort-by-most-recent-date and the like
for that top-level sorting thing.

So I don't think adding this functionality is worth it, although it's
something that's been requested a few times, and I'm closing this bug
report.

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





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

* bug#42334: 28.0.50; gnus-thread-sort-functions vs. loose threads
  2020-07-19  0:13 ` Lars Ingebrigtsen
@ 2020-07-19  9:42   ` Kévin Le Gouguec
  2020-07-19 13:09     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Kévin Le Gouguec @ 2020-07-19  9:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 42334

Lars Ingebrigtsen <larsi@gnus.org> writes:

> So I don't think adding this functionality is worth it, although it's
> something that's been requested a few times, and I'm closing this bug
> report.

Understood.  It's not too annoying when reading news since I rarely have
more than a screenful of summary for any given group, but it can get
confusing when looking at archives: a recently updated subthread can be
hidden several screens up because a sibling subthread is too old…

I'll file this one under "don't hack on this unless I can spend a couple
of days on it".  Thanks a lot for taking the time to pinpoint where the
issue lies, that's really helpful!





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

* bug#42334: 28.0.50; gnus-thread-sort-functions vs. loose threads
  2020-07-19  9:42   ` Kévin Le Gouguec
@ 2020-07-19 13:09     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-07-19 13:09 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: 42334

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

> Understood.  It's not too annoying when reading news since I rarely have
> more than a screenful of summary for any given group, but it can get
> confusing when looking at archives: a recently updated subthread can be
> hidden several screens up because a sibling subthread is too old…
>
> I'll file this one under "don't hack on this unless I can spend a couple
> of days on it".  Thanks a lot for taking the time to pinpoint where the
> issue lies, that's really helpful!

It would be nice.  The thing is that it requires writing new versions of
all these functions:

           (choice (function-item gnus-thread-sort-by-number)
                   (function-item gnus-thread-sort-by-author)
                   (function-item gnus-thread-sort-by-recipient)
                   (function-item gnus-thread-sort-by-subject)
                   (function-item gnus-thread-sort-by-date)
                   (function-item gnus-thread-sort-by-score)
                   (function-item gnus-thread-sort-by-most-recent-number)
                   (function-item gnus-thread-sort-by-most-recent-date)
                   (function-item gnus-thread-sort-by-random)
                   (function-item gnus-thread-sort-by-total-score)

The new versions would take gathered threads as the parameters instead
of real threads.  (Gathered threads are just lists of real threads, so
it's pretty straightforward.)

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





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

end of thread, other threads:[~2020-07-19 13:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 13:05 bug#42334: 28.0.50; gnus-thread-sort-functions vs. loose threads Kévin Le Gouguec
2020-07-19  0:13 ` Lars Ingebrigtsen
2020-07-19  9:42   ` Kévin Le Gouguec
2020-07-19 13:09     ` Lars Ingebrigtsen

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

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

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