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

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 05 Oct 2023 07:54:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
66330: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66330
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#66330: 28.2; Gnus wide reply (S W) changes Subject header when used from Debbugs thread
From: Michael Albinus <[email-masked]>
To: Maxim Cournoyer <[email-masked]>
Cc: Bruno Victal <[email-masked]>, [email-masked]
Date: Thu, 05 Oct 2023 09:53:06 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Maxim Cournoyer <[email-masked]> writes:

> Hi Michael,

Hi Maxim,

>> 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?
>
> I've applied the patch and retried my original reproducer; it passes the
> test!  So it seems useful to me already in the current form, thank you!
>
> Another thing that could be nice for the future would be some way for
> the user to customize the gnus-posting-styles used by Debbugs.  That way
> I believe you could modify its behavior only for some particular
> "group", e.g. when sending to 'guix-patches'; but that seems trickier
> to implement.
>
> So I think the solution you propose is satisfactory!

Thanks for the feedback. I've applied the patch to the GNU ELPA
repository, and released debbugs 0.37. Shall be visible in a couple of
hours.

Further changes might be possible. But as you've said it is more
complex, because some of the settings in gnus-posting-styles must be
preserved. So we'll better wait for further requests if any.

Closing the bug.

Best regards, Michael.

Subject: 28.2; Gnus wide reply (S W) changes Subject header when used from Debbugs thread
From: Maxim Cournoyer <[email-masked]>
To: [email-masked]
Date: Tue, 03 Oct 2023 20:26:26 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

When attempting to reply from an Emacs Debbugs thread specific email,
the Subject line gets set to the subject of the first email in the
thread rather than to that of the specific email I'm replying to, which
looses context.

Example/reproducer:

$ guix shell --container emacs-no-x emacs-debbugs -- emacs

>From the launched Emacs:

1. M-x debbugs-gnu-bugs 65479

2. Press 'a' to load the bug despite the lack of SSL certificates.

3. Navigate to the message titled:
[bug#65479] [PATCH core-updates 02/61] gnu: Add docbook-xml-5.

4. Press S W to send a wide reply.

5. Observe that the Subject header in the email response being edited
has been changed to "Re: bug#65479: [PATCH core-updates 00/61] The
Draining of the XML & DocBook Swamp.", that is, the original subject of
the "bug" (its first message).

I haven't been able to explain what causes that, but I've found where it
occurs.  Following the original 'gnus-article-wide-reply-with-original'
call, it eventually calls to 'message-setup-1', and the Subject
modification happens by unknown code (hooks?) just before the line 6870
("(run-hooks 'message-setup-hook)") runs:

--8<---------------cut here---------------start------------->8---
(defun message-setup-1 (headers &optional yank-action actions return-action)
  (dolist (action actions)
    (condition-case nil
        ;; FIXME: Use functions rather than expressions!
	(add-to-list 'message-send-actions
		     `(apply #',(car action) ',(cdr action)))))
  (setq message-return-action return-action)
  
[...]

  (run-hooks 'message-signature-setup-hook)
  (message-insert-signature)
  (save-restriction
    (message-narrow-to-headers)
    (run-hooks 'message-header-setup-hook))
  (setq buffer-undo-list nil)
  (when message-generate-hashcash
    ;; Generate hashcash headers for recipients already known
    (mail-add-payment-async))

===> Subject header changed HERE

  ;; Gnus posting styles are applied via buffer-local `message-setup-hook'
  ;; values.
  (run-hooks 'message-setup-hook)
  ;; Do this last to give it precedence over posting styles, etc.
  (when (message-mail-p)
    (save-restriction
      (message-narrow-to-headers)
      (if message-alternative-emails
	  (message-use-alternative-email-as-from))))
  (message-position-point)
  ;; Allow correct handling of `message-checksum' in `message-yank-original':
  (set-buffer-modified-p nil)
  (undo-boundary)
  ;; rmail-start-mail expects message-mail to return t (Bug#9392)
  t)
--8<---------------cut here---------------end--------------->8---

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.

-- 
Thanks,
Maxim