<<< Date Index >>>     <<< Thread Index >>>

Re: Sorting headers in message viewer ?



On Fri, Oct 19, 2007 at 10:28:37PM +0000, Dave Evans wrote:
> > Now, if hdr_order was able to intepret lack of an argument as
> > "sort everything in alphabetical order"... Or perhaps a trailing
> > "*" as "sort any other headers in alphabetical order"...
> 
> That would indeed be useful.  Or regexps (e.g. hdr_order ^List- ^X-).

I don't know if this is documented (it's not documented at
http://www.mutt.org/doc/manual/manual-3.html#hdr_order anyway), but the way
that hdr_order works, at least in my Ubuntu mutt package, is as follows:

An array is created which is one longer than the number of entries in
hdr_order.  Each slot except the last in the array will hold the headers which
match the corresponding hdr_order entry; the last slot holds the headers which
did not match any hdr_order entry.  Matching is done on a case-insensitive(?),
string prefix basis.

So for example, given "hdr_order From: To: X- List-",

 slot 1 is all headers which begin with "From:"
 slot 2 is likewise but for "To:";
 slot 3 is likewise but for "X-" (so all the X- headers will go into this
 slot);
 slot 4 is likewise but for "List-" (so all the List- headers go here);
 slot 5 is all the other headers.

Each slot ends up containing a subset of the original headers, in the same
order as the original message.  Finally, the headers from each slot are
output, in order.

So in the example "hdr_order From Date: From: To: Cc: Subject:" (taken from
http://www.mutt.org/doc/manual/manual-3.html#hdr_order ), all the headers
which begin with "From" (e.g. From: From-Foo: Frome:) come first, followed by
the "Date:" header (all of them, if there are multiple Date: headers); the
third item, "From:" is redundant, because anything matching "From:" would
already have matched "From"; then all the "To:" headers, then "Cc:", then
"Subject:", then the rest.

So you can already do something like "hdr_order From: To: Cc: Date: Subject:
X- List- Received:"; this will group all the X- headers together (and likewise
all the List- headers), but it won't sort them.  Still, I hope it helps.

-- 
Dave Evans
http://djce.org.uk/
http://djce.org.uk/pgpkey

Attachment: signature.asc
Description: Digital signature