nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Relative Message Numbers

2013-04-03 07:24:35
bill wrote:
norm@dad.org writes:

Ken Hornstein <kenh@pobox.com> writes:

Hm.  I'm torn.  So, it looks like it's okay in terms of syntax; "_" is
not a valid character in a sequence.  But what are the semantics if
'name' refers to more than one message?

Then name+n is the nth message of name; name_n is the nth to last message 
of name.(1 based ordinals. That is, name+1 is the first message of name 
and name_1 is the last message of name).

Hey Norm, how is this useful? I can't see anyone manually referring to
the nth item in a sequence on the command line. The point of a sequence

    $ scan unseen
    ...notice that third-from-end message is spam...
    $ refile unseen_3 +spam

is that you don't have to know the constituents. Maybe you have a use
case.

If this is for programmatic use, it seems that something like

    for i in $(mark -list -sequence cur | cut -f 1 -d " " --complement); do
        scan $i;
    done

would be clearer.

Saaay, it just occurred to me. Maybe we should adopt MH-E's syntax.
Norm, please check out MH-E ranges [1]. While it's not identical to your
specification, it sure is nifty for MH-E users. If this works for you,
maybe applying the same syntax to nmh would mean that many more users
would be more familiar with the syntax than with _.

http://mh-e.sourceforge.net/manual/html/Ranges.html

with the exception of the mh-interpret-number-as-range-flag flag,
i think everything described on that page is existing mh
behavior.

you asked how the syntax norm requested was useful for sequences.  as
noted, mh already supports the notion of ranges within sequences: 
"unseen:3" is the first 3 unseen messages, and unseen:-5 is the last 5. 
those are both great if you want to work with a short block of
messages.

but you can't refer to a single message using that syntax, unless it
happens to be the first or last in the sequence (i.e., unseen:-1). 
the new "unseen+3" syntax lets you refer to the (single) third unseen
message.

paul
----------------------
 paul fox, pgf@foxharp.boston.ma.us (arlington, ma, where it's 30.4 degrees)

_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>