MHL(1mh)
β¨ NAME β¨
mhl β produce formatted listings of nmh messages π
(yep bestie, this is the MHL(1mh) page and it is lowkey iconic, stay with me)
π SYNOPSIS π
/usr/lib/mh/mhl [-help] [-version] [-bell | -nobell] [-clear | -noclear]
[-folder +folder] [-form formfile] [-length lines] [-width columns]
[-moreproc program] [-nomoreproc] [-fmtproc program] [-nofmtproc]
[files ...]
π¦ DESCRIPTION π¦
okay so mhl is an nmh command that filters and/or displays text messages. It's literally the default way nmh shows you text messages β it's the default showproc. main character energy fr fr π
Same energy as more, babes: every message you hand over as an argument (or the standard input) gets output. If you give it more than one message file, it's gonna prompt you before each one, and a <RETURN> or <EOT> will begin the output β where <RETURN> clears the screen (if that's appropriate here) and <EOT> (usually CTRL-D) suppresses the screen clear. An <INTERRUPT> (usually CTRL-C) aborts the message output that's currently happening and prompts you for the next message (if there even is one), and a <QUIT> (usually CTRL-\) terminates the program (without core dump, we do not dump core in this house π
ββοΈ).
The -bell option tells mhl to ring the terminal's bell at the end of each page, while the -clear option tells mhl 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 take effect 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 ignored. Also, if the -clear switch is used and mhl's output is directed to a terminal, then mhl will consult the TERM and TERMCAP environment variables to figure out your terminal type so it knows how to clear the screen. If the -clear switch is given and mhl's output is not directed to a terminal (like a pipe or a file, iykyk), then mhl will send a formfeed after each message.
To override the default moreproc and the profile entry, use the -moreproc program switch. Note that mhl will never start a moreproc if it's invoked on a hardcopy terminal. no cap.
The -length length and -width width switches set the screen length and width, respectively. These default to the values indicated by TERMCAP, if appropriate β otherwise they default to 40 and 80, respectively.
The default format file used by mhl is called mhl.format. mhl will first search for this file in your nmh directory, and will then search in the directory /etc/nmh. You can change this default with the -form formatfile switch. π
Finally, the -folder +folder switch sets the nmh folder name, which gets 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.
mhl operates in two phases: 1) read and parse the format file, and 2) process each message (file). During phase 1, an internal description of the format is produced as a structured list. In 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 a couple of "special" components are defined to give you extra functionality. Message output will be in the order specified by the order in the format file. periodt.
π FORMAT FILE LINES π
Each line of a format file has one of the following forms:
;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, the 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 "***". slay.
π VARIABLES & THEIR ARGUMENTS π
Following are all of the current variables and their arguments. If they follow a component, they apply only to that component β otherwise, their affect is global. Since the whole format is parsed before any output processing, 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 indentcomponent: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 ofcomponentfor this componentnocomponentβ flag β don't outputcomponent: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 throughformatprocfilter (body only)noformatβ flag β Do not run component throughformatprocfilter (default)formatargβ string β Argument to format filter
πΈ SETTING VALUES πΈ
To specify the value of integer-valued and string-valued variables, follow their name with an equals-sign and the value. Integer-valued variables are given decimal values, while string-valued variables are given arbitrary text bracketed by double-quotes. If a value is suffixed by /G or /L, then its value is useful in a global-only or local-only context (respectively).
A line of the 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. cute.
If nocomponent is not specified, then the component name will be output as it appears in the format file.
The default format file is:
; 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
π§ FORMATFIELD, ADDRFIELD & DATEFIELD π§
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 desired, 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. β¨
okay so the format flag is basically saying "bestie, run this component through a filter program," and that filter is whatever the formatproc profile entry says it is. That filter program reads from standard input and writes to standard output β that's the whole vibe. π
Heads up: right nowformatis only supported for thebodycomponent. That's it. That's the list.
After the filter runs, the component name gets prefixed onto the output. The intended use case is filtering a message body so it looks cuter in a reply β like, you want the quoted text to be pretty, not a wall of raw garbage. π
A suggested filter for repl(1) goes a lil something like:
body:component=">",overflowtext=">",overflowoffset=0,format,nowrap
If you wanna override that formatproc profile entry, the -fmtproc and -nofmtproc switches are right there for you. π
Meanwhile formatarg gives you a string that gets passed as an argument to the format filter. That string gets processed by mh-format(5), and all the message components are available for use inside it. And you can stack multiple formatarg options to build up multiple arguments to the format filter. Yes, multiple. Stack 'em. π
β¨ FILES β¨
/etc/nmh/mhl.formatβ the message template- or
<mh-dir>/mhl.formatβ used rather than the standard template $HOME/.mh_profileβ the user profile
π¦ PROFILE COMPONENTS π¦
moreproc:β program to use as the interactive front-endformatproc:β program to use as a filter for components that have theformatflag set
π SEE ALSO π
πΈ DEFAULTS πΈ
-bell-noclear-length 40-width 80
β CONTEXT β
None. Nothing. Zero. Empty. π
π BUGS π
- There should be some way to pass
bellandclearinformation to the front-end. Right now there just... isn't. π - The
nonewlineoption interacts badly withcompressandsplit. Like, they do not get along. Do not invite them to the same party. π - The
formatoption really should work on something other than the body component. It does not. (See above, bestie β body only.) π
and that's the whole page, fr fr π«Ά This was nmh-1.8, dated 2014-09-15, straight from the MHL(1mh) manual. Go forth and format your messages, you gorgeous little Unix gremlin. β¨π
π¦ where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms