REPL(1mh)

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

🌸 NAME 🌸

repl β€” reply to an nmh message. Yes bestie, it's the REPL(1mh) page, and it's about to be your new fave πŸ’–


✨ SYNOPSIS ✨

repl [-help] [-version] [+folder] [msg] [-annotate | -noannotate]
     [-group | -nogroup] [-cc all/to/cc/me] [-nocc all/to/cc/me] [-query
     | -noquery] [-form formfile] [-format | -noformat] [-filter
     filterfile] [-inplace | -noinplace] [-mime | -nomime] [-fcc
     +folder] [-width columns] [-draftfolder +folder] [-draftmessage
     msg] [-nodraftfolder] [-editor editor] [-noedit] [-convertargs type
     argstring] [-whatnowproc program] [-nowhatnowproc] [-atfile]
     [-noatfile] [-fmtproc program] [-nofmtproc] [-build] [-file
     msgfile]

πŸ’… DESCRIPTION πŸ’…

Okay so, repl is literally the "reply to a message" command. That's the whole vibe. πŸ¦‹

In its simplest form (no arguments, just vibes), repl sets up a message-form skeleton replying to the current message in the current folder, and then hands you over to the whatnow shell. Iconic behaviour, honestly.

repl builds the draft of your reply using a reply template. And a reply template is just an mhl format file β€” see mh-format(5) for the whole rundown, iykyk.

If you hand it the -nogroup switch (and heads up, it's on by default), repl reaches for the standard forms file replcomps. What that does is build a draft that's meant to go only to the author of the message you're replying to. And if a file called replcomps is chilling in the user's nmh directory, that one gets used instead of the default forms file. Sneaky. 🫢

The default reply template replcomps tells repl to construct the reply draft like this:

To: <Mail-Reply-To> or <Reply-To> or <From>
cc: <To> and <cc> and <personal address>
Fcc: {fcc switch} or +outbox
Subject: Re: <Subject>
In-Reply-To: <Message-Id>
References: <Message-Id>
Comments: In-Reply-To <From> or <apparently from> or <Sender>
   message dated <date>
--------

Where those field names wrapped in angle brackets (< >) are placeholders for the actual contents of that field, pulled straight from the message you're replying to. Cute, right? ✨

By default, the cc: field is empty. But you can selectively add addresses to it with the -cc type switch. That switch takes an argument β€” all/to/cc/me β€” which says who gets added to the default cc: list of the reply. And you can throw this switch down multiple times with different arguments if you wanna add multiple types of address. Go off. πŸ’…

Now if you give the -group switch instead, repl uses the standard forms file replgroupcomps. That builds a draft meant to be a group or followup reply. Same deal as before: if a file named replgroupcomps lives in the user's nmh directory, it gets used instead of the default forms file β€” unless you specify another forms file on the command line or in your profile. Rules are rules.

The default group reply template replgroupcomps directs repl to build the reply draft like this:

To: <Mail-Followup-To>
Subject: Re: <Subject>
In-Reply-To: Message from <From> of <Date>.
             <Message-Id>
--------

or, if the field <Mail-Followup-To> isn't available:

To: <Mail-Reply-To> or <Reply-To> or <From>
cc: <To> and <cc> and <personal address>
Subject: Re: <Subject>
In-Reply-To: Message from <From> of <Date>.
             <Message-Id>
--------

By default, the cc: holds all the addresses shown. You can selectively remove addresses from that default with the -nocc type switch. It takes an argument β€” all/to/cc/me β€” telling it who gets removed from the default cc: list of the reply. Same as before, give it multiple times with different arguments if you wanna remove multiple types of address. πŸŽ€

Either way, you can always specify an alternative forms file with the -form formfile switch.

The -query switch changes up how the -nocc type switch behaves β€” it interactively asks you whether each address that would normally land in the To: and cc: list should actually get sent a copy. Super handy for special-purpose replies. And important: the position of the -cc and -nocc switches matters, just like every other switch that has a positive and a negative form. Order is not a suggestion here bestie 😭

Lines starting with the fields To:, cc:, and Bcc: get standardized and any duplicate addresses get removed. On top of that, the -width columns switch guides how repl formats those fields. ✨

If the draft already exists, repl will ask you what you wanna do with it. Your options:

  • quit β€” aborts repl, leaves the draft intact
  • replace β€” swaps the existing draft for a blank skeleton
  • list β€” shows you the draft

See comp(1) for the whole story on the -editor and -noedit switches. And ngl, here's a fun detail: while you're in the editor, with -atfile and if the current directory is writable, the message you're replying to is available through a link named @ (assuming the default whatnowproc). Also, the actual pathname of the message gets stored in the environment variable $editalt, and the pathname of the folder holding the message goes in the environment variable $mhfolder. The creation of that @ file is controlled by the -atfile and -noatfile options. 🫢

The -convertargs switch tells repl to pass the arguments for type to mhbuild. Both arguments are required β€” type must be non-empty, while argstring can be empty, like '' on a shell command line. You can use -convertargs multiple times. See the Convert Interface section of mhbuild(1) for a description of the convert mechanism, and /usr/share/doc/nmh/contrib/replaliases for examples of how people actually use it. πŸ’œ

Okay so here's a thing people miss: even though repl uses a forms file to direct how it constructs the beginning of the draft, it uses a message filter file to direct how the message you're replying to should be filtered (aka re-formatted) in the body of the draft. The filter file for repl should be a standard form file for mhl, since repl invokes mhl to format the message you're replying to.

The switches -noformat, -format, and -filter filterfile specify which message filter file to use.

If you give -noformat (it's the default) and you don't use -filter, then the message you're replying to is not included in the body of the draft. Nothing. Nada.

If you give -format, then a default message filter file gets used. That default filter should be enough for most users. Here's the default filter mhl.reply:

; mhl.reply
;
; default message filter for `repl' (repl -format)
;
from:nocomponent,formatfield="%(unquote(decode(friendly{text}))) writes:"
body:component="> ",overflowtext="> ",overflowoffset=0

Which outputs every line of the message body prefaced with the > character and a space. Classic. πŸ”₯

If a file named mhl.reply exists in the user's nmh directory, it gets used instead of this form. And you can specify an alternate message filter file with the -filter filterfile switch.

Other reply filters get used all the time too, like:

:
body:nocomponent,compwidth=9,offset=9

Which says: output a blank line, then the body of the message you're replying to, indented by one tab stop. Another popular format is:

message-id:nocomponent,nonewline,\
formatfield=β€œIn message %{text}, ”
from:nocomponent,formatfield=β€œ%(decode(friendly{text})) writes:”
body:component=β€œ>”,overflowtext=β€œ>”,overflowoffset=0

That message filter file cites the Message-ID and author of the message you're replying to, then outputs each line of the body prefaced with the > character. Chef's kiss. πŸ‘‘

You can also use an external format program to format the message body. That program is specified by the formatproc profile entry, and it's enabled by the format flag. A message filter using an external format program would look like this:

body:component=β€œ>”,nowrap,format

See the mhl(1) documentation for more. And the format program can be swapped with the -fmtproc program and -nofmtproc switches. 🌈

To use the MIME rules for encapsulation, specify the -mime switch. That directs repl to generate an mhbuild composition file. But heads up: nmh will not invoke mhbuild automatically β€” you have to specifically give the command

What now? mime

before sending the draft. Do not skip this, bestie, I'm begging 😭

If you give the -annotate switch, the message you're replying to gets annotated with the lines

Replied: date Replied: addrs

where the address list contains one line for each addressee. That annotation only happens if the message is sent directly from repl. If it's not sent immediately from repl, you can use comp -use to re-edit and send the constructed message β€” but the annotations won't take place. Normally annotations are done inplace to preserve any links to the message. You can use the -noinplace switch to change that. πŸŽ€

Even though the default template says a copy of the reply goes in the folder outbox, if you give the -fcc +folder switch it overrides that default value. And you can name more than one folder, each one preceded by -fcc. Stack 'em. πŸ’…

On top of all the standard mh-format(5) escapes, repl also recognizes this additional component escape:

Escape  Returns  Description
fcc     string   Any folders specified with `-fcc folder'

To avoid reiteration, repl strips any leading Re: strings from the subject component. Not me letting it handle that for me πŸ™ˆ

The -draftfolder +folder and -draftmessage msg switches invoke the nmh draft folder facility. It's an advanced (and highly useful) feature. Consult mh-draft(5) for more info. ✨

When you exit the editor, repl invokes the whatnow program. See whatnow(1) for a discussion of available options. You can inhibit that invocation with the -nowhatnowproc switch. (And fun fact: it's actually the whatnow program that starts the initial edit. So -nowhatnowproc prevents any edit from occurring. Wild, right?)

The -build switch is meant to be used by the Emacs mh-e interface to nmh. It implies -nowhatnowproc. It causes a file <mh-dir>/reply to be created, containing the draft message that would normally be shown to the user for editing. No mail is actually sent. πŸ¦‹

The -file msgfile switch specifies the message to be replied to as an exact filename rather than as an nmh folder and message number. The same caveats apply to this option as to the -build switch. πŸ‘‘

🌸 FILES 🌸

okay so bestie, repl is a little bit extra about where it finds stuff. it looks for all format, filter and template files in multiple locations, in this order:

  • absolute pathnames are accessed directly πŸ’…
  • tilde expansion is done on usernames ✨
  • files are searched for in the user's Mail directory as specified in their profile πŸŽ€
  • if not found there, the directory /etc/nmh is checked. she's the fallback queen πŸ‘‘

here's the whole cast of files, no cap:

  • /etc/nmh/replcomps β€” the standard reply template πŸ’Œ
  • or <mh-dir>/replcomps β€” rather than the standard template
  • /etc/nmh/replgroupcomps β€” the standard reply -group template πŸ‘―
  • or <mh-dir>/replgroupcomps β€” rather than the standard template
  • /etc/nmh/mhl.reply β€” the standard message filter 🧚
  • or <mh-dir>/mhl.reply β€” rather than the standard filter
  • $HOME/.mh_profile β€” the user profile 🫢
  • <mh-dir>/draft β€” the draft file πŸ“

πŸ’– PROFILE COMPONENTS πŸ’–

these are the profile entries she's lowkey obsessed with checking:

  • Path: β€” to determine the user's nmh directory
  • Alternate-Mailboxes: β€” to determine the user's mailboxes πŸ“¬
  • Current-Folder: β€” to find the default current folder
  • Draft-Folder: β€” to specify the default draftfolder
  • Editor: β€” to override the default editor ✍️
  • Msg-Protect: β€” to set mode when creating a new message (draft)
  • fileproc: β€” program to refile the message
  • mhlproc: β€” program to filter message being replied-to
  • whatnowproc: β€” program to ask the β€œWhat now?” questions ❓

🌈 SEE ALSO 🌈

go read these, bestie, they're literally the whole friend group:

and also this lil guy:

/usr/share/doc/nmh/contrib/replaliases

✨ DEFAULTS ✨

if you don't say anything, here's what she just does, periodt:

  • +folder defaults to the current folder
  • msg defaults to cur
  • -nogroup
  • -nocc all with -nogroup, -cc all with -group
  • -noannotate
  • -nodraftfolder
  • -noformat
  • -inplace
  • -nomime
  • -noquery
  • -noatfile
  • -width 72

πŸ¦‹ CONTEXT πŸ¦‹

if a folder is given, it will become the current folder. main character move, honestly πŸ‘‘

and the message replied to will become the current message. so she is the moment πŸ’…


πŸ’€ BUGS πŸ’€

okay so there are a few little gremlins here, and we're gonna be honest about them because that's what besties do:

if any addresses occur in the reply template, addresses in the template that do not contain hosts are defaulted incorrectly. instead of using the localhost for the default, repl uses the sender's host. moral of the story: if you're going to include addresses in a reply template, include the host portion of the address. 😭 no shortcuts, bestie!
the -width columns switch is only used to do address-folding; other headers are not line-wrapped. so don't expect a glow-up on the other headers, she simply won't do it πŸ™ˆ
if whatnowproc is whatnow, then repl uses a built-in whatnow, it does not actually run the whatnow program. hence, if you define your own whatnowproc, don't call it whatnow since repl won't run it. 🚨 important!! name it literally anything else or she'll just ghost it πŸ«₯

and that's the whole page, bestie πŸŽ€ this was nmh-1.8, dated 2022-12-22, aka REPL(1mh) β€” go forth and reply to your mail with main character energy πŸ’œβœ¨

πŸ“¦ where this page comes from