[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] Request for sortm feature to implement arbitrary messa
Re: [Nmh-workers] Request for sortm feature to implement arbitrary message ordering
Thu, 26 Jun 2014 07:02:17 +0700
Date: Wed, 25 Jun 2014 08:03:37 -0700
| Yes, I was thinking of of a fork/exec for each message pair, for which
| sortm wanted a comparison.
| [..] The variation you propose would make little difference to the author
| of the command, which would usually be a script.
Personally I don't think that would be workable, and I don't think you'd
like the result if it was done that way - for two reasons. First, the number
of forks and execs (and then extra processes if it really was a script,
with lots more commands to run perhaps) would make the whole thing, even on
modern hardware, way too slow for more than a small number of messages to
sort. And second, chances are that you'd want to run some nmh type command
somewhere in your script, and we know that nmh doesn't really support that,
the processes keep too much info cached in mem for anything that any other
command might do (even just changing cur) to have any kind of reasonable
But, if I have guessed the real issue correctly, I think a different change to
sortm (that it really could do with), perhaps in combination with a use of
anno to deal with cases where you really would want to use a script. would get
more complex sort operations to work.
The change to sortm would be to allos as many -datefield and -textfield
args as you like, (with each -datefield potentially having an accompanying
-limit, which could perhaps have expanded syntax so it didn't just allow days)
and to add -numericfield and -addrfield (also as many times as you like)
and a -nofields to clear everything. The idea is that you can define any
header fields to sort based upon, in any order (with later fields being
relevant only if earlier ones compare "equal" (which for datefields, and
perhaps others if a sensible semantic could be determined, depends on the
value of -limit for that field). -nofields would be to reset the default
"-datefield date" that keeps sortm compatible with the original MH sortm
that allowed only that.
With just this change, you can probably sort almost anything you desire,
without extra scripts - when this isn't enough, and you want to specify more,
adding an extra header (and then deleting it afterwards if desired) with
-anno and a value (numeric text, date or whatever rings your bell format)
that coerces the relevant messages to sort the way that you want, and then
specify that new header in the appropriate -xxxfield arg to sortm.
If you think that might allow you to do what you need, then (given 1.7
isn't happening any time very soon) I might find the time to see if this
is implementable (if no-one else does it before me) - I always thought the
-textfield/-datefield interaction in sortm was a bit weird, and always also
kind of wanted a way to be able to sort based upon address fields in a
rational way (specifying them as textfields doesn't work rationally at all,
and nor should it).
ps: no problem with an option to cause sortm to not actually make changes,
I think the main problem with that currenlly is that no-one knows what would
actually be a good name for the option, I don't really think -recon is
obvious enough to be usable.