* Fixed order of headers in Rmail messages
@ 2022-02-09 21:43 irek
2022-02-10 6:05 ` Tassilo Horn
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: irek @ 2022-02-09 21:43 UTC (permalink / raw)
To: help-gnu-emacs
Hello. Each Rmail message have headers printed in different order.
Reason for that is obvious but I was looking for convenient way to have
chosen headers always in the same order in all messages.
I don't see any Rmail variable or function that could help with sorting
except for `rmail-show-message-hook' that could be used to modify each
message when displayed but that's not the way I would like to go.
Maybe I missed something or maybe there is a way to do this on movemail
level or other mailutils program. I was looking there but couldn't find
anything. Any ideas or suggestions?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-09 21:43 Fixed order of headers in Rmail messages irek
@ 2022-02-10 6:05 ` Tassilo Horn
2022-02-10 7:21 ` irek
2022-02-10 7:44 ` Eli Zaretskii
2022-02-10 6:06 ` Eli Zaretskii
` (2 subsequent siblings)
3 siblings, 2 replies; 14+ messages in thread
From: Tassilo Horn @ 2022-02-10 6:05 UTC (permalink / raw)
To: irek; +Cc: help-gnu-emacs
irek <mail@gumen.pl> writes:
> Each Rmail message have headers printed in different order. Reason
> for that is obvious but I was looking for convenient way to have
> chosen headers always in the same order in all messages.
The obvious reason you've mentioned is that rmail just shows your
gazillion-mails MBOX file and narrows it down to a single message and
its interesting headers. So the order of headers shown to you is the
order of headers in the mail.
A way to do what you want would be to add a function to
`rmail-show-message-hook' which parses the visible headers into a list,
sorts them to your liking, and creates an overlay from the start to the
end of the actual headers with a 'display propery whose value is the
sorted version.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-10 6:05 ` Tassilo Horn
@ 2022-02-10 7:21 ` irek
2022-02-10 7:44 ` Eli Zaretskii
1 sibling, 0 replies; 14+ messages in thread
From: irek @ 2022-02-10 7:21 UTC (permalink / raw)
To: Tassilo Horn; +Cc: help-gnu-emacs
Tassilo Horn <tsdh@gnu.org> writes:
> The obvious reason you've mentioned is that rmail just shows your
> gazillion-mails MBOX file and narrows it down to a single message and
> its interesting headers. So the order of headers shown to you is the
> order of headers in the mail.
Yep, that's the reason. That's why I though about sorting them after
fetching with fetchmail or movemail programs.
> A way to do what you want would be to add a function to
> `rmail-show-message-hook' which parses the visible headers into a list,
> sorts them to your liking, and creates an overlay from the start to the
> end of the actual headers with a 'display propery whose value is the
> sorted version.
Hmm. I haven't thought about using overlay. That will eliminate need
of modifying original message. I will try that.
Thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-10 6:05 ` Tassilo Horn
2022-02-10 7:21 ` irek
@ 2022-02-10 7:44 ` Eli Zaretskii
2022-02-10 8:37 ` Tassilo Horn
1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2022-02-10 7:44 UTC (permalink / raw)
To: help-gnu-emacs
> From: Tassilo Horn <tsdh@gnu.org>
> Date: Thu, 10 Feb 2022 07:05:41 +0100
> Cc: help-gnu-emacs@gnu.org
>
> The obvious reason you've mentioned is that rmail just shows your
> gazillion-mails MBOX file and narrows it down to a single message and
> its interesting headers.
This is not how Rmail works nowadays.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-10 7:44 ` Eli Zaretskii
@ 2022-02-10 8:37 ` Tassilo Horn
2022-02-10 12:03 ` Eli Zaretskii
0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2022-02-10 8:37 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> The obvious reason you've mentioned is that rmail just shows your
>> gazillion-mails MBOX file and narrows it down to a single message and
>> its interesting headers.
>
> This is not how Rmail works nowadays.
Ah, alright, I didn't know that has changed but simply assumed it's
still the case because buffer-file-name in an Rmail buffer is the mbox
file.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-09 21:43 Fixed order of headers in Rmail messages irek
2022-02-10 6:05 ` Tassilo Horn
@ 2022-02-10 6:06 ` Eli Zaretskii
2022-02-10 7:17 ` irek
2022-02-10 7:54 ` Jean Louis
2022-02-12 12:27 ` irek
3 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2022-02-10 6:06 UTC (permalink / raw)
To: help-gnu-emacs
> From: irek <mail@gumen.pl>
> Date: Wed, 09 Feb 2022 22:43:46 +0100
>
> Hello. Each Rmail message have headers printed in different order.
> Reason for that is obvious but I was looking for convenient way to have
> chosen headers always in the same order in all messages.
>
> I don't see any Rmail variable or function that could help with sorting
> except for `rmail-show-message-hook' that could be used to modify each
> message when displayed but that's not the way I would like to go.
I don't think we have such a feature, no.
The place to add it would be in the function rmail-copy-headers, which
copies the headers from the original message to the view buffer.
> Maybe I missed something or maybe there is a way to do this on movemail
> level or other mailutils program. I was looking there but couldn't find
> anything. Any ideas or suggestions?
I don't know about these, but I very much doubt that those utilities
would rewrite messages they copy.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-10 6:06 ` Eli Zaretskii
@ 2022-02-10 7:17 ` irek
0 siblings, 0 replies; 14+ messages in thread
From: irek @ 2022-02-10 7:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
> I don't think we have such a feature, no.
Ok, so I didn't miss anything.
> The place to add it would be in the function rmail-copy-headers, which
> copies the headers from the original message to the view buffer.
Oh great, thanks. I will try to elegantly modify/advice this function.
> I don't know about these, but I very much doubt that those utilities
> would rewrite messages they copy.
I though so too.
Anyway rmail-copy-headers function should be enough. Thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-09 21:43 Fixed order of headers in Rmail messages irek
2022-02-10 6:05 ` Tassilo Horn
2022-02-10 6:06 ` Eli Zaretskii
@ 2022-02-10 7:54 ` Jean Louis
2022-02-10 8:06 ` irek
2022-02-12 12:27 ` irek
3 siblings, 1 reply; 14+ messages in thread
From: Jean Louis @ 2022-02-10 7:54 UTC (permalink / raw)
To: irek; +Cc: help-gnu-emacs
* irek <mail@gumen.pl> [2022-02-10 00:45]:
> Hello. Each Rmail message have headers printed in different order.
> Reason for that is obvious but I was looking for convenient way to have
> chosen headers always in the same order in all messages.
RFC 5322: Internet Message Format
https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6
Quote:
,----
| It is important to note that the header fields are not guaranteed to
| be in a particular order.
`----
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-10 7:54 ` Jean Louis
@ 2022-02-10 8:06 ` irek
2022-02-10 8:26 ` Jean Louis
0 siblings, 1 reply; 14+ messages in thread
From: irek @ 2022-02-10 8:06 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> * irek <mail@gumen.pl> [2022-02-10 00:45]:
>> Hello. Each Rmail message have headers printed in different order.
>> Reason for that is obvious but I was looking for convenient way to have
>> chosen headers always in the same order in all messages.
>
> RFC 5322: Internet Message Format
> https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6
>
> Quote:
>
> ,----
> | It is important to note that the header fields are not guaranteed to
> | be in a particular order.
> `----
Thanks for source. I don't expect from the messages to arrived with
headers in particular order. I just want to display them sorted in
Rmail buffer.
I will try to look at rmail-copy-headers function suggested by Eli and
keep headers in original messages unchanged.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-10 8:06 ` irek
@ 2022-02-10 8:26 ` Jean Louis
0 siblings, 0 replies; 14+ messages in thread
From: Jean Louis @ 2022-02-10 8:26 UTC (permalink / raw)
To: irek; +Cc: help-gnu-emacs
* irek <mail@gumen.pl> [2022-02-10 11:24]:
> Jean Louis <bugs@gnu.support> writes:
> > RFC 5322: Internet Message Format
> > https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6
> >
> > Quote:
> >
> > ,----
> > | It is important to note that the header fields are not guaranteed to
> > | be in a particular order.
> > `----
>
> Thanks for source. I don't expect from the messages to arrived with
> headers in particular order. I just want to display them sorted in
> Rmail buffer.
>
> I will try to look at rmail-copy-headers function suggested by Eli and
> keep headers in original messages unchanged.
You are right. I can see that other mail user software also displays
headers in particular order, like in Mutt, I see 1) Date, 2) From, 3)
To, 4) Cc, 5) Bcc, 6) Subject always in the same order.
Consistent order of those most important header fields is user
interface accessibility issue.
IMHO, RMail should display basic headers in consistent order.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-09 21:43 Fixed order of headers in Rmail messages irek
` (2 preceding siblings ...)
2022-02-10 7:54 ` Jean Louis
@ 2022-02-12 12:27 ` irek
2022-02-12 18:37 ` Jean Louis
3 siblings, 1 reply; 14+ messages in thread
From: irek @ 2022-02-12 12:27 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: Jean Louis, Tassilo Horn
To close topic. I managed to do exactly what I wanted to. Now Rmail
message headers preserve order that is controlled by new list variable
`rmail-ordered-headers'. I wrote custom function that was added around
`rmail-copy-headers' as advice.
Works well for me on old Emacs 25 and new 29 (build from master branch).
Code is available on github. Maybe someone will like that too. I'm
never going back to random mess.
https://github.com/ir33k/rmail-ordered-headers
Thanks for the help and happy coding.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-12 12:27 ` irek
@ 2022-02-12 18:37 ` Jean Louis
2022-02-12 23:10 ` irek
0 siblings, 1 reply; 14+ messages in thread
From: Jean Louis @ 2022-02-12 18:37 UTC (permalink / raw)
To: irek; +Cc: help-gnu-emacs, Jean Louis, Tassilo Horn
* irek <mail@gumen.pl> [2022-02-12 15:27]:
> To close topic. I managed to do exactly what I wanted to. Now Rmail
> message headers preserve order that is controlled by new list variable
> `rmail-ordered-headers'. I wrote custom function that was added around
> `rmail-copy-headers' as advice.
>
> Works well for me on old Emacs 25 and new 29 (build from master branch).
> Code is available on github. Maybe someone will like that too. I'm
> never going back to random mess.
>
> https://github.com/ir33k/rmail-ordered-headers
Please write with it to emacs-devel@gnu.org and offer your patch to
mainstream Emacs.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Fixed order of headers in Rmail messages
2022-02-12 18:37 ` Jean Louis
@ 2022-02-12 23:10 ` irek
0 siblings, 0 replies; 14+ messages in thread
From: irek @ 2022-02-12 23:10 UTC (permalink / raw)
To: Jean Louis; +Cc: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> * irek <mail@gumen.pl> [2022-02-12 15:27]:
>> To close topic. I managed to do exactly what I wanted to. Now Rmail
>> message headers preserve order that is controlled by new list variable
>> `rmail-ordered-headers'. I wrote custom function that was added around
>> `rmail-copy-headers' as advice.
>>
>> Works well for me on old Emacs 25 and new 29 (build from master branch).
>> Code is available on github. Maybe someone will like that too. I'm
>> never going back to random mess.
>>
>> https://github.com/ir33k/rmail-ordered-headers
>
> Please write with it to emacs-devel@gnu.org and offer your patch to
> mainstream Emacs.
Will do so. I will adjust code to Emacs source and propose path.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-02-12 23:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09 21:43 Fixed order of headers in Rmail messages irek
2022-02-10 6:05 ` Tassilo Horn
2022-02-10 7:21 ` irek
2022-02-10 7:44 ` Eli Zaretskii
2022-02-10 8:37 ` Tassilo Horn
2022-02-10 12:03 ` Eli Zaretskii
2022-02-10 6:06 ` Eli Zaretskii
2022-02-10 7:17 ` irek
2022-02-10 7:54 ` Jean Louis
2022-02-10 8:06 ` irek
2022-02-10 8:26 ` Jean Louis
2022-02-12 12:27 ` irek
2022-02-12 18:37 ` Jean Louis
2022-02-12 23:10 ` irek
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).