[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] Relative Message Numbers

From: Paul Fox
Subject: Re: [Nmh-workers] Relative Message Numbers
Date: Thu, 11 Apr 2013 13:57:05 -0400

i wrote:
 > ... a bunch of stuff about the semantics of relative msg numbering...
 > ...but now that i'm writing this, i think i see that the way out might
 > simply be to stop using a syntax that looks like arithmetic.  so johan
 > viklund's suggestion might be right on the money:
 >  > What about foo#3 and foo#-3? This would mirror the : in sequences,
 >  > 
 >  > foo:-3 (three messages from end of foo)
 >  > foo#-3 (third message from foo's end)

i think this turns out to be a good solution, in that it doesn't
try to look too much like arithmetic, and it mirrors the existing
range syntax.

to keep with the bikeshedding vein, it occurred to me that '=' might
be a better character to use than '#'.  i'm not sure why i think so --
perhaps because of the commentary associations with '#', perhaps
because '=' is visually similar to '-', and (for US keyboards at
least) it's usually lowercase and right next to '-'.

i've implemented the code using '=', but that's clearly still open
for discussion, and easily changed.

using the new syntax provides a nice predictable relationship between
the two expressions:  the message selected by '=n' is always the last
(or first, if n is negative) message selected by ':n'.  so if name:3

then name=3 will always give

as a lazy typist, when i started i was concerned about the "foo#-3"
string, which i found quite hard to type -- and this is, after all, a
convenience feature.  i addressed this with a minor
syntactical trick:  by allowing the '-' to be optionally replaced by a
second '=' character, it reduces 4 awkward characters to just 3, i.e.,
"foo#-3" can be entered as "foo##3".  for symmetry, i added the same
trick for ranges, so that "foo:-3" can be expressed as "foo::3" if you
wish.  i hope no one thinks that's too terrible an idea.   after switching
to '=' as the delimeter, typing "foo=-3" isn't so bad, but i still prefer
the "stuttered" nature of "foo==3".

for reference/review, here's a diff of the mh-sequence.man page as my
changes currently stand.

--- /tmp/oo     2013-04-11 13:42:49.000000000 -0400
+++ /tmp/nn     2013-04-11 13:42:18.000000000 -0400
@@ -44,21 +44,30 @@
        The  specification “name1-name2” designates all currently existing mes‐
        sages from `name1' to `name2' inclusive.  The “reserved”  message  name
        “all” is a shorthand for the message range “first-last”.
        The  specification  “name:n” designates up to `n' messages.  These mes‐
        sages start with `name' if `name' is a message number  or  one  of  the
        reserved  names “first” “cur”, or “next”, The messages end with `name'
        if `name' is “prev” or “last”.  The interpretation of `n' may be  over‐
        ridden by preceding `n' with a plus or minus sign; `+n' always means up
        to `n' messages starting with `name', and `-n' always means up  to  `n'
-       messages ending with `name'.
+       messages  ending  with  `name'.  For typing convenience, “name:-n” may
+       also be entered as “name::n”.
+       Substituting `=' for `:' (i.e., “name=n”)  will reduce  the  selection
+       from  a range  of up to `n' messages, to a selection of just the `n'th
+       message.  So for example, while “name:-3” selects the 3 messages ending
+       with `name', “name=-3” selects just the 2nd previous message.  It is an
+       error if the requested message  does  not  exist  (i.e.,  there aren't
+       enough  messages in the folder).  For typing convenience, “name=-n” may
+       also be entered as “name==n”.
        In commands which accept a `msgs' argument, the default is either “cur”
        or “all”, depending on which makes more sense for each command (see the
        individual man pages for details).  Repeated specifications of the same
        message have the same effect as a single specification of the message.
        There is also a special “reserved” message name “new” which is used  by
        the mhpath command.
    User-Defined Message Sequences
@@ -80,20 +89,29 @@
        of the user-defined sequence `name'.
        The specifications “name:next” and “name:prev” may also be  used,  and
        they  designate the  next or previous message (relative to the current
        message) which is an element of the user-defined sequence `name'.   The
        specifications  “name:first” and “name:last” are equivalent to “name:1”
        and “name:-1”,  respectively.   The  specification  “name:cur”  is  not
        allowed (use  just  “cur” instead).  The syntax of these message range
        specifications is subject to change in the future.
+       Single  messages (as opposed to ranges) may also be selected by substi‐
+       tuting `=' for `:', as in “name=n”.  This  will reduce  the  selection
+       from  being a range of up to `n' messages, to being a selection of just
+       the `n'th message.  So while “seq:5” selects the first  5  messages  of
+       seqence `seq',  “seq=5”  selects just the 5th message of the sequence.
+       It is an error if the requested message does  not  exist  (i.e.,  there
+       aren't at least `n' messages in the sequence).  For typing convenience,
+       “name=-n” may also be entered as “name==n”.
        User-defined sequence names are specific  to  each  folder.   They  are
        defined using the pick and mark commands.
    Public and Private User-Defined Sequences
        There  are two varieties of user-defined sequences: public and private.
        Public sequences of a folder are accessible to any nmh  user  that  can
        read  that folder.  They are kept in each folder in the file determined
        by the “mh-sequences” profile entry (default is .mh_sequences).   Pri‐
        vate  sequences are accessible only to the nmh user that defined those
        sequences and are kept in the user's nmh context file.

 paul fox, address@hidden (arlington, ma, where it's 46.2 degrees)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]