unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: The order of the headers in Message Mode is peculiar!
Date: Thu, 25 Jan 2024 16:20:40 -0800	[thread overview]
Message-ID: <87o7d9lzc7.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 61fd0e098e8268011bf1fbfb86dcb764@posteo.net

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




      reply	other threads:[~2024-01-26  0:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 14:20 The order of the headers in Message Mode is peculiar! rameiko87
2024-01-26  0:20 ` Eric Abrahamsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7d9lzc7.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).