Subject: bug#40520: 28.0.50; Prevent duplicate thread titles in Gnus

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 25 Jun 2020 22:45:03 +0200

Hello again,

I'd like to bump this report, if only because I've finally taken the
time to try out Eric Abrahamsen's gnus-mock package on GNU ELPA.  This
allowed me to make a reproducible test case with this simple config:

> (setq gnus-summary-make-false-root 'dummy)

I've attached an example .mbox saved from gnu-emacs-help; you can
reproduce my issue by saving it somewhere, then evaluating this in the
same directory:

#+begin_src elisp
(let ((gnus-mock-init-file (expand-file-name "gnus-dummy-init.el"))
      (gnus-mock-emacs-program (expand-file-name "src/emacs" source-directory))
      (mbox (expand-file-name "gnu-emacs-help.mbox" default-directory))
      (init-template "
(setq gnus-summary-make-false-root 'dummy)
(gnus)
(gnus-group-make-doc-group \"%s\" nil)
(gnus-group-select-group)
"))
  (with-temp-buffer
    (insert (format init-template mbox))
    (write-file "gnus-dummy-init.el"))
  (package-initialize)
  (gnus-mock-start))
#+end_src

Right now, Gnus produces this:

   :                             : Re: How to get the actual face attribute?
 .     [  67: Yuan Fu                ] Re: How to get the actual face attribute?
 .     [  28: Yuan Fu                ] 

With my patch (re-attached, with bug number for convenience), Gnus
produces this:

   :                             : Re: How to get the actual face attribute?
 .     [  67: Yuan Fu                ] 
 .     [  28: Yuan Fu                ] 

Let me know if there's anything wrong with the patch, or with my
understanding of the situation.

Thank you for your time.

>From 271ff9c3287e25a71b82f9e47418a66c28f8553a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <[email-masked]>
Date: Thu, 9 Apr 2020 11:05:39 +0200
Subject: [PATCH] Simplify dummy root subject before comparing it to the
 current article

* lisp/gnus/gnus-sum.el (gnus-summary-prepare-threads): Simplify both
the dummy root and the following article before comparing them,
otherwise both the former and the latter might display the thread's
subject even when gnus-summary-line-format contains "%s" (bug#40520).
---
 lisp/gnus/gnus-sum.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 341f04ad77..e4f4114b6c 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -5352,7 +5352,7 @@ gnus-summary-prepare-threads
 	      ;; We remember that we probably want to output a dummy
 	      ;; root.
 	      (setq gnus-tmp-dummy-line gnus-tmp-header)
-	      (setq gnus-tmp-prev-subject gnus-tmp-header))
+	      (setq gnus-tmp-prev-subject (gnus-simplify-subject-fully gnus-tmp-header)))
 	     (t
 	      ;; We do not make a root for the gathered
 	      ;; sub-threads at all.
-- 
2.27.0