MHL(1)
β¨ NAME β¨
mhl β it makes formatted listings of nmh messages. that's it, that's the whole vibe, and it ate π
π SYNOPSIS π
/usr/libexec/nmh/mhl [-help] [-version] [-bell | -nobell] [-clear |
-noclear] [-folder +folder] [-form formfile] [-length lines]
[-width columns] [-moreproc program] [-nomoreproc] [-fmtproc
program] [-nofmtproc] [files ...]
πΈ DESCRIPTION πΈ
okay bestie, sit down, hydrate, because mhl is the moment. it's an nmh command for filtering and/or displaying text messages, and it's the default way nmh shows you text messages (it's literally the default showproc, main character energy fr fr π).
so here's the tea. just like with more, every message you hand over as an argument (or the standard input) gets output. and if you're throwing more than one message file at it, it's gonna prompt you before each one β a <RETURN> or <EOT> starts the output, where <RETURN> clears the screen (if appropriate), and <EOT> (usually CTRL-D) suppresses the screen clear. an <INTERRUPT> (usually CTRL-C) aborts the current message output and prompts for the next message (if there even is one), and a <QUIT> (usually CTRL- will terminate the program (without core dump).
now, the -bell option tells mhl to ring the terminal's bell at the end of each page, while -clear tells it to clear the screen at the end of each page (or output a formfeed after each message). both of these switches (and their inverse counterparts) only do anything if the profile entry moreproc is defined but empty, AND mhl is outputting to a terminal. if the moreproc entry is defined and non-empty, and mhl is outputting to a terminal, then mhl will cause the moreproc to be placed between the terminal and mhl, and the switches are just... ignored, bestie, they said not today. furthermore, if you use the -clear switch and mhl's output is directed to a terminal, then mhl consults the TERM and TERMCAP environment variables to figure out your terminal type so it knows how to clear the screen. but if -clear is given and the output is not directed to a terminal (like a pipe or a file), then mhl sends a formfeed after each message. slay.
to override the default moreproc and the profile entry, use the -moreproc program switch. and note: mhl will never start a moreproc if it's invoked on a hardcopy terminal. periodt.
the -length length and -width width switches set the screen length and width respectively. these default to whatever TERMCAP says (if appropriate), otherwise they default to 40 and 80 respectively.
the default format file mhl uses is called mhl.format. mhl first searches for this file in your nmh directory, and then searches in the directory /etc/nmh. you can change that default with the -form formatfile switch.
and finally, the -folder +folder switch sets the nmh folder name, which is used for the "messagename:" field described down below. the environment variable $mhfolder is consulted for the default value, which next, show, and prev initialize appropriately. π«Ά
π¦ how it actually works (the two-phase moment) π¦
mhl operates in two phases:
- read and parse the format file
- process each message (file)
during phase 1, an internal description of the format is produced as a structured list. during phase 2, that list gets walked for each message, outputting message information under the format constraints from the format file.
the format file can contain info controlling screen clearing, screen size, wrap-around control, transparent text, component ordering, and component formatting. also, you can specify a list of components to ignore, and there are a couple of "special" components defined to provide added functionality. message output will be in the order specified by the order in the format file. iykyk β¨
π format file line forms π
every line of a format file is one of these:
;comment
:cleartext
variable[,variable...]
component:[variable,...]
- a line beginning with a
;is a comment, and is ignored. - a line beginning with a
:is clear text, and is output exactly as is. - a line containing only a
:produces a blank line in the output. - a line beginning with "component:" defines the format for the specified component.
- remaining lines define the global environment.
for example, this line:
width=80,length=40,clearscreen,overflowtext="***",overflowoffset=5
defines the screen size to be 80 columns by 40 rows, specifies that the screen should be cleared prior to each page, that the overflow indentation is 5, and that overflow text should be flagged with "***". iconic.
π all the variables, no cap π
here's every current variable and its argument. if they follow a component, they apply only to that component β otherwise their effect is global. and since the whole format gets parsed before any output processing happens, the last global switch setting for a variable applies to the whole message if that variable is used in a global context (i.e., bell, clearscreen, width, length).
widthβ integer β screen width or component widthlengthβ integer β screen length or component lengthoffsetβ integer β positions to indent "component: "overflowtextβ string β text to use at the beginning of an overflow lineoverflowoffsetβ integer β positions to indent overflow linescompwidthβ integer β positions to indent component text after the first line is outputuppercaseβ flag β output text of this component in all upper casenouppercaseβ flag β don't uppercaseclearscreenβ flag/G β clear the screen prior to each pagenoclearscreenβ flag/G β don't clearscreenbellβ flag/G β ring the bell at the end of each pagenobellβ flag/G β don't bellcomponentβ string/L β name to use instead of "component" for this componentnocomponentβ flag β don't output "component: " for this componentcenterβ flag β center component on line (works for one-line components only)nocenterβ flag β don't centerleftadjustβ flag β strip off leading whitespace on each line of textnoleftadjustβ flag β don't leftadjustrtrimβ flag β trim whitespace at end of text linesnortrimβ flag β retain whitespace at end of text lines (default)compressβ flag β change newlines in text to spacesnocompressβ flag β don't compresswrapβ flag β Wrap lines that exceed width (default)nowrapβ flag β Do not perform line wrappingsplitβ flag β don't combine multiple fields into a single fieldnosplitβ flag β combine multiple fields into a single fieldnewlineβ flag β print newline at end of components (this is the default)nonewlineβ flag β don't print newline at end of componentsformatfieldβ string β format string for this component (see below)decodeβ flag β decode text as RFC 2047 encoded header fieldaddrfieldβ flag β field contains addressesdatefieldβ flag β field contains datesformatβ flag β Run component through formatproc filter (body only)noformatβ flag β Do not run component through formatproc filter (default)formatargβ string β Argument to format filter
to specify the value of integer-valued and string-valued variables, follow their name with an equals-sign and the value. integer-valued variables get decimal values, while string-valued variables get arbitrary text bracketed by double-quotes. and if a value is suffixed by "/G" or "/L", then its value is useful in a global-only or local-only context (respectively). got it? good. π
π the special bits π
a line of this form:
ignores=component,...
specifies a list of components which are never output.
the component "MessageName" (case-insensitive) will output the actual message name (file name) preceded by the folder name if one is specified or found in the environment. the format is identical to that produced by the -header option to show.
the component "Extras" will output all of the components of the message which were not matched by explicit components, or included in the ignore list. if this component is not specified, an ignore list is not needed since all non-specified components will be ignored. convenient β¨
if "nocomponent" is not specified, then the component name will be output as it appears in the format file.
π the default format file π
it's literally this:
; mhl.format
;
; default message filter for `show'
;
:
overflowtext="***",overflowoffset=5
leftadjust,compwidth=9
ignores=msgid,message-id,received,content-type,content-transfer-encoding,content-id
Resent-To:formatfield="%(unquote(decode{text}))"
Resent-cc:formatfield="%(unquote(decode{text}))"
Resent-From:formatfield="%(unquote(decode{text}))"
Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>"
To:formatfield="%(unquote(decode{text}))"
cc:formatfield="%(unquote(decode{text}))"
From:formatfield="%(unquote(decode{text}))"
Subject:decode
:
extras:nocomponent
:
body:nocomponent,overflowtext=,overflowoffset=0,noleftadjust
the variable "formatfield" specifies a format string (see mh-format(5)). the flag variables "addrfield" and "datefield" (which are mutually exclusive) tell mhl to interpret the escapes in the format string as either addresses or dates, respectively.
by default, mhl does not apply any formatting string to fields containing address or dates (see mh-mail(5) for a list of these fields). note that this results in faster operation since mhl must parse both addresses and dates in order to apply a format string to them. if you want, mhl can be given a default format string for either address or date fields (but not both). to do this, on a global line specify: either the flag addrfield or datefield, along with the appropriate formatfield variable string. π
The βformatβ flag says: bestie, run this component through the filter program named in the formatproc profile entry. That filter is expected to read from standard input and write to standard output, like a good little pipe citizen. Right now the βformatβ flag only works for the βbodyβ component β the other components are sitting there like π. And the component name gets prefixed onto the output after the filter has done its thing. The whole point, the dream, the vision: filter a message body so you get prettier text to drop into a reply. πΈ
A suggested filter for repl(1) is literally this:
body:component=">",overflowtext=">",overflowoffset=0,format,nowrap
If you wanna override the formatproc profile entry, the -fmtproc and -nofmtproc switches are right there, no cap. π
The formatarg option hands you a string that gets used as an argument to the format filter. That string goes through mh-format(5) β iconic β and all the message components are available to play with. And yes, you can stack multiple formatarg options to build up multiple arguments for the format filter. Obsessed. β¨
π FILES π
/etc/nmh/mhl.formatβ the message template<mh-dir>/mhl.formatβ use this instead of the standard template if you want your own vibe$HOME/.mh_profileβ the user profile, where your settings live π
π PROFILE COMPONENTS π
moreproc:β the program to use as an interactive front-endformatproc:β the program to use as a filter for components that have the βformatβ flag set
π SEE ALSO π
show(1), ap(8), dp(8) β go read those too, they're giving main character energy π
β¨ DEFAULTS β¨
-bell-noclear-length 40-width 80
π CONTEXT π
None. Literally nothing. Empty. a void. π«Ά
π BUGS π
There should be some way to passbellandclearinformation to the front-end. Currently there isn't. π
The βnonewlineβ option interacts badly with βcompressβ and βsplitβ. Like, they do not get along. Proceed with caution bestie, this is not a drill.
The βformatβ option really should work on something other than the body component. It just... doesn't. π
And that's the whole page, we made it!! π This one's from nmh-1.8, dated 2014-09-15 β MHL(1), periodt. Now go forth and format your mail, you gorgeous Unix gremlin. ππ¦π
π¦ where this page comes from
- alpine 3.24: nmh-doc 1.8-r3 Β· BSD-3-Clause
- epel 10: nmh 1.8-3.el10_1 Β· BSD
- epel 9: nmh 1.8-1.el9 Β· BSD
- fedora 43: nmh 1.8-9.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: nmh 1.8-10.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms