Subject: Re: bug#66330: 28.2; Gnus wide reply (S W) changes Subject header when used from Debbugs thread

From: Michael Albinus <[email-masked]>
Date: Wed, 04 Oct 2023 14:10:33 +0200

Maxim Cournoyer <[email-masked]> writes:

> Hi,

Hi Maxim,

> Would someone be able to explain what is responsible for this?  It seems
> to me it'd be preferable if the subject of the message I'm replying to
> was kept rather than replaced this way, to preserve context.

FTR, this behavior is due to setting a default subject via
gnus-posting-styles in debbugs-gnu-summary-mode. Could you please check
whether the appended patch helps?

Best regards, Michael.

diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index f366fba11d..cd549e364d 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -1747,6 +1747,12 @@ MERGED is the list of bugs merged with this one."
 	 (format "Re: bug#%d: %s" id (alist-get 'subject status)))
     (debbugs-gnu-summary-mode 1)))

+(defcustom debbugs-gnu-summary-keep-subject
+  (rx "[PATCH" (? (0+ (not (any digit "/]"))) (1+ digit) "/" (1+ digit)) "]")
+  "Regular expression which keeps the original message subject in replies."
+  :version "29.1"
+  :type 'regexp)
+
 (defvar debbugs-gnu-summary-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "C" #'debbugs-gnu-send-control-message)
@@ -1778,6 +1784,8 @@ MERGED is the list of bugs merged with this one."
 			    (cons new new))
 			address))))))
 	  ,@(and debbugs-gnu-subject
+                 (not (string-match-p debbugs-gnu-summary-keep-subject
+                                      debbugs-gnu-subject))
 		 `((subject ,debbugs-gnu-subject)))))))

 (defun debbugs-gnu-guess-current-id ()