unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* The order of the headers in Message Mode is peculiar!
@ 2024-01-25 14:20 rameiko87
  2024-01-26  0:20 ` Eric Abrahamsen
  0 siblings, 1 reply; 2+ messages in thread
From: rameiko87 @ 2024-01-25 14:20 UTC (permalink / raw)
  To: help-gnu-emacs

I read on https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6 that 
the order of the headers does not matter when sending emails.
But I can't explain why Message Mode defaults to the following order 
when crafting a new emails:

To:
Subject:
 From:

given that the default value of message-header-format-alist is 
different! Is there any reason for this order (and where is such order 
decided?), and do you agree that the default order of the headers 
appearing after C-x m should be the default value of the variable 
message-header-format-alist ?



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

* Re: The order of the headers in Message Mode is peculiar!
  2024-01-25 14:20 The order of the headers in Message Mode is peculiar! rameiko87
@ 2024-01-26  0:20 ` Eric Abrahamsen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Abrahamsen @ 2024-01-26  0:20 UTC (permalink / raw)
  To: help-gnu-emacs

rameiko87@posteo.net writes:

> I read on https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6 that
> the order of the headers does not matter when sending emails.
> But I can't explain why Message Mode defaults to the following order
> when crafting a new emails:
>
> To:
> Subject:
> From:
>
> given that the default value of message-header-format-alist is
> different! Is there any reason for this order (and where is such order
> decided?), and do you agree that the default order of the headers
> appearing after C-x m should be the default value of the variable
> message-header-format-alist ?

The short answer is, there is no code that attempts or guarantees to
sort the headers in a new message. The current ordering results from
code in `message-mail', where a header list containing "To" and
"Subject" is passed down, ultimately to `message-setup-1', which does
the actual header insertion (see the comment ";; Insert all the
headers").

The weird thing is that `message-sort-headers' is called before
*sending* a message, in `message-send' -> `message-fix-before-sending'.
Why sort order matters for an outgoing message I don't know.

Anyway, if I were you I would add `message-sort-headers' to the
`gnus-message-setup-hook', or if you don't want it to be gnus-specific,
to the `message-header-setup-hook', with a higher DEPTH argument.

HTH,
Eric




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

end of thread, other threads:[~2024-01-26  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 14:20 The order of the headers in Message Mode is peculiar! rameiko87
2024-01-26  0:20 ` Eric Abrahamsen

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).