MHL(1mh)

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

✨ 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 width
  • length β€” integer β€” screen length or component length
  • offset β€” integer β€” positions to indent component:
  • overflowtext β€” string β€” text to use at the beginning of an overflow line
  • overflowoffset β€” integer β€” positions to indent overflow lines
  • compwidth β€” integer β€” positions to indent component text after the first line is output
  • uppercase β€” flag β€” output text of this component in all upper case
  • nouppercase β€” flag β€” don't uppercase
  • clearscreen β€” flag/G β€” clear the screen prior to each page
  • noclearscreen β€” flag/G β€” don't clearscreen
  • bell β€” flag/G β€” ring the bell at the end of each page
  • nobell β€” flag/G β€” don't bell
  • component β€” string/L β€” name to use instead of component for this component
  • nocomponent β€” flag β€” don't output component: for this component
  • center β€” flag β€” center component on line (works for one-line components only)
  • nocenter β€” flag β€” don't center
  • leftadjust β€” flag β€” strip off leading whitespace on each line of text
  • noleftadjust β€” flag β€” don't leftadjust
  • rtrim β€” flag β€” trim whitespace at end of text lines
  • nortrim β€” flag β€” retain whitespace at end of text lines (default)
  • compress β€” flag β€” change newlines in text to spaces
  • nocompress β€” flag β€” don't compress
  • wrap β€” flag β€” Wrap lines that exceed width (default)
  • nowrap β€” flag β€” Do not perform line wrapping
  • split β€” flag β€” don't combine multiple fields into a single field
  • nosplit β€” flag β€” combine multiple fields into a single field
  • newline β€” flag β€” print newline at end of components (this is the default)
  • nonewline β€” flag β€” don't print newline at end of components
  • formatfield β€” string β€” format string for this component (see below)
  • decode β€” flag β€” decode text as RFC 2047 encoded header field
  • addrfield β€” flag β€” field contains addresses
  • datefield β€” flag β€” field contains dates
  • format β€” flag β€” Run component through formatproc filter (body only)
  • noformat β€” flag β€” Do not run component through formatproc filter (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 now format is only supported for the body component. 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-end
  • formatproc: β€” program to use as a filter for components that have the format flag set

πŸ’œ SEE ALSO πŸ’œ

show(1), ap(8), dp(8)


🌸 DEFAULTS 🌸

  • -bell
  • -noclear
  • -length 40
  • -width 80

⭐ CONTEXT ⭐

None. Nothing. Zero. Empty. 😌


πŸ’€ BUGS πŸ’€

  • There should be some way to pass bell and clear information to the front-end. Right now there just... isn't. πŸ™ˆ
  • The nonewline option interacts badly with compress and split. Like, they do not get along. Do not invite them to the same party. 😭
  • The format option 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