Gnus development mailing list
 help / color / mirror / Atom feed
* bug#62345: [workaround] Composing mail from secondary frame does not generate Gcc: header
@ 2025-04-19 18:26 Felix Natter
  0 siblings, 0 replies; only message in thread
From: Felix Natter @ 2025-04-19 18:26 UTC (permalink / raw)
  To: ding, bug-gnu-emacs

Dear Emacs / Gnus experts,

with regard to this:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62345
(TL;DR: "C-x 5 m" / "C-x 5 2, then m" fail to add a Gcc: header)

I am using (standard config from the manual):

(setq gnus-message-archive-group
      '((if (message-news-p)
            "sent-news"
          (concat "sent-mail." (format-time-string "%Y-%m")))))

Here is my analysis of the problem (Emacs 30.1, Gnus 5.13) (below I
analyzed C-x 5 m, but C-x 5 2, then m works as well, so it seems to be
similar):

- gnus-inews-insert-gcc is responsible for adding the Gcc: header
- C-x 5 m (compose-mail-other-frame) differs substantially from m
  (gnus-group-mail):
  - m (OK case): gnus-group-mail calls
    (gnus-setup-message 'message (message-mail))
    at the very end
  - C-x 5 m (FAIL case): compose-mail-other-frame also calls (message-mail)
    (according to edebug backtrace) in some way I don't understand but does NOT
    call gnus-setup-message
- gnus-setup-message creates the Gcc: creation hook:
  (add-hook 'message-header-setup-hook (lambda ()
	      (gnus-inews-insert-gcc ,group)))
- message-setup-1 (called by both OK and FAIL) runs message-header-setup-hook:
  (which is null/nil in the FAIL / C-x 5 m case):
  (save-restriction
    (message-narrow-to-headers)
    (run-hooks 'message-header-setup-hook))

workaround: I changed message-setup-1 (gnus-msg.el) to:
  (save-restriction
    (message-narrow-to-headers)
    (if (null message-header-setup-hook)
	(gnus-inews-insert-gcc "")
      (run-hooks 'message-header-setup-hook)))

Which works for me so far. Is this workaround anywhere *close* to becoming a fix?
I know it is not ready, but am I anywhere on the right track, and could someone
please help?

- gnus-setup-message: what does
  (group (make-symbol "gnus-setup-message-group")) and then
  (gnus-inews-insert-gcc ,group) do?
- how do I check whether message-header-setup-hook contains a
  "gnus-inews-insert-gcc" hook instead of checking for null?
  (P.S.: rather check for existance of Gcc: after having run the hook,
   that should be easy)
- or, as an alternative solution: can we make compose-mail-other-frame
  (transitively) call gnus-setup-message (for that I would need to understand
  how compose-mail calls message-mail)?

Many Thanks and Best Regards!
Felix
-- 
Felix Natter


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-22 20:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-19 18:26 bug#62345: [workaround] Composing mail from secondary frame does not generate Gcc: header Felix Natter

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 NNTP newsgroup(s).