{
    "mode": "man",
    "parameter": "mh-sequence",
    "section": "5mh",
    "url": "https://www.chedong.com/phpMan.php/man/mh-sequence/5mh/json",
    "generated": "2026-06-15T16:42:37Z",
    "sections": {
        "NAME": {
            "content": "mh-sequence - sequence specification for nmh message system\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "A  sequence (or sequence set) is a symbolic name representing a message or collection of mes‐\nsages.  nmh has several internally defined sequences, as well as  allowing  users  to  define\ntheir own sequences.\n",
            "subsections": [
                {
                    "name": "Message Specification and Pre-Defined Message Sequences",
                    "content": "Most  nmh  commands accept a `msg' or `msgs' specification, where `msg' indicates one message\nand `msgs' indicates one or more messages.  To designate a message, you may  use  either  its\nnumber (e.g., 1, 10, 234) or one of these “reserved” message names:\n\nfirst  the first message in the folder\nlast   the last message in the folder\ncur    the most recently accessed message\nprev   the message numerically preceding “cur”\nnext   the message numerically following “cur”\n\nIn commands that take a `msg' argument, the default is “cur”.  As a shorthand, “.” is equiva‐\nlent to “cur”.\n\nFor example: In a folder containing five messages numbered 5, 10, 94, 177 and 325, “first” is\n5 and “last” is 325.  If “cur” is 94, then “prev” is 10 and “next” is 177.\n\nThe  word  `msgs' indicates that one or more messages may be specified.  Such a specification\nconsists of one message designation or of several message  designations,  as  separate  argu‐\nments.   A  message designation consists either of a message name as defined above, or a mes‐\nsage range.\n\nA message range is specified as “name1-name2” or “name:n”, where `name', `name1' and  `name2'\nare message names, and `n' is an integer.\n\nThe  specification  “name1-name2”  designates all currently existing messages from `name1' to\n`name2' inclusive.  The “reserved” message name “all” is a shorthand for  the  message  range\n“first-last”.\n\nThe  specification  “name:n” designates up to `n' messages.  These messages start with `name'\nif `name' is a message number or one of the reserved names “first” “cur”, or “next”, The mes‐\nsages  end with `name' if `name' is “prev” or “last”.  The interpretation of `n' may be over‐\nridden by preceding `n' with a plus or minus sign; `+n'  always  means  up  to  `n'  messages\nstarting with `name', and `-n' always means up to `n' messages ending with `name'.\n\nSubstituting `=' for `:' (i.e., “name=n”) will reduce the selection from a range of up to `n'\nmessages, to a selection of just the `n'th message.  So for example, while “name:-3”  selects\nthe 3 messages ending with `name', “name=-3” selects just the 2nd previous message.  It is an\nerror if the requested message does not exist (i.e., there  aren't  enough  messages  in  the\nfolder).\n\nIn  commands  which accept a `msgs' argument, the default is either “cur” or “all”, depending\non which makes more sense for each command (see the individual man pages for  details).   Re‐\npeated  specifications  of the same message have the same effect as a single specification of\nthe message.\n\nThere is also a special “reserved” message name “new” which is used by the mhpath command.\n"
                },
                {
                    "name": "User-Defined Message Sequences",
                    "content": "In addition to the “reserved” (pre-defined) message names given above, nmh supports  user-de‐\nfined sequence names.  User-defined sequences allow the nmh user a tremendous amount of power\nin dealing with groups of messages in the same folder by allowing the user to bind a group of\nmessages to a meaningful symbolic name.\n\nThe  name  used to denote a message sequence must consist of an alphabetic character followed\nby zero or more alphanumeric characters, and can not be one of the “reserved”  message  names\nabove.   After defining a sequence, it can be used wherever an nmh command expects a `msg' or\n`msgs' argument.\n\nSome forms of message ranges are allowed  with  user-defined  sequences.   The  specification\n“name:n”  may  be  used, and it designates up to the first `n' messages (or last `n' messages\nfor `-n') which are elements of the user-defined sequence `name'.\n\nThe specifications “name:next” and “name:prev” may also be used, and they designate the  next\nor previous message (relative to the current message) which is an element of the user-defined\nsequence `name'.  The specifications “name:first” and “name:last” are equivalent to  “name:1”\nand “name:-1”, respectively.  The specification “name:cur” is not allowed (use just “cur” in‐\nstead).  The syntax of these message range specifications is subject to change in the future.\n\nSingle messages (as opposed to ranges) may also be selected by substituting `=' for  `:',  as\nin “name=n”.  This will reduce the selection from being a range of up to `n' messages, to be‐\ning a selection of just the `n'th message.  So while “seq:5” selects the first 5 messages  of\nsequence  `seq', “seq=5” selects just the 5th message of the sequence.  It is an error if the\nrequested message does not exist (i.e., there aren't at least `n' messages in the sequence).\n\nUser-defined sequence names are specific to each folder.  They are defined using the pick and\nmark commands.\n"
                },
                {
                    "name": "Public and Private User-Defined Sequences",
                    "content": "There are two varieties of user-defined sequences: public and private.  Public sequences of a\nfolder are accessible to any nmh user that can read that  folder.   They  are  kept  in  each\nfolder in the file determined by the “mh-sequences” profile entry (default is .mhsequences).\nPrivate sequences are accessible only to the nmh user that defined those  sequences  and  are\nkept in the user's nmh context file.\n\nIn general, the commands that create sequences (such as pick and mark) will create public se‐\nquences if the folder for which the sequences are being defined is writable by the nmh  user.\nFor most commands, this can be overridden by using the switches -public and -private.  But if\nthe folder is read-only, or if the “mh-sequences” profile entry is defined  but  empty,  then\nprivate sequences will be created instead.\n"
                },
                {
                    "name": "Sequence Negation",
                    "content": "Nmh  provides the ability to select all messages not elements of a user-defined sequence.  To\ndo this, the user should define the entry “Sequence-Negation” in the nmh  profile  file;  its\nvalue  may  be  any string.  This string is then used to preface an existing user-defined se‐\nquence name.  This specification then refers to those messages not elements of the  specified\nsequence name.  For example, if the profile entry is:\n\nSequence-Negation: not\n\nthen  any  time an nmh command is given “notfoo” as a `msg' or `msgs' argument, it would sub‐\nstitute all messages that are not elements of the sequence “foo”.\n\nObviously, the user should beware of defining sequences with names that begin with the  value\nof the “Sequence-Negation” profile entry.\n"
                },
                {
                    "name": "The Previous Sequence",
                    "content": "Nmh  provides  the ability to remember the `msgs' or `msg' argument last given to an nmh com‐\nmand.  The entry “Previous-Sequence” should be defined in the nmh profile; its  value  should\nbe  a  sequence name or multiple sequence names, as separate arguments.  If this entry is de‐\nfined, when an nmh command finishes, it will define the sequence(s) named  in  the  value  of\nthis  entry  to be those messages that were specified to the command.  Hence, a profile entry\nof\n\nPrevious-Sequence: pseq\n\ndirects any nmh command that accepts a `msg' or `msgs' argument to define the sequence “pseq”\nas those messages when it finishes.\n\nNote: there can be a performance penalty in using the “Previous-Sequence” facility.  If it is\nused, all nmh programs have to write the sequence information to the .mhsequences  file  for\nthe  folder  each  time  they run.  If the “Previous-Sequence” profile entry is not included,\nonly pick and mark will write to the .mhsequences file.\n"
                },
                {
                    "name": "The Unseen Sequence",
                    "content": "Finally, many users like to indicate which messages have not been previously  seen  by  them.\nThe commands flist, inc, mhshow, rcvstore, and show honor the profile entry “Unseen-Sequence”\nto support this activity.  This entry in the .mhprofile should be defined as one or more se‐\nquence  names,  as separate arguments.  If there is a value for “Unseen-Sequence” in the pro‐\nfile, then whenever new messages are placed in a folder (using inc or rcvstore), the new mes‐\nsages  will  also  be added to all the sequences named in this profile entry.  For example, a\nprofile entry of\n\nUnseen-Sequence: unseen\n\ndirects inc to add new messages to the sequence “unseen”.  Unlike the behavior of the “Previ‐\nous-Sequence” entry in the profile, however, the sequence(s) will not be zeroed by inc.\n\nSimilarly,  whenever show, mhshow, next, or prev displays a message, that message will be re‐\nmoved from any sequences named by the “Unseen-Sequence” entry in the profile.\n"
                },
                {
                    "name": "Sequence File Format",
                    "content": "The sequence file format is based on the RFC 5322 message format.  Each line of the  sequence\nfile  corresponds to one sequence.  The line starts with the sequence name followed by a `:',\nthen followed by a space-separated list of message numbers that correspond to  messages  that\nare  part  of  the  named  sequence.   A  contiguous  range of messages can be represented as\n“lownum-highnum”.\n"
                },
                {
                    "name": "Sample sequence file",
                    "content": "work: 3 6 8 22-33 46\nunseen: 47 49-51 54\ncur: 46\n\nNmh commands that modify the sequence file will silently  remove  sequences  for  nonexistent\nmessages  when  the  sequence  file is updated.  The exception to this is the “cur” sequence,\nwhich is allowed to point to a nonexistent message.\n"
                },
                {
                    "name": "Sequence File Locking",
                    "content": "The “datalocking” profile entry controls the type of locking used when  reading  and  writing\nsequence  files.   The locking mechanisms supported are detailed in mh-profile(5).  This pro‐\ntects sequence file integrity when multiple nmh commands are run  simultaneously.   Nmh  com‐\nmands  that  modify the sequence file use transactional locks; the lock is held from the time\nthe sequence file is read until it it written out.  This ensures that  modifications  to  the\nsequence file will not be lost if multiple commands are run simultaneously.  Long-running nmh\ncommands, such as inc and pick, will release the sequence lock during the bulk of their  run‐\ntime  and  reread  the  sequence  file after their processing is complete to reduce lock con‐\ntention time.\n\nNote: Currently transactional locks are only supported  for  public  sequences;  private  se‐\nquences will not get corrupted, but the possibility exists that two nmh commands run simulta‐\nneously that add messages to a private sequence could result in one  command's  messages  not\nappearing on the requested sequence.\n"
                }
            ]
        },
        "FILES": {
            "content": "$HOME/.mh-profile   The user's profile.\n<mh-dir>/context    The user's context.\n<folder>/.mh-sequences\nFile for public sequences.\n",
            "subsections": []
        },
        "PROFILE COMPONENTS": {
            "content": "mh-sequences:       Name of file to store public sequences.\nSequence-Negation:  To designate messages not in a sequence.\nPrevious-Sequence:  The last message specification given.\nUnseen-Sequence:    Those messages not yet seen by the user.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "flist(1), mark(1), pick(1), mh-profile(5)\n",
            "subsections": []
        },
        "DEFAULTS": {
            "content": "None\n\n\n\nnmh-1.7.1                                    2013-10-17                             MH-SEQUENCE(5mh)",
            "subsections": []
        }
    },
    "summary": "mh-sequence - sequence specification for nmh message system",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "flist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/flist/1/json"
        },
        {
            "name": "mark",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mark/1/json"
        },
        {
            "name": "pick",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pick/1/json"
        },
        {
            "name": "mh-profile",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/mh-profile/5/json"
        }
    ]
}