1877 lines
No EOL
140 KiB
HTML
1877 lines
No EOL
140 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Configuration</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="home" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="gettingstarted.html" title="Chapter 2. Getting Started" /><link rel="next" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><style xmlns="" type="text/css">
|
||
body { margin-left:2%; margin-right:2%; font-family:serif; }
|
||
.toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
|
||
h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
|
||
p { text-align:justify; }
|
||
div.table p.title, div.example p.title { font-size:smaller; font-family:sans-serif; }
|
||
.email, .email a { font-family:monospace; }
|
||
div.table-contents table, div.informaltable table { border-collapse:collapse; border:1px solid #c0c0c0; }
|
||
div.table-contents table td, div.informaltable td, div.table-contents table th, div.informaltable table th { padding:5px; text-align:left; }
|
||
div.table-contents table th, div.informaltable table th {
|
||
font-family:sans-serif;
|
||
background:#d0d0d0;
|
||
font-weight:normal;
|
||
vertical-align:top;
|
||
}
|
||
div.cmdsynopsis { border-left:1px solid #707070; padding-left:5px; }
|
||
li div.cmdsynopsis { border-left:none; padding-left:0px; }
|
||
pre.screen, div.note { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; margin-left:2%; margin-right:2%; }
|
||
div.example p.title { margin-left:2%; }
|
||
div.note h3 { font-size:small; font-style:italic; font-variant: small-caps; }
|
||
div.note h3:after { content: ":" }
|
||
div.note { margin-bottom: 5px; }
|
||
.command { font-family: monospace; font-weight: normal; }
|
||
.command strong { font-weight: normal; }
|
||
tr { vertical-align: top; }
|
||
.comment { color:#707070; }
|
||
|
||
</style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Configuration</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="configuration"></a>Chapter 3. Configuration</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="configuration.html#configuration-files">1. Location of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#quickconfig">2. Starter Muttrc</a></span></dt><dt><span class="sect1"><a href="configuration.html#muttrc-syntax">3. Syntax of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#addrgroup">4. Address Groups</a></span></dt><dt><span class="sect1"><a href="configuration.html#alias">5. Defining/Using Aliases</a></span></dt><dt><span class="sect1"><a href="configuration.html#bind">6. Changing the Default Key Bindings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#stty">6.1. Terminal Keybindings</a></span></dt><dt><span class="sect2"><a href="configuration.html#crlf">6.2. Enter versus Return</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#cd">7. Changing the current working directory</a></span></dt><dt><span class="sect1"><a href="configuration.html#charset-hook">8. Defining Aliases for Character Sets</a></span></dt><dt><span class="sect1"><a href="configuration.html#folder-hook">9. Setting Variables Based Upon Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#macro">10. Keyboard Macros</a></span></dt><dt><span class="sect1"><a href="configuration.html#color">11. Using Color and Mono Video Attributes</a></span></dt><dt><span class="sect1"><a href="configuration.html#msg-hdr-display">12. Message Header Display</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#hdr-folding">12.1. Header Display</a></span></dt><dt><span class="sect2"><a href="configuration.html#ignore">12.2. Selecting Headers</a></span></dt><dt><span class="sect2"><a href="configuration.html#hdr-order">12.3. Ordering Displayed Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#alternates">13. Alternative Addresses</a></span></dt><dt><span class="sect1"><a href="configuration.html#lists">14. Mailing Lists</a></span></dt><dt><span class="sect1"><a href="configuration.html#mbox-hook">15. Using Multiple Spool Mailboxes</a></span></dt><dt><span class="sect1"><a href="configuration.html#mailboxes">16. Monitoring Incoming Mail</a></span></dt><dt><span class="sect1"><a href="configuration.html#my-hdr">17. User-Defined Headers</a></span></dt><dt><span class="sect1"><a href="configuration.html#save-hook">18. Specify Default Save Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-hook">19. Specify Default Fcc: Mailbox When Composing</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-save-hook">20. Specify Default Save Filename and Default Fcc: Mailbox at Once</a></span></dt><dt><span class="sect1"><a href="configuration.html#send-hook">21. Change Settings Based Upon Message Recipients</a></span></dt><dt><span class="sect1"><a href="configuration.html#message-hook">22. Change Settings Before Formatting a Message</a></span></dt><dt><span class="sect1"><a href="configuration.html#crypt-hook">23. Choosing the Cryptographic Key of the Recipient</a></span></dt><dt><span class="sect1"><a href="configuration.html#index-format-hook">24. Dynamically Changing $index_format using Patterns</a></span></dt><dt><span class="sect1"><a href="configuration.html#push">25. Adding Key Sequences to the Keyboard Buffer</a></span></dt><dt><span class="sect1"><a href="configuration.html#exec">26. Executing Functions</a></span></dt><dt><span class="sect1"><a href="configuration.html#score-command">27. Message Scoring</a></span></dt><dt><span class="sect1"><a href="configuration.html#spam">28. Spam Detection</a></span></dt><dt><span class="sect1"><a href="configuration.html#set">29. Setting and Querying Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#var-types">29.1. Variable Types</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-commands">29.2. Commands</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-myvar">29.3. User-Defined Variables</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-conversions">29.4. Type Conversions</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#source">30. Reading Initialization Commands From Another File</a></span></dt><dt><span class="sect1"><a href="configuration.html#unhook">31. Removing Hooks</a></span></dt><dt><span class="sect1"><a href="configuration.html#formatstrings">32. Format Strings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#formatstrings-basics">32.1. Basic usage</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-conditionals">32.2. Conditionals</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-filters">32.3. Filters</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-padding">32.4. Padding</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-size">32.5. Bytes size display</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#mailto-allow">33. Control allowed header fields in a mailto: URL</a></span></dt></dl></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="configuration-files"></a>1. Location of Initialization Files</h2></div></div></div><p>
|
||
While the default configuration (or <span class="quote">“<span class="quote">preferences</span>”</span>) make
|
||
Mutt usable right out of the box, it is often desirable to tailor Mutt
|
||
to suit your own tastes. When Mutt is first invoked, it will attempt to
|
||
read the <span class="quote">“<span class="quote">system</span>”</span> configuration file (defaults set by your
|
||
local system administrator), unless the <span class="quote">“<span class="quote">-n</span>”</span> <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> option is specified. This
|
||
file is typically <code class="literal">/usr/local/share/mutt/Muttrc</code> or
|
||
<code class="literal">/etc/Muttrc</code>. Mutt will next look for a file named
|
||
<code class="literal">.muttrc</code> in your home directory. If this file does
|
||
not exist and your home directory has a subdirectory named
|
||
<code class="literal">.mutt</code>, Mutt tries to load a file named
|
||
<code class="literal">.mutt/muttrc</code>. If still not found, Mutt will try
|
||
<code class="literal">$XDG_CONFIG_HOME/mutt/muttrc</code>.
|
||
</p><p>
|
||
<code class="literal">.muttrc</code> is the file where you will usually place your
|
||
<a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a> to configure Mutt.
|
||
</p><p>
|
||
In addition, Mutt supports version specific configuration files that are
|
||
parsed instead of the default files as explained above. For instance,
|
||
if your system has a <code class="literal">Muttrc-0.88</code> file in the system
|
||
configuration directory, and you are running version 0.88 of Mutt, this
|
||
file will be sourced instead of the <code class="literal">Muttrc</code> file. The
|
||
same is true of the user configuration file, if you have a file
|
||
<code class="literal">.muttrc-0.88.6</code> in your home directory, when you run
|
||
Mutt version 0.88.6, it will source this file instead of the default
|
||
<code class="literal">.muttrc</code> file. The version number is the same which
|
||
is visible using the <span class="quote">“<span class="quote">-v</span>”</span> <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> switch or using the
|
||
<code class="literal">show-version</code> key (default: V) from the index menu.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="quickconfig"></a>2. Starter Muttrc</h2></div></div></div><p>
|
||
Mutt is highly configurable because it's <span class="emphasis"><em>meant</em></span> to
|
||
be customized to your needs and preferences. However, this
|
||
configurability can make it difficult when just getting started. A
|
||
few sample muttrc files come with mutt, under
|
||
<code class="literal">doc/mutt/samples/</code>. Among them, <a class="ulink" href="https://gitlab.com/muttmua/mutt/tree/master/contrib/sample.muttrc-starter" target="_top">sample.muttrc-starter</a> is a basic example config with a few
|
||
suggested settings and pointers to useful programs.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="muttrc-syntax"></a>3. Syntax of Initialization Files</h2></div></div></div><p>
|
||
An initialization file consists of a series of <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a>. Each line of the file may contain
|
||
one or more commands. When multiple commands are used, they must be
|
||
separated by a semicolon (<span class="quote">“<span class="quote">;</span>”</span>).
|
||
</p><div class="example"><a id="ex-rc-multiple-cmds"></a><p class="title"><strong>Example 3.1. Multiple configuration commands per line</strong></p><div class="example-contents"><pre class="screen">
|
||
set realname='Mutt user' ; ignore x-
|
||
</pre></div></div><br class="example-break" /><p>
|
||
The hash mark, or pound sign (<span class="quote">“<span class="quote">#</span>”</span>), is used as a
|
||
<span class="quote">“<span class="quote">comment</span>”</span> character. You can use it to annotate your
|
||
initialization file. All text after the comment character to the end of
|
||
the line is ignored.
|
||
</p><div class="example"><a id="ex-ec-comment"></a><p class="title"><strong>Example 3.2. Commenting configuration files</strong></p><div class="example-contents"><pre class="screen">
|
||
my_hdr X-Disclaimer: Why are you listening to me? <span class="comment"># This is a comment</span>
|
||
</pre></div></div><br class="example-break" /><p>
|
||
Single quotes (<span class="quote">“<span class="quote">'</span>”</span>) and double quotes (<span class="quote">“<span class="quote">"</span>”</span>)
|
||
can be used to quote strings which contain spaces or other special
|
||
characters. The difference between the two types of quotes is similar
|
||
to that of many popular shell programs, namely that a single quote is
|
||
used to specify a literal string (one that is not interpreted for shell
|
||
variables or quoting with a backslash [see next paragraph]), while
|
||
double quotes indicate a string for which should be evaluated. For
|
||
example, backticks are evaluated inside of double quotes, but
|
||
<span class="emphasis"><em>not</em></span> for single quotes.
|
||
</p><p>
|
||
<span class="quote">“<span class="quote">\</span>”</span> quotes the next character, just as in shells such as
|
||
bash and zsh. For example, if want to put quotes <span class="quote">“<span class="quote">"</span>”</span>
|
||
inside of a string, you can use <span class="quote">“<span class="quote">\</span>”</span> to force the next
|
||
character to be a literal instead of interpreted character.
|
||
</p><div class="example"><a id="ex-rc-quote"></a><p class="title"><strong>Example 3.3. Escaping quotes in configuration files</strong></p><div class="example-contents"><pre class="screen">
|
||
set realname="Michael \"MuttDude\" Elkins"
|
||
</pre></div></div><br class="example-break" /><p>
|
||
<span class="quote">“<span class="quote">\\</span>”</span> means to insert a literal <span class="quote">“<span class="quote">\</span>”</span> into the line.
|
||
<span class="quote">“<span class="quote">\n</span>”</span> and <span class="quote">“<span class="quote">\r</span>”</span> have their usual C meanings of linefeed and
|
||
carriage-return, respectively.
|
||
</p><p>
|
||
A <span class="quote">“<span class="quote">\</span>”</span> at the end of a line can be used to split commands
|
||
over multiple lines as it <span class="quote">“<span class="quote">escapes</span>”</span> the line end, provided
|
||
that the split points don't appear in the middle of command names. Lines
|
||
are first concatenated before interpretation so that a multi-line can be
|
||
commented by commenting out the first line only.
|
||
</p><div class="example"><a id="ex-rc-split"></a><p class="title"><strong>Example 3.4. Splitting long configuration commands over several lines</strong></p><div class="example-contents"><pre class="screen">
|
||
set status_format="some very \
|
||
long value split \
|
||
over several lines"
|
||
</pre></div></div><br class="example-break" /><p>
|
||
It is also possible to substitute the output of a Unix command in an
|
||
initialization file. This is accomplished by enclosing the command in
|
||
backticks (``). In <a class="xref" href="configuration.html#ex-rc-backtick" title="Example 3.5. Using external command's output in configuration files">Example 3.5, “Using external command's output in configuration files”</a>, the output of the
|
||
Unix command <span class="quote">“<span class="quote">uname -a</span>”</span> will be substituted before the line
|
||
is parsed. Since initialization files are line oriented, only the first
|
||
line of output from the Unix command will be substituted.
|
||
</p><div class="example"><a id="ex-rc-backtick"></a><p class="title"><strong>Example 3.5. Using external command's output in configuration files</strong></p><div class="example-contents"><pre class="screen">
|
||
my_hdr X-Operating-System: `uname -a`
|
||
</pre></div></div><br class="example-break" /><p>
|
||
To avoid the output of backticks being parsed, place them inside
|
||
double quotes. In <a class="xref" href="configuration.html#ex-backtick-dblquotes" title="Example 3.6. Preventing the output of backticks from being parsed">Example 3.6, “Preventing the output of backticks from being parsed”</a>, the output
|
||
of the gpg decryption is assigned directly to $imap_pass, so that
|
||
special characters in the password (e.g.<span class="quote">“<span class="quote">'</span>”</span>,
|
||
<span class="quote">“<span class="quote">#</span>”</span>, <span class="quote">“<span class="quote">$</span>”</span>) are not parsed and interpreted
|
||
specially by mutt.
|
||
</p><div class="example"><a id="ex-backtick-dblquotes"></a><p class="title"><strong>Example 3.6. Preventing the output of backticks from being parsed</strong></p><div class="example-contents"><pre class="screen">
|
||
set imap_pass="`gpg --batch -q --decrypt ~/.mutt/account.gpg`"
|
||
</pre></div></div><br class="example-break" /><p>
|
||
Both environment variables and Mutt variables can be accessed by
|
||
prepending <span class="quote">“<span class="quote">$</span>”</span> to the name of the variable. For example,
|
||
</p><div class="example"><a id="ex-rc-env"></a><p class="title"><strong>Example 3.7. Using environment variables in configuration files</strong></p><div class="example-contents"><pre class="screen">
|
||
set record=+sent_on_$HOSTNAME
|
||
</pre></div></div><br class="example-break" /><p>
|
||
will cause Mutt to save outgoing messages to a folder named
|
||
<span class="quote">“<span class="quote">sent_on_kremvax</span>”</span> if the environment variable
|
||
<code class="literal">$HOSTNAME</code> is set to <span class="quote">“<span class="quote">kremvax.</span>”</span> (See
|
||
<a class="link" href="reference.html#record" title="3.279. record">$record</a> for details.)
|
||
</p><p>
|
||
Mutt expands the variable when it is assigned, not when it is used. If
|
||
the value of a variable on the right-hand side of an assignment changes
|
||
after the assignment, the variable on the left-hand side will not be
|
||
affected.
|
||
</p><p>
|
||
If <a class="link" href="reference.html#muttlisp-inline-eval" title="3.201. muttlisp_inline_eval">$muttlisp_inline_eval</a> is set, an unquoted
|
||
parenthesis-enclosed expression will be evaluated as MuttLisp. See the
|
||
<a class="link" href="advancedusage.html#muttlisp" title="20. Using MuttLisp (EXPERIMENTAL)">Using MuttLisp</a> section for more details.
|
||
</p><div class="example"><a id="ex-rc-muttlisp"></a><p class="title"><strong>Example 3.8. Using MuttLisp expressions</strong></p><div class="example-contents"><pre class="screen">
|
||
set signature = \
|
||
(if (equal $my_name "Kevin McCarthy") ~/kevin.sig ~/other.sig)
|
||
</pre></div></div><br class="example-break" /><p>
|
||
The commands understood by Mutt are explained in the next paragraphs.
|
||
For a complete list, see the <a class="link" href="reference.html#commands" title="2. Configuration Commands">command
|
||
reference</a>.
|
||
</p><p>
|
||
All configuration files are expected to be in the current locale as
|
||
specified by the <a class="link" href="reference.html#charset" title="3.41. charset">$charset</a> variable which
|
||
doesn't have a default value since it's determined by Mutt at startup.
|
||
If a configuration file is not encoded in the same character set the
|
||
<a class="link" href="reference.html#config-charset" title="3.47. config_charset">$config_charset</a> variable should be
|
||
used: all lines starting with the next are recoded from <a class="link" href="reference.html#config-charset" title="3.47. config_charset">$config_charset</a> to <a class="link" href="reference.html#charset" title="3.41. charset">$charset</a>.
|
||
</p><p>
|
||
This mechanism should be avoided if possible as it has the following
|
||
implications:
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>These variables should be set early in a configuration
|
||
file with <a class="link" href="reference.html#charset" title="3.41. charset">$charset</a> preceding <a class="link" href="reference.html#config-charset" title="3.47. config_charset">$config_charset</a> so Mutt knows what
|
||
character set to convert to.</p></li><li class="listitem"><p>If <a class="link" href="reference.html#config-charset" title="3.47. config_charset">$config_charset</a>
|
||
is set, it should be set in each configuration file because the value is
|
||
global and <span class="emphasis"><em>not</em></span> per configuration
|
||
file.</p></li><li class="listitem"><p>Because Mutt first recodes a line before it attempts to
|
||
parse it, a conversion introducing question marks or other characters as
|
||
part of errors (unconvertable characters, transliteration) may introduce
|
||
syntax errors or silently change the meaning of certain tokens
|
||
(e.g. inserting question marks into regular
|
||
expressions).</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="addrgroup"></a>4. Address Groups</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">group</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...] {
|
||
<code class="option">-rx</code>
|
||
<em class="replaceable"><code>expr</code></em>
|
||
... |
|
||
<code class="option">-addr</code>
|
||
<em class="replaceable"><code>expr</code></em>
|
||
... }<br /><code class="command">ungroup</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...] {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<code class="option">-rx</code>
|
||
<em class="replaceable"><code>expr</code></em>
|
||
... |
|
||
<code class="option">-addr</code>
|
||
<em class="replaceable"><code>expr</code></em>
|
||
... }</p></div><p>
|
||
Mutt supports grouping addresses logically into named groups. An address
|
||
or address pattern can appear in several groups at the same time. These
|
||
groups can be used in <a class="link" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging">patterns</a> (for searching, limiting and tagging) and
|
||
in hooks by using group patterns. This can be useful to classify mail
|
||
and take certain actions depending on in what groups the message is.
|
||
For example, the mutt user's mailing list would fit into the categories
|
||
<span class="quote">“<span class="quote">mailing list</span>”</span> and <span class="quote">“<span class="quote">mutt-related</span>”</span>. Using <a class="link" href="configuration.html#send-hook" title="21. Change Settings Based Upon Message Recipients"><code class="literal">send-hook</code></a>, the sender can
|
||
be set to a dedicated one for writing mailing list messages, and the
|
||
signature could be set to a mutt-related one for writing to a mutt list
|
||
— for other lists, the list sender setting still applies but a
|
||
different signature can be selected. Or, given a group only containing
|
||
recipients known to accept encrypted mail,
|
||
<span class="quote">“<span class="quote">auto-encryption</span>”</span> can be achieved easily.
|
||
</p><p>
|
||
The <span class="command"><strong>group</strong></span> command is used to directly add either
|
||
addresses or regular expressions to the specified group or groups. The
|
||
different categories of arguments to the <span class="command"><strong>group</strong></span>
|
||
command can be in any order. The flags <code class="literal">-rx</code> and
|
||
<code class="literal">-addr</code> specify what the following strings (that cannot
|
||
begin with a hyphen) should be interpreted as: either a regular
|
||
expression or an email address, respectively.
|
||
</p><p>
|
||
These address groups can also be created implicitly by the <a class="link" href="configuration.html#alias" title="5. Defining/Using Aliases"><span class="command"><strong>alias</strong></span></a>, <a class="link" href="configuration.html#lists" title="14. Mailing Lists"><span class="command"><strong>lists</strong></span></a>, <a class="link" href="configuration.html#lists" title="14. Mailing Lists"><span class="command"><strong>subscribe</strong></span></a> and <a class="link" href="configuration.html#alternates" title="13. Alternative Addresses"><span class="command"><strong>alternates</strong></span></a> commands by
|
||
specifying the optional <code class="literal">-group</code> option. For example,
|
||
</p><pre class="screen">
|
||
alternates -group me address1 address2
|
||
alternates -group me -group work address3
|
||
</pre><p>
|
||
would create a group named <span class="quote">“<span class="quote">me</span>”</span> which contains all your
|
||
addresses and a group named <span class="quote">“<span class="quote">work</span>”</span> which contains only your
|
||
work address <span class="emphasis"><em>address3</em></span>. Besides many other
|
||
possibilities, this could be used to automatically mark your own
|
||
messages in a mailing list folder as read or use a special signature for
|
||
work-related messages.
|
||
</p><p>
|
||
The <span class="command"><strong>ungroup</strong></span> command is used to remove addresses or
|
||
regular expressions from the specified group or groups. The syntax is
|
||
similar to the <span class="command"><strong>group</strong></span> command, however the special
|
||
character <code class="literal">*</code> can be used to empty a group of all of
|
||
its contents. As soon as a group gets empty because all addresses and
|
||
regular expressions have been removed, it'll internally be removed, too
|
||
(i.e. there cannot be an empty group). When removing regular expressions
|
||
from a group, the pattern must be specified exactly as given to the
|
||
<span class="command"><strong>group</strong></span> command or <code class="literal">-group</code> argument.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alias"></a>5. Defining/Using Aliases</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alias</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...]
|
||
<em class="replaceable"><code>key</code></em>
|
||
|
||
<em class="replaceable"><code>address</code></em>
|
||
[
|
||
<em class="replaceable"><code>address</code></em>
|
||
...]<br /><code class="command">unalias</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...] {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>key</code></em>
|
||
... }</p></div><p>
|
||
It's usually very cumbersome to remember or type out the address of
|
||
someone you are communicating with. Mutt allows you to create
|
||
<span class="quote">“<span class="quote">aliases</span>”</span> which map a short string to a full address.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
If you want to create an alias for more than one address, you
|
||
<span class="emphasis"><em>must</em></span> separate the addresses with a comma
|
||
(<span class="quote">“<span class="quote">,</span>”</span>).
|
||
</p></div><p>
|
||
The optional <code class="literal">-group</code> argument to
|
||
<span class="command"><strong>alias</strong></span> causes the aliased address(es) to be added to
|
||
the named <span class="emphasis"><em>group</em></span>.
|
||
</p><p>
|
||
To add an alias:
|
||
</p><pre class="screen">
|
||
alias muttdude me@cs.hmc.edu (Michael Elkins)
|
||
alias theguys manny, moe, jack
|
||
</pre><p>
|
||
To remove an alias or aliases (<span class="quote">“<span class="quote">*</span>”</span> means all aliases):
|
||
</p><pre class="screen">
|
||
unalias muttdude
|
||
unalias *
|
||
</pre><p>
|
||
Note: The alias <span class="emphasis"><em>key</em></span> is matched case
|
||
insensitively when creating (checking for duplicates), removing, or
|
||
expanding aliases.
|
||
</p><p>
|
||
Unlike other mailers, Mutt doesn't require aliases to be defined in a
|
||
special file. The <span class="command"><strong>alias</strong></span> command can appear anywhere
|
||
in a configuration file, as long as this file is <a class="link" href="configuration.html#source" title="30. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span>d</a>. Consequently, you
|
||
can have multiple alias files, or you can have all aliases defined in
|
||
your <code class="literal">.muttrc</code>.
|
||
</p><p>
|
||
On the other hand, the <a class="link" href="gettingstarted.html#create-alias"><code class="literal"><create-alias></code></a>
|
||
function can use only one file, the one pointed to by the <a class="link" href="reference.html#alias-file" title="3.5. alias_file">$alias_file</a> variable (which is
|
||
<code class="literal">~/.muttrc</code> by default). This file is not special
|
||
either, in the sense that Mutt will happily append aliases to any file,
|
||
but in order for the new aliases to take effect you need to explicitly
|
||
<a class="link" href="configuration.html#source" title="30. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> this file too.
|
||
</p><div class="example"><a id="ex-alias-external"></a><p class="title"><strong>Example 3.9. Configuring external alias files</strong></p><div class="example-contents"><pre class="screen">
|
||
source /usr/local/share/Mutt.aliases
|
||
source ~/.mail_aliases
|
||
set alias_file=~/.mail_aliases
|
||
</pre></div></div><br class="example-break" /><p>
|
||
To use aliases, you merely use the alias at any place in Mutt where Mutt
|
||
prompts for addresses, such as the <span class="emphasis"><em>To:</em></span> or
|
||
<span class="emphasis"><em>Cc:</em></span> prompt. You can also enter aliases in your
|
||
editor at the appropriate headers if you have the <a class="link" href="reference.html#edit-headers" title="3.84. edit_headers">$edit_headers</a> variable set.
|
||
</p><p>
|
||
In addition, at the various address prompts, you can use the tab
|
||
character to expand a partial alias to the full alias. If there are
|
||
multiple matches, Mutt will bring up a menu with the matching aliases.
|
||
In order to be presented with the full list of aliases, you must hit tab
|
||
without a partial alias, such as at the beginning of the prompt or after
|
||
a comma denoting multiple addresses.
|
||
</p><p>
|
||
In the alias menu, you can select as many aliases as you want with the
|
||
<code class="literal">tag-entry</code> key (default: <Space> or t), and use
|
||
the <span class="emphasis"><em>exit</em></span> key (default: q) to return to the address
|
||
prompt.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bind"></a>6. Changing the Default Key Bindings</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">bind</code>
|
||
<em class="replaceable"><code>map</code></em>
|
||
|
||
<em class="replaceable"><code>key</code></em>
|
||
|
||
<em class="replaceable"><code>function</code></em>
|
||
</p></div><p>
|
||
This command allows you to change the default key bindings (operation
|
||
invoked when pressing a key).
|
||
</p><p>
|
||
<span class="emphasis"><em>map</em></span> specifies in which menu the binding belongs.
|
||
Multiple maps may be specified by separating them with commas (no
|
||
additional whitespace is allowed). The currently defined maps are:
|
||
</p><a id="maps"></a><div class="variablelist"><dl class="variablelist"><dt><span class="term">generic</span></dt><dd><p>
|
||
This is not a real menu, but is used as a fallback for all of the other
|
||
menus except for the pager and editor modes. If a key is not defined in
|
||
another menu, Mutt will look for a binding to use in this menu. This
|
||
allows you to bind a key to a certain function in multiple menus instead
|
||
of having multiple <span class="command"><strong>bind</strong></span> statements to accomplish the
|
||
same task.
|
||
</p></dd><dt><span class="term">alias</span></dt><dd><p>
|
||
The alias menu is the list of your personal aliases as defined in your
|
||
<code class="literal">.muttrc</code>. It is the mapping from a short alias name
|
||
to the full email address(es) of the recipient(s).
|
||
</p></dd><dt><span class="term">attach</span></dt><dd><p>
|
||
The attachment menu is used to access the attachments on received
|
||
messages.
|
||
</p></dd><dt><span class="term">browser</span></dt><dd><p>
|
||
The browser is used for both browsing the local directory structure, and
|
||
for listing all of your incoming mailboxes.
|
||
</p></dd><dt><span class="term">editor</span></dt><dd><p>
|
||
The editor is used to allow the user to enter a single line of text, such as
|
||
the <span class="emphasis"><em>To</em></span> or <span class="emphasis"><em>Subject</em></span> prompts in the
|
||
<code class="literal">compose</code> menu.
|
||
</p></dd><dt><span class="term">index</span></dt><dd><p>
|
||
The index is the list of messages contained in a mailbox.
|
||
</p></dd><dt><span class="term">compose</span></dt><dd><p>
|
||
The compose menu is the screen used when sending a new message.
|
||
</p></dd><dt><span class="term">pager</span></dt><dd><p>
|
||
The pager is the mode used to display message/attachment data, and help
|
||
listings.
|
||
</p></dd><dt><span class="term">pgp</span></dt><dd><p>
|
||
The pgp menu is used to select the OpenPGP keys used to encrypt outgoing
|
||
messages.
|
||
</p></dd><dt><span class="term">smime</span></dt><dd><p>
|
||
The smime menu is used to select the OpenSSL certificates used to
|
||
encrypt outgoing messages.
|
||
</p></dd><dt><span class="term">postpone</span></dt><dd><p>
|
||
The postpone menu is similar to the index menu, except is used when
|
||
recalling a message the user was composing, but saved until later.
|
||
</p></dd><dt><span class="term">query</span></dt><dd><p>
|
||
The query menu is the browser for results returned by <a class="link" href="reference.html#query-command" title="3.271. query_command">$query_command</a>.
|
||
</p></dd><dt><span class="term">mix</span></dt><dd><p>
|
||
The mixmaster screen is used to select remailer options for outgoing
|
||
messages (if Mutt is compiled with Mixmaster support).
|
||
</p></dd></dl></div><p>
|
||
<span class="emphasis"><em>key</em></span> is the key (or key sequence) you wish to bind.
|
||
To specify a control character, use the sequence
|
||
<span class="emphasis"><em>\Cx</em></span>, where <span class="emphasis"><em>x</em></span> is the letter of
|
||
the control character (for example, to specify control-A use
|
||
<span class="quote">“<span class="quote">\Ca</span>”</span>). Note that the case of <span class="emphasis"><em>x</em></span> as
|
||
well as <span class="emphasis"><em>\C</em></span> is ignored, so that
|
||
<span class="emphasis"><em>\CA</em></span>, <span class="emphasis"><em>\Ca</em></span>,
|
||
<span class="emphasis"><em>\cA</em></span> and <span class="emphasis"><em>\ca</em></span> are all
|
||
equivalent. An alternative form is to specify the key as a three digit
|
||
octal number prefixed with a <span class="quote">“<span class="quote">\</span>”</span> (for example
|
||
<span class="emphasis"><em>\177</em></span> is equivalent to <span class="emphasis"><em>\c?</em></span>).
|
||
You can also use the form <span class="emphasis"><em><177></em></span>, which
|
||
allows octal numbers with an arbitrary number of digits. In addition,
|
||
<span class="emphasis"><em>key</em></span> may be a symbolic name as shown in <a class="xref" href="configuration.html#tab-key-names" title="Table 3.1. Symbolic key names">Table 3.1, “Symbolic key names”</a>.
|
||
</p><div class="table"><a id="tab-key-names"></a><p class="title"><strong>Table 3.1. Symbolic key names</strong></p><div class="table-contents"><table class="table" summary="Symbolic key names" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Symbolic name</th><th>Meaning</th></tr></thead><tbody><tr><td>\t</td><td>tab</td></tr><tr><td><tab></td><td>tab</td></tr><tr><td><backtab></td><td>backtab / shift-tab</td></tr><tr><td>\r</td><td>carriage return</td></tr><tr><td>\n</td><td>newline</td></tr><tr><td>\e</td><td>escape</td></tr><tr><td><esc></td><td>escape</td></tr><tr><td><up></td><td>up arrow</td></tr><tr><td><down></td><td>down arrow</td></tr><tr><td><left></td><td>left arrow</td></tr><tr><td><right></td><td>right arrow</td></tr><tr><td><pageup></td><td>Page Up</td></tr><tr><td><pagedown></td><td>Page Down</td></tr><tr><td><backspace></td><td>Backspace</td></tr><tr><td><delete></td><td>Delete</td></tr><tr><td><insert></td><td>Insert</td></tr><tr><td><enter></td><td>Enter</td></tr><tr><td><return></td><td>Return</td></tr><tr><td><keypadenter></td><td>Enter key on numeric keypad</td></tr><tr><td><home></td><td>Home</td></tr><tr><td><end></td><td>End</td></tr><tr><td><space></td><td>Space bar</td></tr><tr><td><f1></td><td>function key 1</td></tr><tr><td><f10></td><td>function key 10</td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
The <code class="literal"><what-key></code> function can be used to
|
||
explore keycode and symbolic names for other keys on your keyboard.
|
||
Executing this function will display information about each key
|
||
pressed, until terminated by <code class="literal">^G</code>.
|
||
</p><p>
|
||
<span class="emphasis"><em>key</em></span> does not need to be enclosed in quotes unless
|
||
it contains a space (<span class="quote">“<span class="quote"> </span>”</span>) or semi-colon
|
||
(<span class="quote">“<span class="quote">;</span>”</span>).
|
||
</p><p>
|
||
<span class="emphasis"><em>function</em></span> specifies which action to take when
|
||
<span class="emphasis"><em>key</em></span> is pressed. For a complete list of functions,
|
||
see the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>. Note that the
|
||
<span class="command"><strong>bind</strong></span> expects <span class="emphasis"><em>function</em></span> to be
|
||
specified without angle brackets.
|
||
</p><p>
|
||
The special function <code class="literal"><noop></code> unbinds the
|
||
specified key sequence.
|
||
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="stty"></a>6.1. Terminal Keybindings</h3></div></div></div><p>
|
||
Some key bindings are controlled by the terminal, and so by
|
||
default can't be bound inside Mutt. These may include
|
||
<code class="literal">^C</code>, <code class="literal">^\</code>, <code class="literal">^Q</code>,
|
||
<code class="literal">^S</code>, <code class="literal">^Z</code>, and on BSD/Mac
|
||
<code class="literal">^Y</code>. These terminal settings can be viewed and
|
||
changed using the <code class="literal">stty</code> program.
|
||
</p><p>
|
||
<span class="quote">“<span class="quote"><code class="literal">stty -a</code></span>”</span> will list the bound
|
||
characters (not all of them affect Mutt), and what actions they
|
||
take when pressed. For example,
|
||
you may see <span class="quote">“<span class="quote"><code class="literal">intr = ^C</code></span>”</span> in its
|
||
output. This means typing <code class="literal">^C</code> will send an
|
||
interrupt signal. <span class="quote">“<span class="quote"><code class="literal">quit = ^\</code></span>”</span>
|
||
means typing <code class="literal">^\</code> (commonly also
|
||
<code class="literal">^4</code>) will send a quit signal.
|
||
</p><p>
|
||
To unbind a key from an action, you invoke <span class="quote">“<span class="quote">stty action
|
||
undef</span>”</span>. For example, <span class="quote">“<span class="quote"><code class="literal">stty quit
|
||
undef</code></span>”</span> will unbind <code class="literal">^\</code> (and
|
||
<code class="literal">^4</code>) from sending the quit signal. Once unbound
|
||
(e.g, by placing that line in your .bashrc, or in a Mutt wrapper
|
||
script/function) you can use the key sequence in your Mutt
|
||
bindings.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="crlf"></a>6.2. Enter versus Return</h3></div></div></div><p>
|
||
Prior to version 2.2, Mutt used a default ncurses mode
|
||
(<span class="quote">“<span class="quote"><code class="literal">nl()</code></span>”</span>). This mode maps keyboard
|
||
input of either <code class="literal"><Enter></code> or
|
||
<code class="literal"><Return></code> to the same value, which Mutt
|
||
interpreted as <code class="literal"><Return></code> internally.
|
||
</p><p>
|
||
However, starting in version 2.2, this mode is turned off,
|
||
allowing <code class="literal"><Return></code> and
|
||
<code class="literal"><Enter></code> to be mapped separately, if
|
||
desired. The default keyboard mappings set both, but you can
|
||
override this or create new bindings with one or the other (or
|
||
both).
|
||
</p><p>
|
||
Note that in terminal application, such as Mutt,
|
||
<code class="literal"><Enter></code> is the same as <span class="quote">“<span class="quote">\n</span>”</span>
|
||
and <code class="literal">^J</code>; while <code class="literal"><Return></code>
|
||
is the same as <span class="quote">“<span class="quote">\r</span>”</span> and <code class="literal">^M</code>.
|
||
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cd"></a>7. Changing the current working directory</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">cd</code>
|
||
<em class="replaceable"><code>directory</code></em>
|
||
</p></div><p>
|
||
The <code class="literal">cd</code> command changes Mutt's current working directory.
|
||
This affects commands and functions like <code class="literal">source</code>,
|
||
<code class="literal">change-folder</code>, and <code class="literal">save-entry</code> that use
|
||
relative paths. Using <code class="literal">cd</code> without directory changes to your
|
||
home directory.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="charset-hook"></a>8. Defining Aliases for Character Sets</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">charset-hook</code>
|
||
<em class="replaceable"><code>alias</code></em>
|
||
|
||
<em class="replaceable"><code>charset</code></em>
|
||
<br /><code class="command">iconv-hook</code>
|
||
<em class="replaceable"><code>charset</code></em>
|
||
|
||
<em class="replaceable"><code>local-charset</code></em>
|
||
</p></div><p>
|
||
The <span class="command"><strong>charset-hook</strong></span> command defines an alias for a
|
||
character set. This is useful to properly display messages which are
|
||
tagged with a character set name not known to Mutt.
|
||
</p><p>
|
||
The <span class="command"><strong>iconv-hook</strong></span> command defines a system-specific name
|
||
for a character set. This is helpful when your systems character
|
||
conversion library insists on using strange, system-specific names for
|
||
character sets.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="folder-hook"></a>9. Setting Variables Based Upon Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">folder-hook</code>
|
||
<em class="replaceable"><code>[!]regexp</code></em>
|
||
|
||
<em class="replaceable"><code>command</code></em>
|
||
</p></div><p>
|
||
It is often desirable to change settings based on which mailbox you are
|
||
reading. The <span class="command"><strong>folder-hook</strong></span> command provides a method
|
||
by which you can execute any configuration command.
|
||
<span class="emphasis"><em>regexp</em></span> is a regular expression specifying in which
|
||
mailboxes to execute <span class="emphasis"><em>command</em></span> before loading. If a
|
||
mailbox matches multiple <span class="command"><strong>folder-hook</strong></span>s, they are
|
||
executed in the order given in the <code class="literal">.muttrc</code>.
|
||
</p><p>
|
||
The regexp parameter has <a class="link" href="advancedusage.html#shortcuts" title="10. Mailbox Shortcuts">mailbox
|
||
shortcut</a> expansion performed on the first character.
|
||
See <a class="xref" href="advancedusage.html#mailbox-hook" title="6.2. Mailbox Matching in Hooks">Mailbox Matching in Hooks</a> for more details.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
If you use the <span class="quote">“<span class="quote">!</span>”</span> shortcut for <a class="link" href="reference.html#spoolfile" title="3.370. spoolfile">$spoolfile</a> at the beginning of the pattern,
|
||
you must place it inside of double or single quotes in order to
|
||
distinguish it from the logical <span class="emphasis"><em>not</em></span> operator for
|
||
the expression.
|
||
</p></div><div class="note"><h3 class="title">Note</h3><p>
|
||
Settings are <span class="emphasis"><em>not</em></span> restored when you leave the
|
||
mailbox. For example, a command action to perform is to change the
|
||
sorting method based upon the mailbox being read:
|
||
</p><pre class="screen">
|
||
folder-hook mutt "set sort=threads"</pre><p>
|
||
However, the sorting method is not restored to its previous value when
|
||
reading a different mailbox. To specify a <span class="emphasis"><em>default</em></span>
|
||
command, use the pattern <span class="quote">“<span class="quote">.</span>”</span> before other
|
||
<span class="command"><strong>folder-hook</strong></span>s adjusting a value on a per-folder basis
|
||
because <span class="command"><strong>folder-hook</strong></span>s are evaluated in the order given
|
||
in the configuration file.
|
||
</p></div><div class="note"><h3 class="title">Note</h3><p>
|
||
The keyboard buffer will not be processed until after all hooks
|
||
are run; multiple <a class="link" href="configuration.html#push" title="25. Adding Key Sequences to the Keyboard Buffer">push</a> or <a class="link" href="configuration.html#exec" title="26. Executing Functions">exec</a> commands will end up being processed in
|
||
reverse order.
|
||
</p></div><p>
|
||
The following example will set the <a class="link" href="reference.html#sort" title="3.362. sort">sort</a>
|
||
variable to <code class="literal">date-sent</code> for all folders but to
|
||
<code class="literal">threads</code> for all folders containing
|
||
<span class="quote">“<span class="quote">mutt</span>”</span> in their name.
|
||
</p><div class="example"><a id="ex-folder-sorting"></a><p class="title"><strong>Example 3.10. Setting sort method based on mailbox name</strong></p><div class="example-contents"><pre class="screen">
|
||
folder-hook . "set sort=date-sent"
|
||
folder-hook mutt "set sort=threads"
|
||
</pre></div></div><br class="example-break" /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macro"></a>10. Keyboard Macros</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">macro</code>
|
||
<em class="replaceable"><code>menu</code></em>
|
||
|
||
<em class="replaceable"><code>key</code></em>
|
||
|
||
<em class="replaceable"><code>sequence</code></em>
|
||
[
|
||
<em class="replaceable"><code>description</code></em>
|
||
]</p></div><p>
|
||
Macros are useful when you would like a single key to perform a series
|
||
of actions. When you press <span class="emphasis"><em>key</em></span> in menu
|
||
<span class="emphasis"><em>menu</em></span>, Mutt will behave as if you had typed
|
||
<span class="emphasis"><em>sequence</em></span>. So if you have a common sequence of
|
||
commands you type, you can create a macro to execute those commands with
|
||
a single key or fewer keys.
|
||
</p><p>
|
||
<span class="emphasis"><em>menu</em></span> is the <a class="link" href="configuration.html#maps">map</a> which
|
||
the macro will be bound in. Multiple maps may be specified by
|
||
separating multiple menu arguments by commas. Whitespace may not be used
|
||
in between the menu arguments and the commas separating them.
|
||
</p><p>
|
||
<span class="emphasis"><em>key</em></span> and <span class="emphasis"><em>sequence</em></span> are expanded
|
||
by the same rules as the <a class="link" href="configuration.html#bind" title="6. Changing the Default Key Bindings">key bindings</a> with
|
||
some additions. The first is that control characters in
|
||
<span class="emphasis"><em>sequence</em></span> can also be specified as
|
||
<span class="emphasis"><em>^x</em></span>. In order to get a caret (<span class="quote">“<span class="quote">^</span>”</span>) you
|
||
need to use <span class="emphasis"><em>^^</em></span>. Secondly, to specify a certain key
|
||
such as <span class="emphasis"><em>up</em></span> or to invoke a function directly, you
|
||
can use the format <span class="emphasis"><em><key name></em></span> and
|
||
<span class="emphasis"><em><function name></em></span>. For a listing of key names
|
||
see the section on <a class="link" href="configuration.html#bind" title="6. Changing the Default Key Bindings">key bindings</a>. Functions
|
||
are listed in the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>.
|
||
</p><p>
|
||
The advantage with using function names directly is that the macros will
|
||
work regardless of the current key bindings, so they are not dependent
|
||
on the user having particular key definitions. This makes them more
|
||
robust and portable, and also facilitates defining of macros in files
|
||
used by more than one user (e.g., the system Muttrc).
|
||
</p><p>
|
||
Optionally you can specify a descriptive text after
|
||
<span class="emphasis"><em>sequence</em></span>, which is shown in the help screens if
|
||
they contain a description.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
Macro definitions (if any) listed in the help screen(s), are
|
||
silently truncated at the screen width, and are not wrapped.
|
||
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="color"></a>11. Using Color and Mono Video Attributes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">color</code>
|
||
<em class="replaceable"><code>object</code></em>
|
||
[
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
...]
|
||
<em class="replaceable"><code>foreground</code></em>
|
||
|
||
<em class="replaceable"><code>background</code></em>
|
||
<br /><code class="command">color</code> {
|
||
<code class="option">header</code>
|
||
|
|
||
<code class="option">body</code>
|
||
} [
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
...]
|
||
<em class="replaceable"><code>foreground</code></em>
|
||
|
||
<em class="replaceable"><code>background</code></em>
|
||
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
<br /><code class="command">color</code>
|
||
<code class="option">index</code>
|
||
[
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
...]
|
||
<em class="replaceable"><code>foreground</code></em>
|
||
|
||
<em class="replaceable"><code>background</code></em>
|
||
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
<br /><code class="command">color</code>
|
||
<code class="option">compose</code>
|
||
|
||
<em class="replaceable"><code>composeobject</code></em>
|
||
[
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
...]
|
||
<em class="replaceable"><code>foreground</code></em>
|
||
|
||
<em class="replaceable"><code>background</code></em>
|
||
<br /><code class="command">uncolor</code> {
|
||
<code class="option">index</code>
|
||
|
|
||
<code class="option">header</code>
|
||
|
|
||
<code class="option">body</code>
|
||
} {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
... }</p></div><p>
|
||
If your terminal supports color, you can spice up Mutt by creating your
|
||
own color scheme. To define the color of an object (type of
|
||
information), you must specify both a foreground color
|
||
<span class="emphasis"><em>and</em></span> a background color (it is not possible to only
|
||
specify one or the other).
|
||
</p><p>
|
||
<span class="emphasis"><em>header</em></span> and <span class="emphasis"><em>body</em></span> match
|
||
<span class="emphasis"><em><a class="link" href="advancedusage.html#regexp" title="2. Regular Expressions">regexp</a></em></span> in the
|
||
header/body of a message, <span class="emphasis"><em>index</em></span> matches
|
||
<span class="emphasis"><em><a class="link" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging">pattern</a></em></span> in the
|
||
message index. Note that IMAP server-side searches (=b, =B, =h) are
|
||
not supported for color index patterns.
|
||
</p><p>
|
||
When <a class="link" href="reference.html#header-color-partial" title="3.116. header_color_partial">$header_color_partial</a>
|
||
is unset (the default), a <span class="emphasis"><em>header</em></span> matched by
|
||
<span class="emphasis"><em>regexp</em></span> will have color applied to the entire header.
|
||
When set, color is applied only to the exact text matched by
|
||
<span class="emphasis"><em>regexp</em></span>.
|
||
</p><p>
|
||
<span class="emphasis"><em>object</em></span> can be one of:
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>attachment</p></li><li class="listitem"><p>bold (highlighting bold patterns in the body of messages)</p></li><li class="listitem"><p>error (error messages printed by Mutt)</p></li><li class="listitem"><p>hdrdefault (default color of the message header in the pager)</p></li><li class="listitem"><p>indicator (arrow or bar used to indicate the current item in a menu)</p></li><li class="listitem"><p>markers (the <span class="quote">“<span class="quote">+</span>”</span> markers at the beginning of wrapped lines in the pager)</p></li><li class="listitem"><p>message (informational messages)</p></li><li class="listitem"><p>normal</p></li><li class="listitem"><p>prompt</p></li><li class="listitem"><p>quoted (text matching <a class="link" href="reference.html#quote-regexp" title="3.274. quote_regexp">$quote_regexp</a> in the body of a message)</p></li><li class="listitem"><p>quoted1, quoted2, ..., quoted<span class="emphasis"><em>N</em></span> (higher levels of quoting)</p></li><li class="listitem"><p>search (highlighting of words in the pager)</p></li><li class="listitem"><p>signature</p></li><li class="listitem"><p>status (mode lines used to display info about the mailbox or message)</p></li><li class="listitem"><p>tilde (the <span class="quote">“<span class="quote">~</span>”</span> used to pad blank lines in the pager)</p></li><li class="listitem"><p>tree (thread tree drawn in the message index and attachment menu)</p></li><li class="listitem"><p>underline (highlighting underlined patterns in the body of messages)</p></li></ul></div><p>
|
||
<span class="emphasis"><em>composeobject</em></span> can be one of:
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>header</p></li><li class="listitem"><p>security_encrypt</p></li><li class="listitem"><p>security_sign</p></li><li class="listitem"><p>security_both</p></li><li class="listitem"><p>security_none</p></li></ul></div><p>
|
||
<span class="emphasis"><em>attribute</em></span> can be one of the following:
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>none</p></li><li class="listitem"><p>bold</p></li><li class="listitem"><p>underline</p></li><li class="listitem"><p>reverse</p></li><li class="listitem"><p>standout</p></li></ul></div><p>
|
||
<span class="emphasis"><em>foreground</em></span> and <span class="emphasis"><em>background</em></span> can
|
||
be one of the following:
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>white</p></li><li class="listitem"><p>black</p></li><li class="listitem"><p>green</p></li><li class="listitem"><p>magenta</p></li><li class="listitem"><p>blue</p></li><li class="listitem"><p>cyan</p></li><li class="listitem"><p>yellow</p></li><li class="listitem"><p>red</p></li><li class="listitem"><p>default</p></li><li class="listitem"><p>color<span class="emphasis"><em>x</em></span></p></li></ul></div><p>
|
||
The color name can optionally be prefixed with the keyword
|
||
<code class="literal">bright</code> or <code class="literal">light</code> to make the color
|
||
boldfaced or light (e.g., <code class="literal">brightred</code>). The precise
|
||
behavior depends on the terminal and its configuration. In particular,
|
||
the boldfaced/light difference and such background colors may be
|
||
available only for terminals configured with at least 16 colors,
|
||
as specified by the <code class="literal">$TERM</code> environment variable.
|
||
</p><p>
|
||
If your terminal supports it, the special keyword
|
||
<span class="emphasis"><em>default</em></span> can be used as a transparent color. The
|
||
value <span class="emphasis"><em>brightdefault</em></span> is also valid. If Mutt is
|
||
linked against the <span class="emphasis"><em>S-Lang</em></span> library, you also need to
|
||
set the <code class="literal">$COLORFGBG</code> environment variable to the
|
||
default colors of your terminal for this to work; for example (for
|
||
Bourne-like shells):
|
||
</p><pre class="screen">
|
||
set COLORFGBG="green;black"
|
||
export COLORFGBG
|
||
</pre><div class="note"><h3 class="title">Note</h3><p>
|
||
The <span class="emphasis"><em>S-Lang</em></span> library requires you to use the
|
||
<span class="emphasis"><em>lightgray</em></span> and <span class="emphasis"><em>brown</em></span> keywords
|
||
instead of <span class="emphasis"><em>white</em></span> and <span class="emphasis"><em>yellow</em></span>
|
||
when setting this variable.
|
||
</p></div><div class="note"><h3 class="title">Note</h3><p>
|
||
The <span class="command"><strong>uncolor</strong></span> command can be applied to the index,
|
||
header and body objects only. It removes entries from the list. You
|
||
<span class="emphasis"><em>must</em></span> specify the same pattern specified in the
|
||
<span class="command"><strong>color</strong></span> command for it to be removed. The pattern
|
||
<span class="quote">“<span class="quote">*</span>”</span> is a special token which means to clear the color list
|
||
of all entries.
|
||
</p></div><p>
|
||
Mutt also recognizes the keywords <span class="emphasis"><em>color0</em></span>,
|
||
<span class="emphasis"><em>color1</em></span>, ...,
|
||
<span class="emphasis"><em>color</em></span><span class="emphasis"><em>N-1</em></span>
|
||
(<span class="emphasis"><em>N</em></span> being the number of colors supported by your
|
||
terminal). This is useful when you remap the colors for your display
|
||
(for example by changing the color associated with
|
||
<span class="emphasis"><em>color2</em></span> for your xterm), since color names may then
|
||
lose their normal meaning.
|
||
</p><a id="mono"></a><p>
|
||
If your terminal does not support color, it is still possible change the
|
||
video attributes through the use of the <span class="quote">“<span class="quote">mono</span>”</span>
|
||
command. Usage:
|
||
</p><div class="cmdsynopsis"><p><code class="command">mono</code>
|
||
<em class="replaceable"><code>object</code></em>
|
||
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
<br /><code class="command">mono</code> {
|
||
<code class="option">header</code>
|
||
|
|
||
<code class="option">body</code>
|
||
}
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
<br /><code class="command">mono</code>
|
||
<code class="option">index</code>
|
||
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
<br /><code class="command">mono</code>
|
||
<code class="option">compose</code>
|
||
|
||
<em class="replaceable"><code>composeobject</code></em>
|
||
|
||
<em class="replaceable"><code>attribute</code></em>
|
||
<br /><code class="command">unmono</code> {
|
||
<code class="option">index</code>
|
||
|
|
||
<code class="option">header</code>
|
||
|
|
||
<code class="option">body</code>
|
||
} {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
... }</p></div><p>
|
||
For <span class="emphasis"><em>object</em></span>, <span class="emphasis"><em>composeobject</em></span>, and
|
||
<span class="emphasis"><em>attribute</em></span>, see the <span class="command"><strong>color</strong></span> command.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="msg-hdr-display"></a>12. Message Header Display</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="hdr-folding"></a>12.1. Header Display</h3></div></div></div><p>
|
||
When displaying a message in the pager, Mutt folds long header lines at
|
||
<a class="link" href="reference.html#wrap" title="3.418. wrap">$wrap</a> columns. Though there're precise rules
|
||
about where to break and how, Mutt always folds headers using a tab for
|
||
readability. (Note that the sending side is not affected by this, Mutt
|
||
tries to implement standards compliant folding.)
|
||
</p><p>
|
||
Despite not being a real header, Mutt will also display an mbox
|
||
"From_" line in the pager along with other headers. This
|
||
line can be manipulated with <span class="command"><strong>ignore/unignore</strong></span> and
|
||
<span class="command"><strong>hdr_order/unhdr_order</strong></span> commands.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ignore"></a>12.2. Selecting Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">ignore</code>
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
[
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
...]<br /><code class="command">unignore</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
... }</p></div><p>
|
||
Messages often have many header fields added by automatic processing
|
||
systems, or which may not seem useful to display on the screen. This
|
||
command allows you to specify header fields which you don't normally
|
||
want to see in the pager.
|
||
</p><p>
|
||
You do not need to specify the full header field name. For example,
|
||
<span class="quote">“<span class="quote">ignore content-</span>”</span> will ignore all header fields that begin
|
||
with the pattern <span class="quote">“<span class="quote">content-</span>”</span>. <span class="quote">“<span class="quote">ignore *</span>”</span> will
|
||
ignore all headers.
|
||
</p><p>
|
||
To remove a previously added token from the list, use the
|
||
<span class="quote">“<span class="quote">unignore</span>”</span> command. The <span class="quote">“<span class="quote">unignore</span>”</span> command
|
||
will make Mutt display headers with the given pattern. For example, if
|
||
you do <span class="quote">“<span class="quote">ignore x-</span>”</span> it is possible to <span class="quote">“<span class="quote">unignore
|
||
x-mailer</span>”</span>.
|
||
</p><p>
|
||
<span class="quote">“<span class="quote">unignore *</span>”</span> will remove all tokens from the ignore list.
|
||
</p><div class="example"><a id="ex-header-weeding"></a><p class="title"><strong>Example 3.11. Header weeding</strong></p><div class="example-contents"><pre class="screen">
|
||
<span class="comment"># Sven's draconian header weeding</span>
|
||
ignore *
|
||
unignore from date subject to cc
|
||
unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
|
||
unignore posted-to:
|
||
</pre></div></div><br class="example-break" /><p>
|
||
The above example will show "From:" headers as well as mbox
|
||
"From_" lines. To hide the latter, instead use
|
||
"<code class="literal">unignore from: date subject to cc</code>" on
|
||
the second line.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="hdr-order"></a>12.3. Ordering Displayed Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">hdr_order</code>
|
||
<em class="replaceable"><code>header</code></em>
|
||
[
|
||
<em class="replaceable"><code>header</code></em>
|
||
...]<br /><code class="command">unhdr_order</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>header</code></em>
|
||
... }</p></div><p>
|
||
With the <span class="command"><strong>hdr_order</strong></span> command you can specify an order
|
||
in which Mutt will attempt to present these headers to you when viewing
|
||
messages.
|
||
</p><p>
|
||
<span class="quote">“<span class="quote"><span class="command"><strong>unhdr_order</strong></span> *</span>”</span> will clear all previous
|
||
headers from the order list, thus removing the header order effects set
|
||
by the system-wide startup file.
|
||
</p><div class="example"><a id="ex-hdr-order"></a><p class="title"><strong>Example 3.12. Configuring header display order</strong></p><div class="example-contents"><pre class="screen">
|
||
hdr_order From Date: From: To: Cc: Subject:
|
||
</pre></div></div><br class="example-break" /></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternates"></a>13. Alternative Addresses</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alternates</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...]
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
[
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
...]<br /><code class="command">unalternates</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...] {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
... }</p></div><p>
|
||
With various functions, Mutt will treat messages differently, depending
|
||
on whether you sent them or whether you received them from someone else.
|
||
For instance, when replying to a message that you sent to a different
|
||
party, Mutt will automatically suggest to send the response to the
|
||
original message's recipients — responding to yourself won't make
|
||
much sense in many cases. (See <a class="link" href="reference.html#reply-to" title="3.285. reply_to">$reply_to</a>.)
|
||
</p><p>
|
||
Many users receive e-mail under a number of different addresses. To
|
||
fully use Mutt's features here, the program must be able to recognize
|
||
what e-mail addresses you receive mail under. That's the purpose of the
|
||
<span class="command"><strong>alternates</strong></span> command: It takes a list of regular
|
||
expressions, each of which can identify an address under which you
|
||
receive e-mail.
|
||
</p><p>
|
||
As addresses are matched using regular expressions and not exact strict
|
||
comparisons, you should make sure you specify your addresses as precise
|
||
as possible to avoid mismatches. For example, if you specify:
|
||
</p><pre class="screen">
|
||
alternates user@example
|
||
</pre><p>
|
||
Mutt will consider <span class="quote">“<span class="quote"><code class="literal">some-user@example</code></span>”</span>
|
||
as being your address, too which may not be desired. As a solution, in
|
||
such cases addresses should be specified as:
|
||
</p><pre class="screen">
|
||
alternates '^user@example$'
|
||
</pre><p>
|
||
The <code class="literal">-group</code> flag causes all of the subsequent regular
|
||
expressions to be added to the named group.
|
||
</p><p>
|
||
The <span class="command"><strong>unalternates</strong></span> command can be used to write
|
||
exceptions to <span class="command"><strong>alternates</strong></span> patterns. If an address
|
||
matches something in an <span class="command"><strong>alternates</strong></span> command, but you
|
||
nonetheless do not think it is from you, you can list a more precise
|
||
pattern under an <span class="command"><strong>unalternates</strong></span> command.
|
||
</p><p>
|
||
To remove a regular expression from the <span class="command"><strong>alternates</strong></span>
|
||
list, use the <span class="command"><strong>unalternates</strong></span> command with exactly the
|
||
same <span class="emphasis"><em>regexp</em></span>. Likewise, if the
|
||
<span class="emphasis"><em>regexp</em></span> for an <span class="command"><strong>alternates</strong></span> command
|
||
matches an entry on the <span class="command"><strong>unalternates</strong></span> list, that
|
||
<span class="command"><strong>unalternates</strong></span> entry will be removed. If the
|
||
<span class="emphasis"><em>regexp</em></span> for <span class="command"><strong>unalternates</strong></span> is
|
||
<span class="quote">“<span class="quote">*</span>”</span>, <span class="emphasis"><em>all entries</em></span> on
|
||
<span class="command"><strong>alternates</strong></span> will be removed.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lists"></a>14. Mailing Lists</h2></div></div></div><a id="subscribe"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">lists</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...]
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
[
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
...]<br /><code class="command">unlists</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
... }<br /><code class="command">subscribe</code> [
|
||
<code class="option">-group</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
...]
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
[
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
...]<br /><code class="command">unsubscribe</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
... }</p></div><p>
|
||
Mutt has a few nice features for <a class="link" href="advancedusage.html#using-lists" title="11. Handling Mailing Lists">handling
|
||
mailing lists</a>. In order to take advantage of them, you must
|
||
specify which addresses belong to mailing lists, and which mailing lists
|
||
you are subscribed to. Mutt also has limited support for auto-detecting
|
||
mailing lists: it supports parsing <code class="literal">mailto:</code> links in
|
||
the common <code class="literal">List-Post:</code> header which has the same
|
||
effect as specifying the list address via the <span class="command"><strong>lists</strong></span>
|
||
command (except the group feature). Once you have done this, the <a class="link" href="gettingstarted.html#list-reply"><code class="literal"><list-reply></code></a>
|
||
function will work for all known lists. Additionally, when you send a
|
||
message to a known list and <a class="link" href="reference.html#followup-to" title="3.99. followup_to">$followup_to</a> is set, Mutt will add a
|
||
Mail-Followup-To header. For unsubscribed lists, this will include
|
||
your personal address, ensuring you receive a copy of replies. For
|
||
subscribed mailing lists, the header will not, telling other users'
|
||
mail user agents not to send copies of replies to your personal
|
||
address.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
The Mail-Followup-To header is a non-standard extension which is not
|
||
supported by all mail user agents. Adding it is not bullet-proof
|
||
against receiving personal CCs of list messages. Also note that the
|
||
generation of the Mail-Followup-To header is controlled by the <a class="link" href="reference.html#followup-to" title="3.99. followup_to">$followup_to</a> configuration variable since
|
||
it's common practice on some mailing lists to send Cc upon replies
|
||
(which is more a group- than a list-reply).
|
||
</p></div><p>
|
||
More precisely, Mutt maintains lists of patterns for the addresses of
|
||
known and subscribed mailing lists. Every subscribed mailing list is
|
||
known. To mark a mailing list as known, use the <span class="command"><strong>list</strong></span>
|
||
command. To mark it as subscribed, use <span class="command"><strong>subscribe</strong></span>.
|
||
</p><p>
|
||
You can use regular expressions with both commands. To mark all messages
|
||
sent to a specific bug report's address on Debian's bug tracking system
|
||
as list mail, for instance, you could say
|
||
</p><pre class="screen">
|
||
subscribe [0-9]+.*@bugs.debian.org</pre><p>
|
||
as it's often sufficient to just give a portion of the list's e-mail
|
||
address.
|
||
</p><p>
|
||
Specify as much of the address as you need to remove ambiguity. For
|
||
example, if you've subscribed to the Mutt mailing list, you will receive
|
||
mail addressed to <code class="literal">mutt-users@mutt.org</code>. So, to tell
|
||
Mutt that this is a mailing list, you could add <code class="literal">lists
|
||
mutt-users@</code> to your initialization file. To tell Mutt that
|
||
you are subscribed to it, add <code class="literal"><span class="command"><strong>subscribe</strong></span>
|
||
mutt-users</code> to your initialization file instead. If you also
|
||
happen to get mail from someone whose address is
|
||
<code class="literal">mutt-users@example.com</code>, you could use
|
||
<code class="literal"><span class="command"><strong>lists</strong></span> ^mutt-users@mutt\\.org$</code> or
|
||
<code class="literal"><span class="command"><strong>subscribe</strong></span> ^mutt-users@mutt\\.org$</code>
|
||
to match only mail from the actual list.
|
||
</p><p>
|
||
The <code class="literal">-group</code> flag adds all of the subsequent regular
|
||
expressions to the named <a class="link" href="configuration.html#addrgroup" title="4. Address Groups">address group</a>
|
||
in addition to adding to the specified address list.
|
||
</p><p>
|
||
The <span class="quote">“<span class="quote">unlists</span>”</span> command is used to remove a token from the
|
||
list of known and subscribed mailing-lists. Use <span class="quote">“<span class="quote">unlists *</span>”</span>
|
||
to remove all tokens.
|
||
</p><p>
|
||
To remove a mailing list from the list of subscribed mailing lists, but
|
||
keep it on the list of known mailing lists, use
|
||
<span class="command"><strong>unsubscribe</strong></span>.
|
||
</p><p>
|
||
All of the mailing list configuration options described so far govern
|
||
mutt's knowledge of your list subscriptions and how it presents list
|
||
information to you. If you have a message from a mailing list, you
|
||
can also use the <a class="link" href="reference.html#tab-list-bindings" title="Table 9.16. Default List Menu Bindings">list
|
||
menu</a> (bound to "ESC L" by default) to interact with
|
||
the message's list's list server. This makes it easy to subscribe,
|
||
unsubscribe, and so on.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mbox-hook"></a>15. Using Multiple Spool Mailboxes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mbox-hook</code>
|
||
<em class="replaceable"><code>[!]regexp</code></em>
|
||
|
||
<em class="replaceable"><code>mailbox</code></em>
|
||
</p></div><p>
|
||
This command is used to move read messages from a specified mailbox to a
|
||
different mailbox automatically when you quit or change folders.
|
||
<span class="emphasis"><em>regexp</em></span> is a regular expression specifying the
|
||
mailbox to treat as a <span class="quote">“<span class="quote">spool</span>”</span> mailbox and
|
||
<span class="emphasis"><em>mailbox</em></span> specifies where mail should be saved when
|
||
read.
|
||
</p><p>
|
||
The regexp parameter has <a class="link" href="advancedusage.html#shortcuts" title="10. Mailbox Shortcuts">mailbox
|
||
shortcut</a> expansion performed on the first character.
|
||
See <a class="xref" href="advancedusage.html#mailbox-hook" title="6.2. Mailbox Matching in Hooks">Mailbox Matching in Hooks</a> for more details.
|
||
</p><p>
|
||
Note that execution of mbox-hooks is dependent on the <a class="link" href="reference.html#move" title="3.200. move">$move</a> configuration variable. If set to
|
||
<span class="quote">“<span class="quote">no</span>”</span> (the default), mbox-hooks will not be executed.
|
||
</p><p>
|
||
Unlike some of the other <span class="emphasis"><em>hook</em></span> commands, only the
|
||
<span class="emphasis"><em>first</em></span> matching regexp is used (it is not possible
|
||
to save read mail in more than a single mailbox).
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailboxes"></a>16. Monitoring Incoming Mail</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mailboxes</code> [
|
||
[
|
||
<code class="option">-notify</code>
|
||
|
|
||
<code class="option">-nonotify</code>
|
||
]
|
||
[
|
||
<code class="option">-poll</code>
|
||
|
|
||
<code class="option">-nopoll</code>
|
||
]
|
||
[
|
||
<code class="option">-label</code>
|
||
<em class="replaceable"><code>label</code></em>
|
||
|
|
||
<code class="option">-nolabel</code>
|
||
]
|
||
|
||
<em class="replaceable"><code>mailbox</code></em>
|
||
|
||
] [...]<br /><code class="command">unmailboxes</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>mailbox</code></em>
|
||
... }</p></div><p>
|
||
This command specifies folders which can receive mail and which will be
|
||
checked for new messages periodically.
|
||
</p><p>
|
||
Use <code class="literal">-nonotify</code> to disable notifying when new mail
|
||
arrives. The <code class="literal">-notify</code> argument can be used to reenable
|
||
notifying for an existing mailbox. If unspecified: a new
|
||
mailbox will notify by default, while an existing mailbox will be
|
||
unchanged.
|
||
</p><p>
|
||
To disable polling, specify <code class="literal">-nopoll</code> before the
|
||
mailbox name. The <code class="literal">-poll</code> argument can be used to
|
||
reenable polling for an existing mailbox. If unspecified: a new
|
||
mailbox will poll by default, while an existing mailbox will be
|
||
unchanged.
|
||
</p><p>
|
||
The <code class="literal">-label</code> argument can be used to specify an
|
||
alternative label to print in the sidebar or mailbox browser instead
|
||
of the mailbox path. A label may be removed via the
|
||
<code class="literal">-nolabel</code> argument. If unspecified, an existing
|
||
mailbox label will be unchanged.
|
||
</p><p>
|
||
<span class="emphasis"><em>mailbox</em></span> can either be a local file or directory
|
||
(Mbox/Mmdf or Maildir/Mh). If Mutt was built with POP and/or IMAP
|
||
support, <span class="emphasis"><em>mailbox</em></span> can also be a POP/IMAP folder
|
||
URL. The URL syntax is described in <a class="xref" href="optionalfeatures.html#url-syntax" title="1.2. URL Syntax">Section 1.2, “URL Syntax”</a>, POP
|
||
and IMAP are described in <a class="xref" href="optionalfeatures.html#pop" title="3. POP3 Support">Section 3, “POP3 Support”</a> and <a class="xref" href="optionalfeatures.html#imap" title="4. IMAP Support">Section 4, “IMAP Support”</a> respectively.
|
||
</p><p>
|
||
Mutt provides a number of advanced features for handling (possibly many)
|
||
folders and new mail within them, please refer to <a class="xref" href="advancedusage.html#new-mail" title="13. New Mail Detection">Section 13, “New Mail Detection”</a> for details (including in what situations and how
|
||
often Mutt checks for new mail).
|
||
Additionally, <a class="link" href="reference.html#new-mail-command" title="3.204. new_mail_command">$new_mail_command</a>
|
||
can be used to run a command when new mail is detected.
|
||
</p><p>
|
||
The <span class="quote">“<span class="quote">unmailboxes</span>”</span> command is used to remove a token from
|
||
the list of folders which receive mail. Use <span class="quote">“<span class="quote">unmailboxes *</span>”</span>
|
||
to remove all tokens.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
The folders in the <span class="command"><strong>mailboxes</strong></span> command are resolved
|
||
when the command is executed, so if these names contain <a class="link" href="advancedusage.html#shortcuts" title="10. Mailbox Shortcuts">shortcut characters</a> (such as <span class="quote">“<span class="quote">=</span>”</span>
|
||
and <span class="quote">“<span class="quote">!</span>”</span>), any variable definition that affects these
|
||
characters (like <a class="link" href="reference.html#folder" title="3.97. folder">$folder</a> and <a class="link" href="reference.html#spoolfile" title="3.370. spoolfile">$spoolfile</a>) should be set before the
|
||
<span class="command"><strong>mailboxes</strong></span> command. If none of these shortcuts are
|
||
used, a local path should be absolute as otherwise Mutt tries to find it
|
||
relative to the directory from where Mutt was started which may not
|
||
always be desired.
|
||
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="my-hdr"></a>17. User-Defined Headers</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">my_hdr</code>
|
||
<em class="replaceable"><code>string</code></em>
|
||
<br /><code class="command">unmy_hdr</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>field</code></em>
|
||
... }</p></div><p>
|
||
The <span class="command"><strong>my_hdr</strong></span> command allows you to add custom header
|
||
fields to every message you send. It can also be used as an alternate
|
||
way to set some standard envelope header fields, see below for more
|
||
details.
|
||
</p><p>
|
||
Custom header fields will be added to every message you send and
|
||
appear in the editor if <a class="link" href="reference.html#edit-headers" title="3.84. edit_headers">$edit_headers</a> is set.
|
||
</p><p>
|
||
For example, if you would like to add an <span class="quote">“<span class="quote">Organization:</span>”</span>
|
||
header field to all of your outgoing messages, you can put the command
|
||
something like shown in <a class="xref" href="configuration.html#ex-my-hdr" title="Example 3.13. Defining custom headers">Example 3.13, “Defining custom headers”</a> in your
|
||
<code class="literal">.muttrc</code>.
|
||
</p><div class="example"><a id="ex-my-hdr"></a><p class="title"><strong>Example 3.13. Defining custom headers</strong></p><div class="example-contents"><pre class="screen">
|
||
my_hdr Organization: A Really Big Company, Anytown, USA
|
||
</pre></div></div><br class="example-break" /><p>
|
||
The standard envelope header fields To, Cc, Bcc, Subject, From,
|
||
Reply-To, and Message-ID can also be set via
|
||
<span class="command"><strong>my_hdr</strong></span>. For more details about when those are
|
||
processed, see <a class="xref" href="advancedusage.html#compose-flow" title="18. Message Composition Flow">Section 18, “Message Composition Flow”</a>. Note that trying to
|
||
set the value of other Mutt generated header fields is not supported,
|
||
and may result in an invalid email being generated.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
Space characters are <span class="emphasis"><em>not</em></span> allowed between the
|
||
keyword and the colon (<span class="quote">“<span class="quote">:</span>”</span>). The standard for electronic
|
||
mail (RFC2822) says that space is illegal there, so Mutt enforces the
|
||
rule.
|
||
</p></div><p>
|
||
If you would like to add a header field to a single message, you should
|
||
either set the <a class="link" href="reference.html#edit-headers" title="3.84. edit_headers">$edit_headers</a>
|
||
variable, or use the <code class="literal"><edit-headers></code> function
|
||
(default: <span class="quote">“<span class="quote">E</span>”</span>) in the compose menu so that you can edit the
|
||
header of your message along with the body.
|
||
</p><p>
|
||
To remove user defined header fields, use the
|
||
<span class="command"><strong>unmy_hdr</strong></span> command. You may specify an asterisk
|
||
(<span class="quote">“<span class="quote">*</span>”</span>) to remove all header fields, or the fields to
|
||
remove. For example, to remove all <span class="quote">“<span class="quote">To</span>”</span> and
|
||
<span class="quote">“<span class="quote">Cc</span>”</span> header fields, you could use:
|
||
</p><pre class="screen">
|
||
unmy_hdr to cc
|
||
</pre></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="save-hook"></a>18. Specify Default Save Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">save-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>mailbox</code></em>
|
||
</p></div><p>
|
||
This command is used to override the default mailbox used when saving
|
||
messages. <span class="emphasis"><em>mailbox</em></span> will be used as the default if
|
||
the message matches <span class="emphasis"><em>pattern</em></span>, see <a class="xref" href="advancedusage.html#pattern-hook" title="6.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format.
|
||
</p><p>
|
||
To provide more flexibility and good defaults, Mutt applies the expandos
|
||
of <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> to
|
||
<span class="emphasis"><em>mailbox</em></span> after it was expanded.
|
||
</p><div class="example"><a id="ex-save-hook-exando"></a><p class="title"><strong>Example 3.14. Using %-expandos in <span class="command">save-hook</span></strong></p><div class="example-contents"><pre class="screen">
|
||
<span class="comment"># default: save all to ~/Mail/<author name></span>
|
||
save-hook . ~/Mail/%F
|
||
|
||
<span class="comment"># save from me@turing.cs.hmc.edu and me@cs.hmc.edu to $folder/elkins</span>
|
||
save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins
|
||
|
||
<span class="comment"># save from aol.com to $folder/spam</span>
|
||
save-hook aol\\.com$ +spam
|
||
</pre></div></div><br class="example-break" /><p>
|
||
Also see the <a class="link" href="configuration.html#fcc-save-hook" title="20. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-hook"></a>19. Specify Default Fcc: Mailbox When Composing</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>mailbox</code></em>
|
||
</p></div><p>
|
||
This command is used to save outgoing mail in a mailbox other than <a class="link" href="reference.html#record" title="3.279. record">$record</a>. Mutt searches the initial list of
|
||
message recipients for the first matching <span class="emphasis"><em>pattern</em></span>
|
||
and uses <span class="emphasis"><em>mailbox</em></span> as the default Fcc: mailbox. If
|
||
no match is found the message will be saved to <a class="link" href="reference.html#record" title="3.279. record">$record</a> mailbox.
|
||
</p><p>
|
||
To provide more flexibility and good defaults, Mutt applies the
|
||
expandos of <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> to
|
||
<span class="emphasis"><em>mailbox</em></span> after it was expanded.
|
||
</p><p>
|
||
See <a class="xref" href="advancedusage.html#pattern-hook" title="6.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format
|
||
of <span class="emphasis"><em>pattern</em></span>.
|
||
</p><pre class="screen">fcc-hook [@.]aol\\.com$ +spammers</pre><p>
|
||
...will save a copy of all messages going to the aol.com domain to the
|
||
`+spammers' mailbox by default. Also see the <a class="link" href="configuration.html#fcc-save-hook" title="20. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
|
||
</p><p>
|
||
Multiple mailboxes may be specified by separating them with <a class="link" href="reference.html#fcc-delimiter" title="3.95. fcc_delimiter">$fcc_delimiter</a>, if set:
|
||
</p><pre class="screen">
|
||
set fcc_delimiter = ','
|
||
fcc-hook 'foo@example\.com$' '+one,+two'
|
||
</pre></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-save-hook"></a>20. Specify Default Save Filename and Default Fcc: Mailbox at Once</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-save-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>mailbox</code></em>
|
||
</p></div><p>
|
||
This command is a shortcut, almost equivalent to doing both a <a class="link" href="configuration.html#fcc-hook" title="19. Specify Default Fcc: Mailbox When Composing"><span class="command"><strong>fcc-hook</strong></span></a> and a <a class="link" href="configuration.html#save-hook" title="18. Specify Default Save Mailbox"><span class="command"><strong>save-hook</strong></span></a> with its
|
||
arguments, including %-expansion on <span class="emphasis"><em>mailbox</em></span>
|
||
according to <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a>.
|
||
</p><p>
|
||
Note, however that the fcc-save-hook is not designed to take advantage
|
||
of multiple mailboxes, as fcc-hook is. For correct behavior, you should
|
||
use separate fcc and save hooks in that case.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="send-hook"></a>21. Change Settings Based Upon Message Recipients</h2></div></div></div><a id="reply-hook"></a><a id="send2-hook"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">reply-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>command</code></em>
|
||
<br /><code class="command">send-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>command</code></em>
|
||
<br /><code class="command">send2-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>command</code></em>
|
||
</p></div><p>
|
||
These commands can be used to execute arbitrary configuration commands
|
||
based upon recipients of the message. <span class="emphasis"><em>pattern</em></span> is
|
||
used to match the message, see <a class="xref" href="advancedusage.html#pattern-hook" title="6.1. Message Matching in Hooks">Message Matching in Hooks</a> for
|
||
details. <span class="emphasis"><em>command</em></span> is executed when
|
||
<span class="emphasis"><em>pattern</em></span> matches.
|
||
</p><p>
|
||
<span class="command"><strong>reply-hook</strong></span> is matched against the message you are
|
||
<span class="emphasis"><em>replying to</em></span>, instead of the message you are
|
||
<span class="emphasis"><em>sending</em></span>. <span class="command"><strong>send-hook</strong></span> is matched
|
||
against all messages, both <span class="emphasis"><em>new</em></span> and
|
||
<span class="emphasis"><em>replies</em></span>.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
<span class="command"><strong>reply-hook</strong></span>s are matched <span class="emphasis"><em>before</em></span> the
|
||
<span class="command"><strong>send-hook</strong></span>, <span class="emphasis"><em>regardless</em></span> of the order
|
||
specified in the user's configuration file. However, you can inhibit
|
||
<span class="command"><strong>send-hook</strong></span> in the reply case by using the pattern
|
||
<code class="literal">'! ~Q'</code> (<span class="emphasis"><em>not replied</em></span>, see
|
||
<a class="xref" href="advancedusage.html#pattern-hook" title="6.1. Message Matching in Hooks">Message Matching in Hooks</a>) in the <span class="command"><strong>send-hook</strong></span> to tell
|
||
when <span class="command"><strong>reply-hook</strong></span> have been executed.
|
||
</p></div><p>
|
||
<span class="command"><strong>send2-hook</strong></span> is matched every time a message is
|
||
changed, either by editing it, or by using the compose menu to change
|
||
its recipients or subject. <span class="command"><strong>send2-hook</strong></span> is executed
|
||
after <span class="command"><strong>send-hook</strong></span>, and can, e.g., be used to set
|
||
parameters such as the <a class="link" href="reference.html#sendmail" title="3.305. sendmail">$sendmail</a>
|
||
variable depending on the message's sender address.
|
||
</p><p>
|
||
For each type of <span class="command"><strong>send-hook</strong></span> or
|
||
<span class="command"><strong>reply-hook</strong></span>, when multiple matches occur, commands are
|
||
executed in the order they are specified in the
|
||
<code class="literal">.muttrc</code> (for that type of hook).
|
||
</p><p>
|
||
Example: <code class="literal"><span class="command"><strong>send-hook</strong></span> mutt
|
||
"<span class="command"><strong>set</strong></span> mime_forward signature=''"</code>
|
||
</p><p>
|
||
Another typical use for this command is to change the values of the
|
||
<a class="link" href="reference.html#attribution" title="3.20. attribution">$attribution</a>, <a class="link" href="reference.html#attribution-locale" title="3.21. attribution_locale">$attribution_locale</a>, and <a class="link" href="reference.html#signature" title="3.323. signature">$signature</a> variables in order to change the
|
||
language of the attributions and signatures based upon the recipients.
|
||
</p><div class="note"><h3 class="title">Note</h3><p>
|
||
<span class="command"><strong>send-hook</strong></span>'s are only executed once after getting the
|
||
initial list of recipients. They are not executed when resuming a postponed
|
||
draft. Adding a recipient after replying or
|
||
editing the message will not cause any <span class="command"><strong>send-hook</strong></span> to
|
||
be executed, similarly if <a class="link" href="reference.html#autoedit" title="3.28. autoedit">$autoedit</a> is
|
||
set (as then the initial list of recipients is empty). Also note that
|
||
<a class="link" href="configuration.html#my-hdr" title="17. User-Defined Headers"><span class="command"><strong>my_hdr</strong></span></a> commands which
|
||
modify recipient headers, or the message's subject, don't have any
|
||
effect on the current message when executed from a
|
||
<span class="command"><strong>send-hook</strong></span>.
|
||
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="message-hook"></a>22. Change Settings Before Formatting a Message</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">message-hook</code>
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>command</code></em>
|
||
</p></div><p>
|
||
This command can be used to execute arbitrary configuration commands
|
||
before viewing or formatting a message based upon information about the
|
||
message. <span class="emphasis"><em>command</em></span> is executed if the
|
||
<span class="emphasis"><em>pattern</em></span> matches the message to be displayed. When
|
||
multiple matches occur, commands are executed in the order they are
|
||
specified in the <code class="literal">.muttrc</code>.
|
||
</p><p>
|
||
See <a class="xref" href="advancedusage.html#pattern-hook" title="6.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format
|
||
of <span class="emphasis"><em>pattern</em></span>.
|
||
</p><p>
|
||
Example:
|
||
</p><pre class="screen">
|
||
message-hook ~A 'set pager=builtin'
|
||
message-hook '~f freshmeat-news' 'set pager="less \"+/^ subject: .*\""'
|
||
</pre></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="crypt-hook"></a>23. Choosing the Cryptographic Key of the Recipient</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">crypt-hook</code>
|
||
<em class="replaceable"><code>regexp</code></em>
|
||
|
||
<em class="replaceable"><code>keyid</code></em>
|
||
</p></div><p>
|
||
When encrypting messages with PGP/GnuPG or OpenSSL, you may want to
|
||
associate a certain key with a given e-mail address automatically,
|
||
either because the recipient's public key can't be deduced from the
|
||
destination address, or because, for some reasons, you need to override
|
||
the key Mutt would normally use. The <span class="command"><strong>crypt-hook</strong></span>
|
||
command provides a method by which you can specify the ID of the public
|
||
key to be used when encrypting messages to a certain recipient.
|
||
You may use multiple crypt-hooks with the same regexp; multiple
|
||
matching crypt-hooks result in the use of multiple keyids for
|
||
a recipient. During key selection, Mutt will confirm whether each
|
||
crypt-hook is to be used (unless the <a class="link" href="reference.html#crypt-confirmhook" title="3.60. crypt_confirmhook">$crypt_confirmhook</a> option is unset).
|
||
If all crypt-hooks for a recipient are declined, Mutt will use the
|
||
original recipient address for key selection instead.
|
||
</p><p>
|
||
The meaning of <span class="emphasis"><em>keyid</em></span> is to be taken broadly in this
|
||
context: You can either put a numerical key ID or fingerprint here, an
|
||
e-mail address, or even just a real name.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="index-format-hook"></a>24. Dynamically Changing $index_format using Patterns</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">index-format-hook</code>
|
||
<em class="replaceable"><code>name</code></em>
|
||
|
||
<em class="replaceable"><code>[!]pattern</code></em>
|
||
|
||
<em class="replaceable"><code>format-string</code></em>
|
||
</p></div><p>
|
||
This command is used to inject format strings dynamically into <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> based on pattern matching
|
||
against the current message.
|
||
</p><p>
|
||
The <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> expando
|
||
<span class="emphasis"><em>%@name@</em></span> specifies a placeholder for the
|
||
injection. Index-format-hooks with the same <span class="emphasis"><em>name</em></span>
|
||
are matched using <a class="link" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging"><span class="emphasis"><em>pattern</em></span></a> against the
|
||
current message. Matching is done in the order specified in the
|
||
.muttrc, with the first match being used. The hook's
|
||
<span class="emphasis"><em>format-string</em></span> is then substituted and evaluated.
|
||
</p><p>
|
||
Because the first match is used, best practice is to put a catch-all
|
||
<span class="emphasis"><em>~A</em></span> pattern as the last hook. Here is an example
|
||
showing how to implement dynamic date formatting:
|
||
</p><pre class="screen">
|
||
set index_format="%4C %-6@date@ %-15.15F %Z (%4c) %s"
|
||
|
||
index-format-hook date "~d<1d" "%[%H:%M]"
|
||
index-format-hook date "~d<1m" "%[%a %d]"
|
||
index-format-hook date "~d<1y" "%[%b %d]"
|
||
index-format-hook date "~A" "%[%m/%y]"
|
||
</pre><p>
|
||
Another example, showing a way to prepend to the subject. Note that
|
||
without a catch-all ~A pattern, no match results in the expando
|
||
being replaced with an empty string.
|
||
</p><pre class="screen">
|
||
set index_format="%4C %@subj_flags@%s"
|
||
|
||
index-format-hook subj_flags "~f boss@example.com" "** BOSS ** "
|
||
index-format-hook subj_flags "~f spouse@example.com" ":-) "
|
||
</pre></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="push"></a>25. Adding Key Sequences to the Keyboard Buffer</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">push</code>
|
||
<em class="replaceable"><code>string</code></em>
|
||
</p></div><p>
|
||
This command adds the named string to the beginning of the keyboard buffer. The string
|
||
may contain control characters, key names and function names like the
|
||
sequence string in the <a class="link" href="configuration.html#macro" title="10. Keyboard Macros">macro</a> command. You
|
||
may use it to automatically run a sequence of commands at startup, or
|
||
when entering certain folders. For example, <a class="xref" href="configuration.html#ex-folder-hook-push" title="Example 3.15. Embedding push in folder-hook">Example 3.15, “Embedding <span class="command">push</span> in <span class="command">folder-hook</span>”</a> shows how to automatically collapse all
|
||
threads when entering a folder.
|
||
</p><div class="example"><a id="ex-folder-hook-push"></a><p class="title"><strong>Example 3.15. Embedding <span class="command">push</span> in <span class="command">folder-hook</span></strong></p><div class="example-contents"><pre class="screen">
|
||
folder-hook . 'push <collapse-all>'
|
||
</pre></div></div><br class="example-break" /><p>
|
||
For using functions like shown in the example, it's important to use
|
||
angle brackets (<span class="quote">“<span class="quote"><</span>”</span> and <span class="quote">“<span class="quote">></span>”</span>) to make
|
||
Mutt recognize the input as a function name. Otherwise it will simulate
|
||
individual just keystrokes, i.e. <span class="quote">“<span class="quote"><code class="literal">push
|
||
collapse-all</code></span>”</span> would be interpreted as if you had typed
|
||
<span class="quote">“<span class="quote">c</span>”</span>, followed by <span class="quote">“<span class="quote">o</span>”</span>, followed by
|
||
<span class="quote">“<span class="quote">l</span>”</span>, ..., which is not desired and may lead to very
|
||
unexpected behavior.
|
||
</p><p>
|
||
Keystrokes can be used, too, but are less portable because of
|
||
potentially changed key bindings. With default bindings, this is
|
||
equivalent to the above example:
|
||
</p><pre class="screen">
|
||
folder-hook . 'push \eV'
|
||
</pre><p>
|
||
because it simulates that Esc+V was pressed (which is the default
|
||
binding of <code class="literal"><collapse-all></code>).
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="exec"></a>26. Executing Functions</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">exec</code>
|
||
<em class="replaceable"><code>function</code></em>
|
||
[
|
||
<em class="replaceable"><code>function</code></em>
|
||
...]</p></div><p>
|
||
This command can be used to execute any function. Functions are listed
|
||
in the <a class="link" href="reference.html#functions" title="4. Functions">function reference</a>.
|
||
<span class="quote">“<span class="quote"><span class="command"><strong>exec</strong></span> <code class="literal">function</code></span>”</span> is
|
||
equivalent to <span class="quote">“<span class="quote"><code class="literal">push <function></code></span>”</span>.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="score-command"></a>27. Message Scoring</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">score</code>
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
|
||
<em class="replaceable"><code>value</code></em>
|
||
<br /><code class="command">unscore</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
... }</p></div><p>
|
||
The <span class="command"><strong>score</strong></span> commands adds <span class="emphasis"><em>value</em></span>
|
||
to a message's score if <span class="emphasis"><em>pattern</em></span> matches it.
|
||
<span class="emphasis"><em>pattern</em></span> is a string in the format described in
|
||
the <a class="link" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging">patterns</a> section (note: For
|
||
efficiency reasons, patterns which scan information not available in
|
||
the index, such as <code class="literal">~b</code>, <code class="literal">~B</code>,
|
||
<code class="literal">~h</code>, <code class="literal">~M</code>, or <code class="literal">~X</code>
|
||
may not be used). <span class="emphasis"><em>value</em></span> is a positive or
|
||
negative integer. A message's final score is the sum total of all
|
||
matching <span class="command"><strong>score</strong></span> entries. However, you may
|
||
optionally prefix <span class="emphasis"><em>value</em></span> with an equal sign
|
||
(<span class="quote">“<span class="quote">=</span>”</span>) to cause evaluation to stop at a particular entry
|
||
if there is a match. Negative final scores are rounded up to 0.
|
||
</p><p>
|
||
The <span class="command"><strong>unscore</strong></span> command removes score entries from the
|
||
list. You <span class="emphasis"><em>must</em></span> specify the same pattern specified
|
||
in the <span class="command"><strong>score</strong></span> command for it to be removed. The
|
||
pattern <span class="quote">“<span class="quote">*</span>”</span> is a special token which means to clear the
|
||
list of all score entries.
|
||
</p><p>
|
||
Scoring occurs as the messages are read in, before the mailbox is
|
||
sorted. Because of this, patterns which depend on threading, such as
|
||
<span class="emphasis"><em>~=</em></span>, <span class="emphasis"><em>~$</em></span>, and
|
||
<span class="emphasis"><em>~()</em></span>, will not work by default. A workaround is
|
||
to push the scoring command in a folder hook. This will cause the
|
||
mailbox to be rescored after it is opened and input starts being
|
||
processed:
|
||
</p><pre class="screen">
|
||
folder-hook . 'push "<enter-command>score ~= 10<enter>"'
|
||
</pre></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spam"></a>28. Spam Detection</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">spam</code>
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
|
||
<em class="replaceable"><code>format</code></em>
|
||
<br /><code class="command">nospam</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>pattern</code></em>
|
||
}</p></div><p>
|
||
Mutt has generalized support for external spam-scoring filters. By
|
||
defining your spam patterns with the <span class="command"><strong>spam</strong></span> and
|
||
<code class="literal">nospam</code> commands, you can <span class="emphasis"><em>limit</em></span>,
|
||
<span class="emphasis"><em>search</em></span>, and <span class="emphasis"><em>sort</em></span> your mail
|
||
based on its spam attributes, as determined by the external filter. You
|
||
also can display the spam attributes in your index display using the
|
||
<code class="literal">%H</code> selector in the <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> variable. (Tip: try
|
||
<code class="literal">%?H?[%H] ?</code> to display spam tags only when they are
|
||
defined for a given message.)
|
||
</p><p>
|
||
Note: the value displayed by <code class="literal">%H</code> and searched by
|
||
<code class="literal">~H</code> is stored in the <a class="link" href="optionalfeatures.html#caching" title="8. Local Caching">header
|
||
cache</a>. Mutt isn't smart enough to invalidate a header cache
|
||
entry based on changing <code class="literal">spam</code> rules, so if you
|
||
aren't seeing correct <code class="literal">%H</code> values, try temporarily
|
||
turning off the header cache. If that fixes the problem, then once
|
||
your spam rules are set to your liking, remove your stale header cache
|
||
files and turn the header cache back on.
|
||
</p><p>
|
||
Your first step is to define your external filter's spam patterns using
|
||
the <span class="command"><strong>spam</strong></span> command. <span class="emphasis"><em>pattern</em></span> should
|
||
be a regular expression that matches a header in a mail message. If any
|
||
message in the mailbox matches this regular expression, it will receive
|
||
a <span class="quote">“<span class="quote">spam tag</span>”</span> or <span class="quote">“<span class="quote">spam attribute</span>”</span> (unless it
|
||
also matches a <span class="command"><strong>nospam</strong></span> pattern — see below.) The
|
||
appearance of this attribute is entirely up to you, and is governed by
|
||
the <span class="emphasis"><em>format</em></span> parameter. <span class="emphasis"><em>format</em></span>
|
||
can be any static text, but it also can include back-references from the
|
||
<span class="emphasis"><em>pattern</em></span> expression. (A regular expression
|
||
<span class="quote">“<span class="quote">back-reference</span>”</span> refers to a sub-expression contained
|
||
within parentheses.) <code class="literal">%1</code> is replaced with the first
|
||
back-reference in the regex, <code class="literal">%2</code> with the second, etc.
|
||
</p><p>
|
||
To match spam tags, mutt needs the corresponding header information
|
||
which is always the case for local and POP folders but not for IMAP in
|
||
the default configuration. Depending on the spam header to be analyzed,
|
||
<a class="link" href="reference.html#imap-headers" title="3.140. imap_headers">$imap_headers</a> may need to be
|
||
adjusted.
|
||
</p><p>
|
||
If you're using multiple spam filters, a message can have more than one
|
||
spam-related header. You can define <span class="command"><strong>spam</strong></span> patterns for
|
||
each filter you use. If a message matches two or more of these patterns,
|
||
and the <a class="link" href="reference.html#spam-separator" title="3.369. spam_separator">$spam_separator</a> variable
|
||
is set to a string, then the message's spam tag will consist of all the
|
||
<span class="emphasis"><em>format</em></span> strings joined together, with the value of
|
||
<a class="link" href="reference.html#spam-separator" title="3.369. spam_separator">$spam_separator</a> separating them.
|
||
</p><p>
|
||
For example, suppose one uses DCC, SpamAssassin, and PureMessage, then
|
||
the configuration might look like in <a class="xref" href="configuration.html#ex-spam" title="Example 3.16. Configuring spam detection">Example 3.16, “Configuring spam detection”</a>.
|
||
</p><div class="example"><a id="ex-spam"></a><p class="title"><strong>Example 3.16. Configuring spam detection</strong></p><div class="example-contents"><pre class="screen">
|
||
spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
|
||
spam "X-Spam-Status: Yes" "90+/SA"
|
||
spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
|
||
set spam_separator=", "
|
||
</pre></div></div><br class="example-break" /><p>
|
||
If then a message is received that DCC registered with
|
||
<span class="quote">“<span class="quote">many</span>”</span> hits under the <span class="quote">“<span class="quote">Fuz2</span>”</span> checksum, and
|
||
that PureMessage registered with a 97% probability of being spam, that
|
||
message's spam tag would read <code class="literal">90+/DCC-Fuz2,
|
||
97/PM</code>. (The four characters before <span class="quote">“<span class="quote">=many</span>”</span> in a
|
||
DCC report indicate the checksum used — in this case,
|
||
<span class="quote">“<span class="quote">Fuz2</span>”</span>.)
|
||
</p><p>
|
||
If the <a class="link" href="reference.html#spam-separator" title="3.369. spam_separator">$spam_separator</a> variable is
|
||
unset, then each spam pattern match supersedes the previous one. Instead
|
||
of getting joined <span class="emphasis"><em>format</em></span> strings, you'll get only
|
||
the last one to match.
|
||
</p><p>
|
||
The spam tag is what will be displayed in the index when you use
|
||
<code class="literal">%H</code> in the <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> variable. It's also the
|
||
string that the <code class="literal">~H</code> pattern-matching expression
|
||
matches against for <code class="literal"><search></code> and
|
||
<code class="literal"><limit></code> functions. And it's what sorting by
|
||
spam attribute will use as a sort key.
|
||
</p><p>
|
||
That's a pretty complicated example, and most people's actual
|
||
environments will have only one spam filter. The simpler your
|
||
configuration, the more effective Mutt can be, especially when it comes
|
||
to sorting.
|
||
</p><p>
|
||
Generally, when you sort by spam tag, Mutt will sort
|
||
<span class="emphasis"><em>lexically</em></span> — that is, by ordering strings
|
||
alphanumerically. However, if a spam tag begins with a number, Mutt will
|
||
sort numerically first, and lexically only when two numbers are equal in
|
||
value. (This is like UNIX's <code class="literal">sort -n</code>.) A message with
|
||
no spam attributes at all — that is, one that didn't match
|
||
<span class="emphasis"><em>any</em></span> of your <span class="command"><strong>spam</strong></span> patterns
|
||
— is sorted at lowest priority. Numbers are sorted next, beginning
|
||
with 0 and ranging upward. Finally, non-numeric strings are sorted, with
|
||
<span class="quote">“<span class="quote">a</span>”</span> taking lower priority than <span class="quote">“<span class="quote">z</span>”</span>. Clearly,
|
||
in general, sorting by spam tags is most effective when you can coerce
|
||
your filter to give you a raw number. But in case you can't, Mutt can
|
||
still do something useful.
|
||
</p><p>
|
||
The <span class="command"><strong>nospam</strong></span> command can be used to write exceptions to
|
||
<span class="command"><strong>spam</strong></span> patterns. If a header pattern matches something
|
||
in a <span class="command"><strong>spam</strong></span> command, but you nonetheless do not want it
|
||
to receive a spam tag, you can list a more precise pattern under a
|
||
<span class="command"><strong>nospam</strong></span> command.
|
||
</p><p>
|
||
If the <span class="emphasis"><em>pattern</em></span> given to <span class="command"><strong>nospam</strong></span>
|
||
is exactly the same as the <span class="emphasis"><em>pattern</em></span> on an existing
|
||
<span class="command"><strong>spam</strong></span> list entry, the effect will be to remove the
|
||
entry from the spam list, instead of adding an exception. Likewise, if
|
||
the <span class="emphasis"><em>pattern</em></span> for a <span class="command"><strong>spam</strong></span> command
|
||
matches an entry on the <span class="command"><strong>nospam</strong></span> list, that nospam
|
||
entry will be removed. If the <span class="emphasis"><em>pattern</em></span> for
|
||
<span class="command"><strong>nospam</strong></span> is <span class="quote">“<span class="quote">*</span>”</span>, <span class="emphasis"><em>all entries on
|
||
both lists</em></span> will be removed. This might be the default action
|
||
if you use <span class="command"><strong>spam</strong></span> and <span class="command"><strong>nospam</strong></span> in
|
||
conjunction with a <span class="command"><strong>folder-hook</strong></span>.
|
||
</p><p>
|
||
You can have as many <span class="command"><strong>spam</strong></span> or
|
||
<span class="command"><strong>nospam</strong></span> commands as you like. You can even do your
|
||
own primitive <span class="command"><strong>spam</strong></span> detection within Mutt — for
|
||
example, if you consider all mail from <code class="literal">MAILER-DAEMON</code>
|
||
to be spam, you can use a <span class="command"><strong>spam</strong></span> command like this:
|
||
</p><pre class="screen">
|
||
spam "^From: .*MAILER-DAEMON" "999"
|
||
</pre></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="set"></a>29. Setting and Querying Variables</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-types"></a>29.1. Variable Types</h3></div></div></div><p>
|
||
Mutt supports these types of configuration variables:
|
||
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">boolean</span></dt><dd><p>
|
||
A boolean expression, either <span class="quote">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</span>.
|
||
</p></dd><dt><span class="term">number</span></dt><dd><p>
|
||
A signed integer number in the range -32768 to 32767.
|
||
</p></dd><dt><span class="term">number (long)</span></dt><dd><p>
|
||
A signed integer number in the range -2147483648 to 2147483647.
|
||
</p></dd><dt><span class="term">string</span></dt><dd><p>
|
||
Arbitrary text.
|
||
</p></dd><dt><span class="term">path</span></dt><dd><p>
|
||
A specialized string for representing paths including support for
|
||
mailbox shortcuts (see <a class="xref" href="advancedusage.html#shortcuts" title="10. Mailbox Shortcuts">Section 10, “Mailbox Shortcuts”</a>) as well as tilde
|
||
(<span class="quote">“<span class="quote">~</span>”</span>) for a user's home directory and more.
|
||
</p></dd><dt><span class="term">quadoption</span></dt><dd><p>
|
||
Like a boolean but triggers a prompt when set to <span class="quote">“<span class="quote">ask-yes</span>”</span>
|
||
or <span class="quote">“<span class="quote">ask-no</span>”</span> with <span class="quote">“<span class="quote">yes</span>”</span> and <span class="quote">“<span class="quote">no</span>”</span>
|
||
preselected respectively.
|
||
</p></dd><dt><span class="term">sort order</span></dt><dd><p>
|
||
A specialized string allowing only particular words as values depending
|
||
on the variable.
|
||
</p></dd><dt><span class="term">regular expression</span></dt><dd><p>
|
||
A regular expression, see <a class="xref" href="advancedusage.html#regexp" title="2. Regular Expressions">Section 2, “Regular Expressions”</a> for an introduction.
|
||
</p></dd><dt><span class="term">folder magic</span></dt><dd><p>
|
||
Specifies the type of folder to use: <span class="emphasis"><em>mbox</em></span>,
|
||
<span class="emphasis"><em>mmdf</em></span>, <span class="emphasis"><em>mh</em></span> or
|
||
<span class="emphasis"><em>maildir</em></span>. Currently only used to determine the type
|
||
for newly created folders.
|
||
</p></dd><dt><span class="term">e-mail address</span></dt><dd><p>
|
||
An e-mail address either with or without realname. The older
|
||
<span class="quote">“<span class="quote"><code class="literal">user@example.org (Joe User)</code></span>”</span> form is
|
||
supported but strongly deprecated.
|
||
</p></dd><dt><span class="term">user-defined</span></dt><dd><p>
|
||
Arbitrary text, see <a class="xref" href="configuration.html#set-myvar" title="29.3. User-Defined Variables">Section 29.3, “User-Defined Variables”</a> for details.
|
||
</p></dd></dl></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="set-commands"></a>29.2. Commands</h3></div></div></div><p>
|
||
The following commands are available to manipulate and query variables:
|
||
</p><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">set</code> {
|
||
[ <code class="option">no</code> | <code class="option">inv</code> ]
|
||
<em class="replaceable"><code>variable</code></em>
|
||
|
|
||
<em class="replaceable"><code>variable=value</code></em>
|
||
} [...]<br /><code class="command">toggle</code>
|
||
<em class="replaceable"><code>variable</code></em>
|
||
[
|
||
<em class="replaceable"><code>variable</code></em>
|
||
...]<br /><code class="command">unset</code>
|
||
<em class="replaceable"><code>variable</code></em>
|
||
[
|
||
<em class="replaceable"><code>variable</code></em>
|
||
...]<br /><code class="command">reset</code>
|
||
<em class="replaceable"><code>variable</code></em>
|
||
[
|
||
<em class="replaceable"><code>variable</code></em>
|
||
...]</p></div><p>
|
||
This command is used to set (and unset) <a class="link" href="reference.html#variables" title="3. Configuration Variables">configuration variables</a>. There are four
|
||
basic types of variables: boolean, number, string and quadoption.
|
||
<span class="emphasis"><em>boolean</em></span> variables can be <span class="emphasis"><em>set</em></span>
|
||
(true) or <span class="emphasis"><em>unset</em></span> (false).
|
||
<span class="emphasis"><em>number</em></span> variables can be assigned a positive integer
|
||
value. <span class="emphasis"><em>string</em></span> variables consist of any number of
|
||
printable characters and must be enclosed in quotes if they contain
|
||
spaces or tabs. You may also use the escape sequences <span class="quote">“<span class="quote">\n</span>”</span>
|
||
and <span class="quote">“<span class="quote">\t</span>”</span> for newline and tab, respectively.
|
||
<span class="emphasis"><em>quadoption</em></span> variables are used to control whether or
|
||
not to be prompted for certain actions, or to specify a default action.
|
||
A value of <span class="emphasis"><em>yes</em></span> will cause the action to be carried
|
||
out automatically as if you had answered yes to the question.
|
||
Similarly, a value of <span class="emphasis"><em>no</em></span> will cause the action to
|
||
be carried out as if you had answered <span class="quote">“<span class="quote">no.</span>”</span> A value of
|
||
<span class="emphasis"><em>ask-yes</em></span> will cause a prompt with a default answer
|
||
of <span class="quote">“<span class="quote">yes</span>”</span> and <span class="emphasis"><em>ask-no</em></span> will provide a
|
||
default answer of <span class="quote">“<span class="quote">no.</span>”</span>
|
||
</p><p>
|
||
Prefixing a variable with <span class="quote">“<span class="quote">no</span>”</span> will unset it. Example:
|
||
<code class="literal"><span class="command"><strong>set</strong></span> noaskbcc</code>.
|
||
</p><p>
|
||
For <span class="emphasis"><em>boolean</em></span> variables, you may optionally prefix
|
||
the variable name with <code class="literal">inv</code> to toggle the value (on or
|
||
off). This is useful when writing macros. Example:
|
||
<code class="literal"><span class="command"><strong>set</strong></span> invsmart_wrap</code>.
|
||
</p><p>
|
||
The <span class="command"><strong>toggle</strong></span> command automatically prepends the
|
||
<code class="literal">inv</code> prefix to all specified variables.
|
||
</p><p>
|
||
The <span class="command"><strong>unset</strong></span> command automatically prepends the
|
||
<code class="literal">no</code> prefix to all specified variables.
|
||
</p><p>
|
||
Using the <code class="literal"><enter-command></code> function in the
|
||
<span class="emphasis"><em>index</em></span> menu, you can query the value of a variable
|
||
by prefixing the name of the variable with a question mark:
|
||
</p><pre class="screen">
|
||
set ?allow_8bit
|
||
</pre><p>
|
||
The question mark is actually only required for boolean and quadoption
|
||
variables.
|
||
</p><p>
|
||
The <span class="command"><strong>reset</strong></span> command resets all given variables to the
|
||
compile time defaults (hopefully mentioned in this manual). If you use
|
||
the command <span class="command"><strong>set</strong></span> and prefix the variable with
|
||
<span class="quote">“<span class="quote">&</span>”</span> this has the same behavior as the
|
||
<span class="command"><strong>reset</strong></span> command.
|
||
</p><p>
|
||
With the <span class="command"><strong>reset</strong></span> command there exists the special
|
||
variable <span class="quote">“<span class="quote">all</span>”</span>, which allows you to reset all variables to
|
||
their system defaults.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="set-myvar"></a>29.3. User-Defined Variables</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-intro"></a>29.3.1. Introduction</h4></div></div></div><p>
|
||
Along with the variables listed in the <a class="link" href="reference.html#variables" title="3. Configuration Variables">Configuration variables</a> section, Mutt
|
||
supports user-defined variables with names starting with
|
||
<code class="literal">my_</code> as in, for example, <code class="literal">my_cfgdir</code>.
|
||
</p><p>
|
||
The <span class="command"><strong>set</strong></span> command either creates a custom
|
||
<code class="literal">my_</code> variable or changes its value if it does exist
|
||
already. The <span class="command"><strong>unset</strong></span> and <span class="command"><strong>reset</strong></span>
|
||
commands remove the variable entirely.
|
||
</p><p>
|
||
Since user-defined variables are expanded in the same way that
|
||
environment variables are (except for the <a class="link" href="gettingstarted.html#shell-escape">shell-escape</a> command and backtick
|
||
expansion), this feature can be used to make configuration files more
|
||
readable.
|
||
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-examples"></a>29.3.2. Examples</h4></div></div></div><p>
|
||
The following example defines and uses the variable
|
||
<code class="literal">my_cfgdir</code> to abbreviate the calls of the <a class="link" href="configuration.html#source" title="30. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> command:
|
||
</p><div class="example"><a id="ex-myvar1"></a><p class="title"><strong>Example 3.17. Using user-defined variables for config file readability</strong></p><div class="example-contents"><pre class="screen">
|
||
set my_cfgdir = $HOME/mutt/config
|
||
|
||
source $my_cfgdir/hooks
|
||
source $my_cfgdir/macros
|
||
<span class="comment"># more source commands...</span>
|
||
</pre></div></div><br class="example-break" /><p>
|
||
A custom variable can also be used in macros to backup the current value
|
||
of another variable. In the following example, the value of the <a class="link" href="reference.html#delete" title="3.76. delete">$delete</a> is changed temporarily while its
|
||
original value is saved as <code class="literal">my_delete</code>. After the
|
||
macro has executed all commands, the original value of <a class="link" href="reference.html#delete" title="3.76. delete">$delete</a> is restored.
|
||
</p><div class="example"><a id="ex-myvar2"></a><p class="title"><strong>Example 3.18. Using user-defined variables for backing up other config option values</strong></p><div class="example-contents"><pre class="screen">
|
||
macro pager ,x '\
|
||
<enter-command>set my_delete=$delete<enter>\
|
||
<enter-command>set delete=yes<enter>\
|
||
...\
|
||
<enter-command>set delete=$my_delete<enter>'
|
||
</pre></div></div><br class="example-break" /><p>
|
||
Since Mutt expands such values already when parsing the configuration
|
||
file(s), the value of <code class="literal">$my_delete</code> in the
|
||
last example would be the value of <a class="link" href="reference.html#delete" title="3.76. delete">$delete</a> exactly
|
||
as it was at that point during parsing the configuration file. If
|
||
another statement would change the value for <a class="link" href="reference.html#delete" title="3.76. delete">$delete</a>
|
||
later in the same or another file, it would have no effect on
|
||
<code class="literal">$my_delete</code>. However, the expansion can
|
||
be deferred to runtime, as shown in the next example, when escaping the
|
||
dollar sign.
|
||
</p><div class="example"><a id="ex-myvar3"></a><p class="title"><strong>Example 3.19. Deferring user-defined variable expansion to runtime</strong></p><div class="example-contents"><pre class="screen">
|
||
macro pager <PageDown> "\
|
||
<enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
|
||
<next-page>\
|
||
<enter-command> set pager_stop=\$my_old_pager_stop<Enter>\
|
||
<enter-command> unset my_old_pager_stop<Enter>"
|
||
</pre></div></div><br class="example-break" /><p>
|
||
Note that there is a space between
|
||
<code class="literal"><enter-command></code> and the <span class="command"><strong>set</strong></span>
|
||
configuration command, preventing Mutt from recording the
|
||
<span class="command"><strong>macro</strong></span>'s commands into its history.
|
||
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="set-conversions"></a>29.4. Type Conversions</h3></div></div></div><p>
|
||
Variables are always assigned string values which Mutt parses into its
|
||
internal representation according to the type of the variable, for
|
||
example an integer number for numeric types. For all queries (including
|
||
$-expansion) the value is converted from its internal type back into
|
||
string. As a result, any variable can be assigned any value given that
|
||
its content is valid for the target. This also counts for custom
|
||
variables which are of type string. In case of parsing errors, Mutt will
|
||
print error messages. <a class="xref" href="configuration.html#ex-myvar4" title="Example 3.20. Type conversions using variables">Example 3.20, “Type conversions using variables”</a> demonstrates type
|
||
conversions.
|
||
</p><div class="example"><a id="ex-myvar4"></a><p class="title"><strong>Example 3.20. Type conversions using variables</strong></p><div class="example-contents"><pre class="screen">
|
||
set my_lines = "5" <span class="comment"># value is string "5"</span>
|
||
set pager_index_lines = $my_lines <span class="comment"># value is integer 5</span>
|
||
|
||
set my_sort = "date-received" <span class="comment"># value is string "date-received"</span>
|
||
set sort = "last-$my_sort" <span class="comment"># value is sort last-date-received</span>
|
||
|
||
set my_inc = $read_inc <span class="comment"># value is string "10" (default of $read_inc)</span>
|
||
set my_foo = $my_inc <span class="comment"># value is string "10"</span>
|
||
</pre></div></div><br class="example-break" /><p>
|
||
These assignments are all valid. If, however, the value of
|
||
<code class="literal">$my_lines</code> would have been
|
||
<span class="quote">“<span class="quote">five</span>”</span> (or something else that cannot be parsed into a
|
||
number), the assignment to
|
||
<code class="literal">$pager_index_lines</code> would have
|
||
produced an error message.
|
||
</p><p>
|
||
Type conversion applies to all configuration commands which take
|
||
arguments. But please note that every expanded value of a variable is
|
||
considered just a single token. A working example is:
|
||
</p><pre class="screen">
|
||
set my_pattern = "~A"
|
||
set my_number = "10"
|
||
|
||
<span class="comment"># same as: score ~A +10</span>
|
||
score $my_pattern +$my_number</pre><p>
|
||
What does <span class="emphasis"><em>not</em></span> work is:
|
||
</p><pre class="screen">
|
||
set my_mx = "+mailbox1 +mailbox2"
|
||
mailboxes $my_mx +mailbox3</pre><p>
|
||
because the value of <code class="literal">$my_mx</code> is interpreted as a
|
||
single mailbox named <span class="quote">“<span class="quote">+mailbox1 +mailbox2</span>”</span> and not two
|
||
distinct mailboxes.
|
||
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="source"></a>30. Reading Initialization Commands From Another File</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">source</code>
|
||
<em class="replaceable"><code>filename</code></em>
|
||
</p></div><p>
|
||
This command allows the inclusion of initialization commands from other
|
||
files. For example, I place all of my aliases in
|
||
<code class="literal">~/.mail_aliases</code> so that I can make my
|
||
<code class="literal">~/.muttrc</code> readable and keep my aliases private.
|
||
</p><p>
|
||
If the filename begins with a tilde (<span class="quote">“<span class="quote">~</span>”</span>), it will be
|
||
expanded to the path of your home directory.
|
||
</p><p>
|
||
If the filename ends with a vertical bar (<span class="quote">“<span class="quote">|</span>”</span>), then
|
||
<span class="emphasis"><em>filename</em></span> is considered to be an executable program
|
||
from which to read input (e.g. <code class="literal"><span class="command"><strong>source</strong></span>
|
||
~/bin/myscript|</code>).
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="unhook"></a>31. Removing Hooks</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">unhook</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>hook-type</code></em>
|
||
}</p></div><p>
|
||
This command permits you to flush hooks you have previously defined.
|
||
You can either remove all hooks by giving the <span class="quote">“<span class="quote">*</span>”</span> character
|
||
as an argument, or you can remove all hooks of a specific type by saying
|
||
something like <code class="literal"><span class="command"><strong>unhook</strong></span> send-hook</code>.
|
||
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="formatstrings"></a>32. Format Strings</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-basics"></a>32.1. Basic usage</h3></div></div></div><p>
|
||
Format strings are a general concept you'll find in several locations
|
||
through the Mutt configuration, especially in the <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a>, <a class="link" href="reference.html#pager-format" title="3.207. pager_format">$pager_format</a>, <a class="link" href="reference.html#status-format" title="3.389. status_format">$status_format</a>, and other related
|
||
variables. These can be very straightforward, and it's quite possible
|
||
you already know how to use them.
|
||
</p><p>
|
||
The most basic format string element is a percent symbol followed by
|
||
another character. For example, <code class="literal">%s</code> represents a
|
||
message's Subject: header in the <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a> variable. The
|
||
<span class="quote">“<span class="quote">expandos</span>”</span> available are documented with each format
|
||
variable, but there are general modifiers available with all formatting
|
||
expandos, too. Those are our concern here.
|
||
</p><p>
|
||
Some of the modifiers are borrowed right out of C (though you might know
|
||
them from Perl, Python, shell, or another language). These are the
|
||
<code class="literal">[-]m.n</code> modifiers, as in
|
||
<code class="literal">%-12.12s</code>. As with such programming languages, these
|
||
modifiers allow you to specify the minimum and maximum size of the
|
||
resulting string, as well as its justification. If the <span class="quote">“<span class="quote">-</span>”</span>
|
||
sign follows the percent, the string will be left-justified instead of
|
||
right-justified. If there's a number immediately following that, it's
|
||
the minimum amount of space the formatted string will occupy — if
|
||
it's naturally smaller than that, it will be padded out with spaces. If
|
||
a decimal point and another number follow, that's the maximum space
|
||
allowable — the string will not be permitted to exceed that width,
|
||
no matter its natural size. Each of these three elements is optional, so
|
||
that all these are legal format strings: <code class="literal">%-12s</code>,
|
||
<code class="literal">%4c</code>, <code class="literal">%.15F</code> and
|
||
<code class="literal">%-12.15L</code>.
|
||
</p><p>
|
||
Mutt adds some other modifiers to format strings. If you use an equals
|
||
symbol (<code class="literal">=</code>) as a numeric prefix (like the minus
|
||
above), it will force the string to be centered within its minimum space
|
||
range. For example, <code class="literal">%=14y</code> will reserve 14 characters
|
||
for the %y expansion — that's the X-Label: header, in <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a>. If the expansion results in
|
||
a string less than 14 characters, it will be centered in a 14-character
|
||
space. If the X-Label for a message were <span class="quote">“<span class="quote">test</span>”</span>, that
|
||
expansion would look like
|
||
<span class="quote">“<span class="quote"> test </span>”</span>.
|
||
</p><p>
|
||
There are two very little-known modifiers that affect the way that an
|
||
expando is replaced. If there is an underline (<span class="quote">“<span class="quote">_</span>”</span>)
|
||
character between any format modifiers (as above) and the expando
|
||
letter, it will expands in all lower case. And if you use a colon
|
||
(<span class="quote">“<span class="quote">:</span>”</span>), it will replace all decimal points with underlines.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-conditionals"></a>32.2. Conditionals</h3></div></div></div><p>
|
||
Depending on the format string variable, some of its sequences can be
|
||
used to optionally print a string if their value is nonzero. For
|
||
example, you may only want to see the number of flagged messages if such
|
||
messages exist, since zero is not particularly meaningful. To optionally
|
||
print a string based upon one of the above sequences, the following
|
||
construct is used:
|
||
</p><pre class="screen">
|
||
%?<sequence_char>?<optional_string>?</pre><p>
|
||
where <span class="emphasis"><em>sequence_char</em></span> is an expando, and
|
||
<span class="emphasis"><em>optional_string</em></span> is the string you would like
|
||
printed if <span class="emphasis"><em>sequence_char</em></span> is nonzero.
|
||
<span class="emphasis"><em>optional_string</em></span> may contain other sequences as well
|
||
as normal text, but you may not nest optional strings.
|
||
</p><p>
|
||
Here is an example illustrating how to optionally print the number of
|
||
new messages in a mailbox in <a class="link" href="reference.html#status-format" title="3.389. status_format">$status_format</a>:
|
||
</p><pre class="screen">
|
||
%?n?%n new messages.?</pre><p>
|
||
You can also switch between two strings using the following construct:
|
||
</p><pre class="screen">
|
||
%?<sequence_char>?<if_string>&<else_string>?</pre><p>
|
||
If the value of <span class="emphasis"><em>sequence_char</em></span> is non-zero,
|
||
<span class="emphasis"><em>if_string</em></span> will be expanded, otherwise
|
||
<span class="emphasis"><em>else_string</em></span> will be expanded.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-filters"></a>32.3. Filters</h3></div></div></div><p>
|
||
Any format string ending in a vertical bar (<span class="quote">“<span class="quote">|</span>”</span>) will be
|
||
expanded and piped through the first word in the string, using spaces as
|
||
separator. The string returned will be used for display. If the
|
||
returned string ends in %, it will be passed through the formatter a
|
||
second time. This allows the filter to generate a replacement format
|
||
string including % expandos.
|
||
</p><p>
|
||
All % expandos in a format string are expanded before the script is
|
||
called so that:
|
||
</p><div class="example"><a id="ex-fmtpipe"></a><p class="title"><strong>Example 3.21. Using external filters in format strings</strong></p><div class="example-contents"><pre class="screen">
|
||
set status_format="script.sh '%r %f (%L)'|"
|
||
</pre></div></div><br class="example-break" /><p>
|
||
will make Mutt expand <code class="literal">%r</code>, <code class="literal">%f</code> and
|
||
<code class="literal">%L</code> before calling the script. The example also shows
|
||
that arguments can be quoted: the script will receive the expanded
|
||
string between the single quotes as the only argument.
|
||
</p><p>
|
||
A practical example is the <code class="literal">mutt_xtitle</code> script
|
||
installed in the <code class="literal">samples</code> subdirectory of the Mutt
|
||
documentation: it can be used as filter for <a class="link" href="reference.html#status-format" title="3.389. status_format">$status_format</a> to set the current
|
||
terminal's title, if supported.
|
||
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-padding"></a>32.4. Padding</h3></div></div></div><p>
|
||
In most format strings, Mutt supports different types of padding using
|
||
special %-expandos:
|
||
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">%|X</code></span></dt><dd><p>
|
||
When this occurs, Mutt will fill the rest of the line with the character
|
||
<code class="literal">X</code>. For example, filling the rest of the line with
|
||
dashes is done by setting:
|
||
</p><pre class="screen">
|
||
set status_format = "%v on %h: %B: %?n?%n&no? new messages %|-"</pre></dd><dt><span class="term">
|
||
<code class="literal">%>X</code>
|
||
</span></dt><dd><p>
|
||
Since the previous expando stops at the end of line, there must be a way
|
||
to fill the gap between two items via the <code class="literal">%>X</code>
|
||
expando: it puts as many characters <code class="literal">X</code> in between two
|
||
items so that the rest of the line will be right-justified. For example,
|
||
to not put the version string and hostname the above example on the left
|
||
but on the right and fill the gap with spaces, one might use (note the
|
||
space after <code class="literal">%></code>):
|
||
</p><pre class="screen">
|
||
set status_format = "%B: %?n?%n&no? new messages %> (%v on %h)"</pre></dd><dt><span class="term"><code class="literal">%*X</code>
|
||
</span></dt><dd><p>
|
||
Normal right-justification will print everything to the left of the
|
||
<code class="literal">%></code>, displaying padding and whatever lies to the
|
||
right only if there's room. By contrast, <span class="quote">“<span class="quote">soft-fill</span>”</span> gives
|
||
priority to the right-hand side, guaranteeing space to display it and
|
||
showing padding only if there's still room. If necessary, soft-fill will
|
||
eat text leftwards to make room for rightward text. For example, to
|
||
right-justify the subject making sure as much as possible of it fits on
|
||
screen, one might use (note two spaces after <code class="literal">%* </code>: the
|
||
second ensures there's a space between the truncated right-hand side and
|
||
the subject):
|
||
</p><pre class="screen">
|
||
set index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?)%* %s"</pre></dd></dl></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-size"></a>32.5. Bytes size display</h3></div></div></div><p>
|
||
Various format strings contain expandos that display the size of
|
||
messages in bytes. This includes
|
||
<code class="literal">%s</code> in <a class="link" href="reference.html#attach-format" title="3.15. attach_format">$attach_format</a>,
|
||
<code class="literal">%l</code> in <a class="link" href="reference.html#compose-format" title="3.46. compose_format">$compose_format</a>,
|
||
<code class="literal">%s</code> in <a class="link" href="reference.html#folder-format" title="3.98. folder_format">$folder_format</a>,
|
||
<code class="literal">%c</code> in <a class="link" href="reference.html#index-format" title="3.161. index_format">$index_format</a>,
|
||
and %l and %L in <a class="link" href="reference.html#status-format" title="3.389. status_format">$status_format</a>.
|
||
There are four configuration variables that can be used to customize
|
||
how the numbers are displayed.
|
||
</p><p>
|
||
<a class="link" href="reference.html#size-show-bytes" title="3.325. size_show_bytes">$size_show_bytes</a>
|
||
will display the number of bytes when the size is < 1
|
||
kilobyte. When unset, kilobytes will be displayed instead.
|
||
</p><p>
|
||
<a class="link" href="reference.html#size-show-mb" title="3.327. size_show_mb">$size_show_mb</a> will display the
|
||
number of megabytes when the size is >= 1 megabyte. When
|
||
unset, kilobytes will be displayed instead (which could be a large
|
||
number).
|
||
</p><p>
|
||
<a class="link" href="reference.html#size-show-fractions" title="3.326. size_show_fractions">$size_show_fractions</a>,
|
||
will display numbers with a single decimal place for values from
|
||
0 to 10 kilobytes, and 1 to 10 megabytes.
|
||
</p><p>
|
||
<a class="link" href="reference.html#size-units-on-left" title="3.328. size_units_on_left">$size_units_on_left</a> will
|
||
display the unit (<span class="quote">“<span class="quote">K</span>”</span> or <span class="quote">“<span class="quote">M</span>”</span>) to the left
|
||
of the number, instead of the right if unset.
|
||
</p><p>
|
||
These variables also affect size display in a few other places, such
|
||
as progress indicators and attachment delimiters in the pager.
|
||
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailto-allow"></a>33. Control allowed header fields in a mailto: URL</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mailto_allow</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>header-field</code></em>
|
||
... }<br /><code class="command">unmailto_allow</code> {
|
||
<em class="replaceable"><code>*</code></em>
|
||
|
|
||
<em class="replaceable"><code>header-field</code></em>
|
||
... }</p></div><p>
|
||
As a security measure, Mutt will only add user-approved header fields from a
|
||
<code class="literal">mailto:</code> URL. This is necessary since Mutt will handle
|
||
certain header fields, such as <code class="literal">Attach:</code>, in a special way.
|
||
The <code class="literal">mailto_allow</code> and <code class="literal">unmailto_allow</code>
|
||
commands allow the user to modify the list of approved headers.
|
||
</p><p>
|
||
Mutt initializes the default list to contain the
|
||
<code class="literal">Subject</code> and <code class="literal">Body</code> header fields,
|
||
which are the only requirement specified by the
|
||
<code class="literal">mailto:</code> specification in RFC2368, along with
|
||
<code class="literal">Cc</code>, <code class="literal">In-Reply-To</code>, and
|
||
<code class="literal">References</code>, to support mailing list URLs.
|
||
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Getting Started </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Advanced Usage</td></tr></table></div></body></html> |