SORTM(1mh)

πŸ“¦
version 1.8 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– SORTM β€” the "put ur nmh messages in order" manual page πŸ’–

okay bestie, so this is sortm(1mh) from the nmh manual set β€” section 1mh, the commands-your-mail-setup-actually-cares-about zone. it's the little tool that makes ur folder stop being chaotic and start being chronological. let's get into it πŸ¦‹


✨ NAME ✨

sortm β€” sorts nmh messages. that's it. that's the whole job. and it does it beautifully. πŸ’…


🌸 SYNOPSIS 🌸

sortm [-help] [-version] [+folder] [msgs] [-all | -noall] [-datefield
     field] [-textfield field] [-notextfield] [-limit days] [-nolimit]
     [-check | -nocheck] [-verbose | -noverbose]

πŸŽ€ DESCRIPTION πŸŽ€

so sortm sorts the messages you tell it about in the folder you name, and it does it according to the chronological order of the Date: field of each message. chronological. like a timeline. like ur camera roll but for mail. ⭐

if you don't specify any messages, the default is all messages in the folder. periodt.

BUT β€” and this is the plot twist β€” if you don't specify any messages and the -noall switch is enabled, then sortm reports that as an error and exits with non-zero status. no cap. -noall is most useful in the user's profile, to avoid inadvertent sorting of an entire folder (imagine accidentally reordering ur whole life πŸ™ˆ). the -all switch can then be used on the command line to disable it. of course, a message specification of all can be used in any case, so like, options exist.

the -verbose switch directs sortm to tell the user the general actions that it is taking to place the folder in sorted order. it's giving narration. it's giving commentary track. 🫢

the -datefield field switch tells sortm the name of the field to use when making the date comparison. so if the user has a special field in each message β€” like BB-Posted: or Delivery-Date: β€” then the -datefield switch can be used to direct sortm which field to examine. so many fields. so little time. πŸ’œ

the -textfield field switch causes sortm to sort messages by the specified text field. all characters except letters and numbers are stripped and the resulting strings are sorted datefield-major, textfield-minor, using a case insensitive comparison. and if this field is subject, any leading "re:" is stripped off. iconic. the re: erasure we deserve. 🧚

with -textfield field, if -limit days is specified, messages with the same textfields that are dated within days of each other appear together. specifying -nolimit makes the limit infinity. with -limit 0, the sort is instead simply textfield-major. no in-between, we go all the way or we go home.

for example, to order a folder by date-major, grouping messages with the same subject on the same date together, use:

sortm -textfield subject +folder
⚠️ warning time, bestie: sortm always issues a warning for each message that is missing a Date: field, has a Date: field that cannot be parsed, or has a format error in any header field. it's very much not me checking up on u energy.

with the -check switch, sortm inhibits all modifications to the folder if there are any such messages, and exits with non-zero status. nothing gets touched. the folder stays exactly how it was. safety first, queen. πŸ‘‘

with the default of -nocheck, sortm sorts messages with a missing or invalid Date: field using their file modification times. so like, if the date field is lying, we go by vibes (the filesystem's vibes).

when ordering messages based on their dates, if they have the same dates, their original message order is preserved. stable sort behavior, we love to see it. πŸ”₯


πŸ“ FILES πŸ“

  • $HOME/.mh_profile β€” the user profile

🌈 PROFILE COMPONENTS 🌈

  • Path: β€” to determine the user's nmh directory
  • Current-Folder: β€” to find the default current folder

πŸ’« SEE ALSO πŸ’«


πŸ¦‹ DEFAULTS πŸ¦‹

  • +folder defaults to the current folder
  • msgs defaults to all without -noall, has no default with -noall
  • -all
  • -datefield defaults to date
  • -notextfield
  • -noverbose
  • -nolimit
  • -nocheck

πŸ‘‘ CONTEXT πŸ‘‘

if a folder is given, it will become the current folder. and if the current message is moved, sortm will preserve its status as current. main character message energy. it doesn't lose its spot. πŸ’…


🌸 HISTORY 🌸

some glow-up lore for u:

  • timezones used to be ignored when comparing dates: they aren't any more.
  • messages which were in the folder, but not specified by msgs, used to be moved to the end of the folder; now such messages are left untouched. we respect boundaries now.
  • sortm sometimes did not preserve the message numbering in a folder (e.g., messages 1, 3, and 5, might have been renumbered to 1, 2, 3 after sorting). this was a bug, and has been fixed. to compress the message numbering in a folder, use folder -pack as always.

πŸ’€ BUGS πŸ’€

when sortm complains about a message which it can't temporally order, it complains about the message number prior to sorting. it should indicate what the message number will be after sorting. so it's pointing at the before-picture and calling it out. ngl, lowkey confusing, but there it is. 😭


that's the whole page, bestie β€” sortm(1mh), shipped with nmh-1.8, dated 2014-03-23. go forth and sort ur mail. slay, stay chronological, and don't forget ur +folder. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from