1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <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 V1.74.3" /><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">
4 body { margin-left:2%; margin-right:2%; font-family:serif; }
5 .toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
6 h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
7 p { text-align:justify; }
8 div.table p.title, div.example p.title { font-size:smaller; font-family:sans-serif; }
9 .email, .email a { font-family:monospace; }
10 div.table-contents table, div.informaltable table { border-collapse:collapse; border:1px solid #c0c0c0; }
11 div.table-contents table td, div.informaltable td, div.table-contents table th, div.informaltable table th { padding:5px; text-align:left; }
12 div.table-contents table th, div.informaltable table th {
13 font-family:sans-serif;
18 div.cmdsynopsis { border-left:1px solid #707070; padding-left:5px; }
19 li div.cmdsynopsis { border-left:none; padding-left:0px; }
20 pre.screen, div.note { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; margin-left:2%; margin-right:2%; }
21 div.example p.title { margin-left:2%; }
22 div.note h3 { font-size:small; font-style:italic; font-variant: small-caps; }
23 div.note h3:after { content: ":" }
24 div.note { margin-bottom: 5px; }
25 strong.command { font-family: monospace; font-weight: normal; }
26 tr { vertical-align: top; }
28 </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" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="configuration"></a>Chapter 3. Configuration</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><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#muttrc-syntax">2. Syntax of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#addrgroup">3. Address Groups</a></span></dt><dt><span class="sect1"><a href="configuration.html#alias">4. Defining/Using Aliases</a></span></dt><dt><span class="sect1"><a href="configuration.html#bind">5. Changing the Default Key Bindings</a></span></dt><dt><span class="sect1"><a href="configuration.html#charset-hook">6. Defining Aliases for Character Sets</a></span></dt><dt><span class="sect1"><a href="configuration.html#folder-hook">7. Setting Variables Based Upon Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#macro">8. Keyboard Macros</a></span></dt><dt><span class="sect1"><a href="configuration.html#color">9. Using Color and Mono Video Attributes</a></span></dt><dt><span class="sect1"><a href="configuration.html#msg-hdr-display">10. Message Header Display</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#ignore">10.1. Selecting Headers</a></span></dt><dt><span class="sect2"><a href="configuration.html#hdr-order">10.2. Ordering Displayed Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#alternates">11. Alternative Addresses</a></span></dt><dt><span class="sect1"><a href="configuration.html#lists">12. Mailing Lists</a></span></dt><dt><span class="sect1"><a href="configuration.html#mbox-hook">13. Using Multiple Spool Mailboxes</a></span></dt><dt><span class="sect1"><a href="configuration.html#mailboxes">14. Monitoring Incoming Mail</a></span></dt><dt><span class="sect1"><a href="configuration.html#my-hdr">15. User-Defined Headers</a></span></dt><dt><span class="sect1"><a href="configuration.html#save-hook">16. Specify Default Save Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-hook">17. Specify Default Fcc: Mailbox When Composing</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-save-hook">18. Specify Default Save Filename and Default Fcc: Mailbox at Once</a></span></dt><dt><span class="sect1"><a href="configuration.html#send-hook">19. Change Settings Based Upon Message Recipients</a></span></dt><dt><span class="sect1"><a href="configuration.html#message-hook">20. Change Settings Before Formatting a Message</a></span></dt><dt><span class="sect1"><a href="configuration.html#crypt-hook">21. Choosing the Cryptographic Key of the Recipient</a></span></dt><dt><span class="sect1"><a href="configuration.html#push">22. Adding Key Sequences to the Keyboard Buffer</a></span></dt><dt><span class="sect1"><a href="configuration.html#exec">23. Executing Functions</a></span></dt><dt><span class="sect1"><a href="configuration.html#score-command">24. Message Scoring</a></span></dt><dt><span class="sect1"><a href="configuration.html#spam">25. Spam Detection</a></span></dt><dt><span class="sect1"><a href="configuration.html#set">26. Setting and Querying Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#var-types">26.1. Variable Types</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-commands">26.2. Commands</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-myvar">26.3. User-Defined Variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#source">27. Reading Initialization Commands From Another File</a></span></dt><dt><span class="sect1"><a href="configuration.html#unhook">28. Removing Hooks</a></span></dt><dt><span class="sect1"><a href="configuration.html#formatstrings">29. Format Strings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#formatstrings-basics">29.1. Basic usage</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-conditionals">29.2. Conditionals</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-filters">29.3. Filters</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-padding">29.4. Padding</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><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>
29 While the default configuration (or “<span class="quote">preferences</span>”) make Mutt
30 usable right out of the box, it is often desirable to tailor Mutt to
31 suit your own tastes. When Mutt is first invoked, it will attempt to
32 read the “<span class="quote">system</span>” configuration file (defaults set by your local
33 system administrator), unless the “<span class="quote">-n</span>” <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> option is specified. This file is typically
34 <code class="literal">/usr/local/share/mutt/Muttrc</code> or <code class="literal">/etc/Muttrc</code>. Mutt
35 will next look for a file named <code class="literal">.muttrc</code> in your home
36 directory. If this file does not exist and your home directory has
37 a subdirectory named <code class="literal">.mutt</code>, Mutt tries to load a file named
38 <code class="literal">.mutt/muttrc</code>.
40 <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.
42 In addition, Mutt supports version specific configuration files that are
43 parsed instead of the default files as explained above. For instance, if
44 your system has a <code class="literal">Muttrc-0.88</code> file in the system configuration
45 directory, and you are running version 0.88 of Mutt, this file will be
46 sourced instead of the <code class="literal">Muttrc</code> file. The same is true of the user
47 configuration file, if you have a file <code class="literal">.muttrc-0.88.6</code> in your home
48 directory, when you run Mutt version 0.88.6, it will source this file
49 instead of the default <code class="literal">.muttrc</code> file. The version number is the
50 same which is visible using the “<span class="quote">-v</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:
51 V) from the index menu.
52 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="muttrc-syntax"></a>2. Syntax of Initialization Files</h2></div></div></div><p>
53 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.
54 When multiple commands are used, they must be separated by a semicolon
55 (“<span class="quote">;</span>”).
56 </p><div class="example"><a id="ex-rc-multiple-cmds"></a><p class="title"><b>Example 3.1. Multiple configuration commands per line</b></p><div class="example-contents"><pre class="screen">
57 set realname='Mutt user' ; ignore x-
58 </pre></div></div><br class="example-break" /><p>
59 The hash mark, or pound sign
60 (“<span class="quote">#</span>”), is used as a “<span class="quote">comment</span>” character. You can use it to
61 annotate your initialization file. All text after the comment character
62 to the end of the line is ignored.
63 </p><div class="example"><a id="ex-ec-comment"></a><p class="title"><b>Example 3.2. Commenting configuration files</b></p><div class="example-contents"><pre class="screen">
64 my_hdr X-Disclaimer: Why are you listening to me? # This is a comment
65 </pre></div></div><br class="example-break" /><p>
66 Single quotes (“<span class="quote">'</span>”) and double quotes (“<span class="quote">"</span>”) can be used to quote strings
67 which contain spaces or other special characters. The difference between
68 the two types of quotes is similar to that of many popular shell programs,
69 namely that a single quote is used to specify a literal string (one that is
70 not interpreted for shell variables or quoting with a backslash [see
71 next paragraph]), while double quotes indicate a string for which
72 should be evaluated. For example, backticks are evaluated inside of double
73 quotes, but <span class="emphasis"><em>not</em></span> for single quotes.
75 “<span class="quote">\</span>” quotes the next character, just as in shells such as bash and zsh.
76 For example, if want to put quotes “<span class="quote">"</span>” inside of a string, you can use
77 “<span class="quote">\</span>” to force the next character to be a literal instead of interpreted
79 </p><div class="example"><a id="ex-rc-quote"></a><p class="title"><b>Example 3.3. Escaping quotes in congfiguration files</b></p><div class="example-contents"><pre class="screen">
80 set realname="Michael \"MuttDude\" Elkins"
81 </pre></div></div><br class="example-break" /><p>
82 “<span class="quote">\\</span>” means to insert a literal “<span class="quote">\</span>” into the line.
83 “<span class="quote">\n</span>” and “<span class="quote">\r</span>” have their usual C meanings of linefeed and
84 carriage-return, respectively.
86 A “<span class="quote">\</span>” at the end of a line can be used to split commands over
87 multiple lines as it “<span class="quote">escapes</span>” the line end, provided that the split points don't appear in the
88 middle of command names. Lines are first concatenated before
89 interpretation so that a multi-line can be commented by commenting out
91 </p><div class="example"><a id="ex-rc-split"></a><p class="title"><b>Example 3.4. Splitting long configuration commands over several lines</b></p><div class="example-contents"><pre class="screen">
92 set status_format="some very \
95 </pre></div></div><br class="example-break" /><p>
96 It is also possible to substitute the output of a Unix command in an
97 initialization file. This is accomplished by enclosing the command in
98 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
99 Unix command “<span class="quote">uname -a</span>” will be substituted before the
101 Since initialization files are line oriented, only
102 the first line of output from the Unix command will be substituted.
103 </p><div class="example"><a id="ex-rc-backtick"></a><p class="title"><b>Example 3.5. Using external command's output in configuration files</b></p><div class="example-contents"><pre class="screen">
104 my_hdr X-Operating-System: `uname -a`
105 </pre></div></div><br class="example-break" /><p>
106 Both environment variables and Mutt variables can be accessed by
107 prepending “<span class="quote">$</span>” to the name of the variable. For example,
108 </p><div class="example"><a id="ex-rc-env"></a><p class="title"><b>Example 3.6. Using environment variables in configuration files</b></p><div class="example-contents"><pre class="screen">
109 set record=+sent_on_$HOSTNAME
110 </pre></div></div><br class="example-break" /><p>
111 will cause Mutt to save outgoing messages to a folder named
112 “<span class="quote">sent_on_kremvax</span>” if the environment variable <code class="literal">$HOSTNAME</code> is set to
113 “<span class="quote">kremvax.</span>” (See <a class="link" href="reference.html#record" title="3.211. record">$record</a> for
116 Mutt expands the variable when it is assigned, not when it is used. If
117 the value of a variable on the right-hand side of an assignment
118 changes after the assignment, the variable on the left-hand side will
121 The commands understood by Mutt are explained in the next paragraphs.
122 For a complete list, see the <a class="link" href="reference.html#commands" title="2. Configuration Commands">command reference</a>.
124 All configuration files are expected to be in the current locale as
125 specified by the <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a> variable
126 which doesn't have a default value since it's determined by Mutt at startup.
127 If a configuration file is not encoded in the same character set the
128 <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a>
129 variable should be used: all lines starting with the next are recoded
130 from <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a>
131 to <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a>.
133 This mechanism should be avoided if possible as it has the
134 following implications:
135 </p><div class="itemizedlist"><ul type="disc"><li><p>These variables should be set early in a configuration
136 file with <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a> preceding
137 <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a> so Mutt
138 knows what character set to convert to.</p></li><li><p>If <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a> is set, it should be set
139 in each configuration file because the value is global and <span class="emphasis"><em>not</em></span>
140 per configuration file.</p></li><li><p>Because Mutt first recodes a line before it attempts to parse it,
141 a conversion introducing question marks or other characters as
142 part of errors (unconvertable characters, transliteration) may introduce syntax
143 errors or silently change the meaning of certain tokens (e.g. inserting
144 question marks into regular expressions).</p></li></ul></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="addrgroup"></a>3. Address Groups</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">group</code> [
145 <code class="option">-group</code>
146 <em class="replaceable"><code>name</code></em>
148 <code class="option">-rx</code>
149 <em class="replaceable"><code>expr</code></em>
151 <code class="option">-addr</code>
152 <em class="replaceable"><code>expr</code></em>
153 ... }<br /><code class="command">ungroup</code> [
154 <code class="option">-group</code>
155 <em class="replaceable"><code>name</code></em>
157 <em class="replaceable"><code>*</code></em>
159 <code class="option">-rx</code>
160 <em class="replaceable"><code>expr</code></em>
162 <code class="option">-addr</code>
163 <em class="replaceable"><code>expr</code></em>
165 <span class="command"><strong>group</strong></span> is used to directly add either addresses or
166 regular expressions to the specified group or groups. The different
167 categories of arguments to the <span class="command"><strong>group</strong></span> command can be
168 in any order. The flags <code class="literal">-rx</code> and
169 <code class="literal">-addr</code> specify what the following strings (that cannot
170 begin with a hyphen) should be interpreted as: either a regular
171 expression or an email address, respectively.
173 These address groups can also be created implicitly by the
174 <a class="link" href="configuration.html#alias" title="4. Defining/Using Aliases"><span class="command"><strong>alias</strong></span></a>, <a class="link" href="configuration.html#lists" title="12. Mailing Lists">lists</a>,
175 <a class="link" href="configuration.html#lists" title="12. Mailing Lists">subscribe</a> and
176 <a class="link" href="configuration.html#alternates" title="11. Alternative Addresses"><span class="command"><strong>alternates</strong></span></a> commands by specifying the
177 optional <code class="literal">-group</code> option.
179 Once defined, these address groups can be used in
180 <a class="link" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">patterns</a> to search for and limit the
181 display to messages matching a group.
183 <span class="command"><strong>ungroup</strong></span> is used to remove addresses or regular
184 expressions from the specified group or groups. The syntax is similar to
185 the <span class="command"><strong>group</strong></span> command, however the special character
186 <code class="literal">*</code> can be used to empty a group of all of its
188 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alias"></a>4. Defining/Using Aliases</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alias</code> [
189 <code class="option">-group</code>
190 <em class="replaceable"><code>name</code></em>
192 <em class="replaceable"><code>key</code></em>
194 <em class="replaceable"><code>address</code></em>
196 <em class="replaceable"><code>address</code></em>
197 ...]<br /><code class="command">unalias</code> [
198 <code class="option">-group</code>
199 <em class="replaceable"><code>name</code></em>
201 <em class="replaceable"><code>*</code></em>
203 <em class="replaceable"><code>key</code></em>
205 It's usually very cumbersome to remember or type out the address of someone
206 you are communicating with. Mutt allows you to create “<span class="quote">aliases</span>” which map
207 a short string to a full address.
208 </p><div class="note"><h3 class="title">Note</h3><p>
209 If you want to create an alias for more than
210 one address, you <span class="emphasis"><em>must</em></span> separate the addresses with a comma (“<span class="quote">,</span>”).
212 The optional <code class="literal">-group</code> argument to
213 <span class="command"><strong>alias</strong></span> causes the aliased address(es) to be added to
214 the named <span class="emphasis"><em>group</em></span>.
216 To remove an alias or aliases (“<span class="quote">*</span>” means all aliases):
217 </p><pre class="screen">
218 alias muttdude me@cs.hmc.edu (Michael Elkins)
219 alias theguys manny, moe, jack
221 Unlike other mailers, Mutt doesn't require aliases to be defined
222 in a special file. The <span class="command"><strong>alias</strong></span> command can appear anywhere in
223 a configuration file, as long as this file is <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span>d</a>. Consequently, you can have multiple alias files, or
224 you can have all aliases defined in your <code class="literal">.muttrc</code>.
226 On the other hand, the <a class="link" href="gettingstarted.html#create-alias"><code class="literal"><create-alias></code></a>
227 function can use only one file, the one pointed to by the <a class="link" href="reference.html#alias-file" title="3.3. alias_file">$alias_file</a> variable (which is
228 <code class="literal">˜/.muttrc</code> by default). This file is not special either,
229 in the sense that Mutt will happily append aliases to any file, but in
230 order for the new aliases to take effect you need to explicitly <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> this file too.
231 </p><div class="example"><a id="ex-alias-external"></a><p class="title"><b>Example 3.7. Configuring external alias files</b></p><div class="example-contents"><pre class="screen">
232 source /usr/local/share/Mutt.aliases
233 source ~/.mail_aliases
234 set alias_file=~/.mail_aliases
235 </pre></div></div><br class="example-break" /><p>
236 To use aliases, you merely use the alias at any place in Mutt where Mutt
237 prompts for addresses, such as the <span class="emphasis"><em>To:</em></span> or <span class="emphasis"><em>Cc:</em></span> prompt. You can
238 also enter aliases in your editor at the appropriate headers if you have the
239 <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> variable set.
241 In addition, at the various address prompts, you can use the tab character
242 to expand a partial alias to the full alias. If there are multiple matches,
243 Mutt will bring up a menu with the matching aliases. In order to be
244 presented with the full list of aliases, you must hit tab without a partial
245 alias, such as at the beginning of the prompt or after a comma denoting
248 In the alias menu, you can select as many aliases as you want with the
249 <code class="literal">select-entry</code> key (default: <Return>), and use the
250 <span class="emphasis"><em>exit</em></span> key (default: q) to return to the address prompt.
251 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bind"></a>5. Changing the Default Key Bindings</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">bind</code>
252 <em class="replaceable"><code>map</code></em>
254 <em class="replaceable"><code>key</code></em>
256 <em class="replaceable"><code>function</code></em>
258 This command allows you to change the default key bindings (operation
259 invoked when pressing a key).
261 <span class="emphasis"><em>map</em></span> specifies in which menu the binding belongs. Multiple maps may
262 be specified by separating them with commas (no additional whitespace is
263 allowed). The currently defined maps are:
264 </p><a id="maps"></a><div class="variablelist"><dl><dt><span class="term">generic</span></dt><dd><p>
265 This is not a real menu, but is used as a fallback for all of the other
266 menus except for the pager and editor modes. If a key is not defined in
267 another menu, Mutt will look for a binding to use in this menu. This allows
268 you to bind a key to a certain function in multiple menus instead of having
269 multiple <span class="command"><strong>bind</strong></span> statements to accomplish the same task.
270 </p></dd><dt><span class="term">alias</span></dt><dd><p>
271 The alias menu is the list of your personal aliases as defined in your
272 <code class="literal">.muttrc</code>. It is the mapping from a short alias name to the full email
273 address(es) of the recipient(s).
274 </p></dd><dt><span class="term">attach</span></dt><dd><p>
275 The attachment menu is used to access the attachments on received messages.
276 </p></dd><dt><span class="term">browser</span></dt><dd><p>
277 The browser is used for both browsing the local directory structure, and for
278 listing all of your incoming mailboxes.
279 </p></dd><dt><span class="term">editor</span></dt><dd><p>
280 The editor is the line-based editor the user enters text data.
281 </p></dd><dt><span class="term">index</span></dt><dd><p>
282 The index is the list of messages contained in a mailbox.
283 </p></dd><dt><span class="term">compose</span></dt><dd><p>
284 The compose menu is the screen used when sending a new message.
285 </p></dd><dt><span class="term">pager</span></dt><dd><p>
286 The pager is the mode used to display message/attachment data, and help
288 </p></dd><dt><span class="term">pgp</span></dt><dd><p>
289 The pgp menu is used to select the OpenPGP keys used to encrypt outgoing
291 </p></dd><dt><span class="term">smime</span></dt><dd><p>
292 The smime menu is used to select the OpenSSL certificates used to encrypt outgoing
294 </p></dd><dt><span class="term">postpone</span></dt><dd><p>
295 The postpone menu is similar to the index menu, except is used when
296 recalling a message the user was composing, but saved until later.
297 </p></dd><dt><span class="term">query</span></dt><dd><p>
298 The query menu is the browser for results returned by
299 <a class="link" href="reference.html#query-command" title="3.203. query_command">$query_command</a>.
300 </p></dd><dt><span class="term">mix</span></dt><dd><p>
301 The mixmaster screen is used to select remailer options for outgoing
302 messages (if Mutt is compiled with Mixmaster support).
303 </p></dd></dl></div><p>
304 <span class="emphasis"><em>key</em></span> is the key (or key sequence) you wish to bind. To specify a
305 control character, use the sequence <span class="emphasis"><em>\Cx</em></span>, where <span class="emphasis"><em>x</em></span> is the
306 letter of the control character (for example, to specify control-A use
307 “<span class="quote">\Ca</span>”). Note that the case of <span class="emphasis"><em>x</em></span> as well as <span class="emphasis"><em>\C</em></span> is
308 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
309 equivalent. An alternative form is to specify the key as a three digit
310 octal number prefixed with a “<span class="quote">\</span>” (for example <span class="emphasis"><em>\177</em></span> is
311 equivalent to <span class="emphasis"><em>\c?</em></span>). In addition, <span class="emphasis"><em>key</em></span> may
312 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>.
313 </p><div class="table"><a id="tab-key-names"></a><p class="title"><b>Table 3.1. Symbolic key names</b></p><div class="table-contents"><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><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>
314 <span class="emphasis"><em>key</em></span> does not need to be enclosed in quotes unless it contains a
315 space (“<span class="quote"> </span>”) or semi-colon (“<span class="quote">;</span>”).
317 <span class="emphasis"><em>function</em></span> specifies which action to take when <span class="emphasis"><em>key</em></span> is pressed.
318 For a complete list of functions, see the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>. The special function <code class="literal"><noop></code> unbinds the specified key
320 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="charset-hook"></a>6. Defining Aliases for Character Sets</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">charset-hook</code>
321 <em class="replaceable"><code>alias</code></em>
323 <em class="replaceable"><code>charset</code></em>
324 <br /><code class="command">iconv-hook<a id="iconv-hook"></a></code>
325 <em class="replaceable"><code>charset</code></em>
327 <em class="replaceable"><code>local-charset</code></em>
329 The <span class="command"><strong>charset-hook</strong></span> command defines an alias for a character set.
330 This is useful to properly display messages which are tagged with a
331 character set name not known to Mutt.
333 The <span class="command"><strong>iconv-hook</strong></span> command defines a system-specific name for a
334 character set. This is helpful when your systems character
335 conversion library insists on using strange, system-specific names
337 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="folder-hook"></a>7. Setting Variables Based Upon Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">folder-hook</code>
338 <em class="replaceable"><code>[!]regexp</code></em>
340 <em class="replaceable"><code>command</code></em>
342 It is often desirable to change settings based on which mailbox you are
343 reading. The <span class="command"><strong>folder-hook</strong></span> command provides a method by which you can execute
344 any configuration command. <span class="emphasis"><em>regexp</em></span> is a regular expression specifying
345 in which mailboxes to execute <span class="emphasis"><em>command</em></span> before loading. If a mailbox
346 matches multiple <span class="command"><strong>folder-hook</strong></span>s, they are executed in the order given in the
347 <code class="literal">.muttrc</code>.
348 </p><div class="note"><h3 class="title">Note</h3><p>
349 If you use the “<span class="quote">!</span>” shortcut for <a class="link" href="reference.html#spoolfile" title="3.269. spoolfile">$spoolfile</a> at the beginning of the pattern, you must place it
350 inside of double or single quotes in order to distinguish it from the
351 logical <span class="emphasis"><em>not</em></span> operator for the expression.
352 </p></div><div class="note"><h3 class="title">Note</h3><p>
353 Settings are <span class="emphasis"><em>not</em></span> restored when you leave the mailbox.
354 For example, a command action to perform is to change the sorting method
355 based upon the mailbox being read:
357 </p><pre class="screen">
358 folder-hook mutt "set sort=threads"</pre><p>
360 However, the sorting method is not restored to its previous value when
361 reading a different mailbox. To specify a <span class="emphasis"><em>default</em></span> command, use the
362 pattern “<span class="quote">.</span>” before other <span class="command"><strong>folder-hook</strong></span>s adjusting a value on a per-folder basis
363 because <span class="command"><strong>folder-hook</strong></span>s are evaluated in the order given in the
366 The following example will set the <a class="link" href="reference.html#sort" title="3.263. sort">sort</a> variable
367 to <code class="literal">date-sent</code> for all folders but to <code class="literal">threads</code>
368 for all folders containing “<span class="quote">mutt</span>” in their name.
369 </p><div class="example"><a id="ex-folder-sorting"></a><p class="title"><b>Example 3.8. Setting sort method based on mailbox name</b></p><div class="example-contents"><pre class="screen">
370 folder-hook . "set sort=date-sent"
371 folder-hook mutt "set sort=threads"
372 </pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macro"></a>8. Keyboard Macros</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">macro</code>
373 <em class="replaceable"><code>menu</code></em>
375 <em class="replaceable"><code>key</code></em>
377 <em class="replaceable"><code>sequence</code></em>
379 <em class="replaceable"><code>description</code></em>
381 Macros are useful when you would like a single key to perform a series of
382 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
383 you had typed <span class="emphasis"><em>sequence</em></span>. So if you have a common sequence of commands
384 you type, you can create a macro to execute those commands with a single
387 <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.
388 Multiple maps may be specified by separating multiple menu arguments by
389 commas. Whitespace may not be used in between the menu arguments and the
390 commas separating them.
392 <span class="emphasis"><em>key</em></span> and <span class="emphasis"><em>sequence</em></span> are expanded by the same rules as the
393 <a class="link" href="configuration.html#bind" title="5. Changing the Default Key Bindings">key bindings</a> with some additions. The
394 first is that control characters in <span class="emphasis"><em>sequence</em></span> can also be specified
395 as <span class="emphasis"><em>^x</em></span>. In order to get a caret (“<span class="quote">^</span>”) you need to use
396 <span class="emphasis"><em>^^</em></span>. Secondly, to specify a certain key such as <span class="emphasis"><em>up</em></span>
397 or to invoke a function directly, you can use the format
398 <span class="emphasis"><em><key name></em></span> and <span class="emphasis"><em><function name></em></span>. For a listing of key
399 names see the section on <a class="link" href="configuration.html#bind" title="5. Changing the Default Key Bindings">key bindings</a>. Functions
400 are listed in the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>.
402 The advantage with using function names directly is that the macros will
403 work regardless of the current key bindings, so they are not dependent on
404 the user having particular key definitions. This makes them more robust
405 and portable, and also facilitates defining of macros in files used by more
406 than one user (e.g., the system Muttrc).
408 Optionally you can specify a descriptive text after <span class="emphasis"><em>sequence</em></span>,
409 which is shown in the help screens if they contain a description.
410 </p><div class="note"><h3 class="title">Note</h3><p>
411 Macro definitions (if any) listed in the help screen(s), are
412 silently truncated at the screen width, and are not wrapped.
413 </p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="color"></a>9. Using Color and Mono Video Attributes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">color</code>
414 <em class="replaceable"><code>object</code></em>
416 <em class="replaceable"><code>foreground</code></em>
418 <em class="replaceable"><code>background</code></em>
419 <br /><code class="command">color</code> {
420 <code class="option">header</code>
422 <code class="option">body</code>
424 <em class="replaceable"><code>foreground</code></em>
426 <em class="replaceable"><code>background</code></em>
428 <em class="replaceable"><code>regexp</code></em>
429 <br /><code class="command">color</code>
430 <code class="option">index</code>
432 <em class="replaceable"><code>foreground</code></em>
434 <em class="replaceable"><code>background</code></em>
436 <em class="replaceable"><code>pattern</code></em>
437 <br /><code class="command">uncolor</code> {
438 <code class="option">index</code>
440 <code class="option">header</code>
442 <code class="option">body</code>
444 <em class="replaceable"><code>*</code></em>
446 <em class="replaceable"><code>pattern</code></em>
448 If your terminal supports color, you can spice up Mutt by creating your own
449 color scheme. To define the color of an object (type of information), you
450 must specify both a foreground color <span class="emphasis"><em>and</em></span> a background color (it is not
451 possible to only specify one or the other).
453 <span class="emphasis"><em>header</em></span> and <span class="emphasis"><em>body</em></span> match <span class="emphasis"><em>regexp</em></span>
454 in the header/body of a message, <span class="emphasis"><em>index</em></span> matches <span class="emphasis"><em>pattern</em></span>
455 (see <a class="xref" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">Section 2, “Patterns: Searching, Limiting and Tagging”</a>) in the message index.
457 <span class="emphasis"><em>object</em></span> can be one of:
458 </p><div class="itemizedlist"><ul type="disc"><li><p>attachment</p></li><li><p>bold (hiliting bold patterns in the body of messages)</p></li><li><p>error (error messages printed by Mutt)</p></li><li><p>hdrdefault (default color of the message header in the pager)</p></li><li><p>indicator (arrow or bar used to indicate the current item in a menu)</p></li><li><p>markers (the “<span class="quote">+</span>” markers at the beginning of wrapped lines in the pager)</p></li><li><p>message (informational messages)</p></li><li><p>normal</p></li><li><p>quoted (text matching <a class="link" href="reference.html#quote-regexp" title="3.206. quote_regexp">$quote_regexp</a> in the body of a message)</p></li><li><p>quoted1, quoted2, ..., quoted<span class="emphasis"><em>N</em></span> (higher levels of quoting)</p></li><li><p>search (hiliting of words in the pager)</p></li><li><p>signature</p></li><li><p>status (mode lines used to display info about the mailbox or message)</p></li><li><p>tilde (the “<span class="quote">˜</span>” used to pad blank lines in the pager)</p></li><li><p>tree (thread tree drawn in the message index and attachment menu)</p></li><li><p>underline (hiliting underlined patterns in the body of messages)</p></li></ul></div><p>
459 <span class="emphasis"><em>foreground</em></span> and <span class="emphasis"><em>background</em></span> can be one of the following:
460 </p><div class="itemizedlist"><ul type="disc"><li><p>white</p></li><li><p>black</p></li><li><p>green</p></li><li><p>magenta</p></li><li><p>blue</p></li><li><p>cyan</p></li><li><p>yellow</p></li><li><p>red</p></li><li><p>default</p></li><li><p>color<span class="emphasis"><em>x</em></span></p></li></ul></div><p>
461 <span class="emphasis"><em>foreground</em></span> can optionally be prefixed with the keyword <code class="literal">bright</code> to make
462 the foreground color boldfaced (e.g., <code class="literal">brightred</code>).
464 If your terminal supports it, the special keyword <span class="emphasis"><em>default</em></span> can be
465 used as a transparent color. The value <span class="emphasis"><em>brightdefault</em></span> is also valid.
466 If Mutt is linked against the <span class="emphasis"><em>S-Lang</em></span> library, you also need to set
467 the <code class="literal">$COLORFGBG</code> environment variable to the default colors of your
468 terminal for this to work; for example (for Bourne-like shells):
469 </p><pre class="screen">
470 set COLORFGBG="green;black"
472 </pre><div class="note"><h3 class="title">Note</h3><p>
473 The <span class="emphasis"><em>S-Lang</em></span> library requires you to use the <span class="emphasis"><em>lightgray</em></span>
474 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
475 setting this variable.
476 </p></div><div class="note"><h3 class="title">Note</h3><p>
477 The <span class="command"><strong>uncolor</strong></span> command can be applied to the index, header and body objects only. It
478 removes entries from the list. You <span class="emphasis"><em>must</em></span> specify the same pattern
479 specified in the <span class="command"><strong>color</strong></span> command for it to be removed. The pattern “<span class="quote">*</span>” is
480 a special token which means to clear the color list of all entries.
482 Mutt also recognizes the keywords <span class="emphasis"><em>color0</em></span>, <span class="emphasis"><em>color1</em></span>, …,
483 <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
484 by your terminal). This is useful when you remap the colors for your
485 display (for example by changing the color associated with <span class="emphasis"><em>color2</em></span>
486 for your xterm), since color names may then lose their normal meaning.
487 </p><a id="mono"></a><p>
488 If your terminal does not support color, it is still possible change the video
489 attributes through the use of the “<span class="quote">mono</span>” command. Usage:
490 </p><div class="cmdsynopsis"><p><code class="command">mono</code>
491 <em class="replaceable"><code>object</code></em>
493 <em class="replaceable"><code>attribute</code></em>
494 <br /><code class="command">mono</code> {
495 <code class="option">header</code>
497 <code class="option">body</code>
499 <em class="replaceable"><code>attribute</code></em>
501 <em class="replaceable"><code>regexp</code></em>
502 <br /><code class="command">mono</code>
503 <code class="option">index</code>
505 <em class="replaceable"><code>attribute</code></em>
507 <em class="replaceable"><code>pattern</code></em>
508 <br /><code class="command">unmono</code> {
509 <code class="option">index</code>
511 <code class="option">header</code>
513 <code class="option">body</code>
515 <em class="replaceable"><code>*</code></em>
517 <em class="replaceable"><code>pattern</code></em>
519 For <span class="emphasis"><em>object</em></span>, see the <span class="command"><strong>color</strong></span> command. <span class="emphasis"><em>attribute</em></span>
520 can be one of the following:
521 </p><div class="itemizedlist"><ul type="disc"><li><p>none</p></li><li><p>bold</p></li><li><p>underline</p></li><li><p>reverse</p></li><li><p>standout</p></li></ul></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="msg-hdr-display"></a>10. Message Header Display</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="ignore"></a>10.1. Selecting Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">ignore</code>
522 <em class="replaceable"><code>pattern</code></em>
524 <em class="replaceable"><code>pattern</code></em>
525 ...]<br /><code class="command">unignore</code> {
526 <em class="replaceable"><code>*</code></em>
528 <em class="replaceable"><code>pattern</code></em>
530 Messages often have many header fields added by automatic processing systems,
531 or which may not seem useful to display on the screen. This command allows
532 you to specify header fields which you don't normally want to see in the pager.
534 You do not need to specify the full header field name. For example,
535 “<span class="quote">ignore content-</span>” will ignore all header fields that begin with the pattern
536 “<span class="quote">content-</span>”. “<span class="quote">ignore *</span>” will ignore all headers.
538 To remove a previously added token from the list, use the “<span class="quote">unignore</span>” command.
539 The “<span class="quote">unignore</span>” command will make Mutt display headers with the given pattern.
540 For example, if you do “<span class="quote">ignore x-</span>” it is possible to “<span class="quote">unignore x-mailer</span>”.
542 “<span class="quote">unignore *</span>” will remove all tokens from the ignore list.
543 </p><div class="example"><a id="ex-header-weeding"></a><p class="title"><b>Example 3.9. Header weeding</b></p><div class="example-contents"><pre class="screen">
544 # Sven's draconian header weeding
546 unignore from date subject to cc
547 unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
549 </pre></div></div><br class="example-break" /></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="hdr-order"></a>10.2. Ordering Displayed Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">hdr_order</code>
550 <em class="replaceable"><code>header</code></em>
552 <em class="replaceable"><code>header</code></em>
553 ...]<br /><code class="command">unhdr_order</code> {
554 <em class="replaceable"><code>*</code></em>
556 <em class="replaceable"><code>header</code></em>
558 With the <span class="command"><strong>hdr_order</strong></span> command you can specify an order in
559 which Mutt will attempt to present these headers to you when viewing messages.
561 “<span class="quote"><span class="command"><strong>unhdr_order</strong></span> *</span>” will clear all previous headers from the order list,
562 thus removing the header order effects set by the system-wide startup file.
563 </p><div class="example"><a id="ex-hdr-order"></a><p class="title"><b>Example 3.10. Configuring header display order</b></p><div class="example-contents"><pre class="screen">
564 hdr_order From Date: From: To: Cc: Subject:
565 </pre></div></div><br class="example-break" /></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternates"></a>11. Alternative Addresses</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alternates</code> [
566 <code class="option">-group</code>
567 <em class="replaceable"><code>name</code></em>
569 <em class="replaceable"><code>regexp</code></em>
571 <em class="replaceable"><code>regexp</code></em>
572 ...]<br /><code class="command">unalternates</code> [
573 <code class="option">-group</code>
574 <em class="replaceable"><code>name</code></em>
576 <em class="replaceable"><code>*</code></em>
578 <em class="replaceable"><code>regexp</code></em>
580 With various functions, Mutt will treat messages differently,
581 depending on whether you sent them or whether you received them from
582 someone else. For instance, when replying to a message that you
583 sent to a different party, Mutt will automatically suggest to send
584 the response to the original message's recipients — responding to
585 yourself won't make much sense in many cases. (See <a class="link" href="reference.html#reply-to" title="3.214. reply_to">$reply_to</a>.)
587 Many users receive e-mail under a number of different addresses. To
588 fully use Mutt's features here, the program must be able to
589 recognize what e-mail addresses you receive mail under. That's the
590 purpose of the <span class="command"><strong>alternates</strong></span> command: It takes a list of regular
591 expressions, each of which can identify an address under which you
594 As addresses are matched using regular expressions and not exact strict
595 comparisons, you should make sure you specify your addresses as precise
596 as possible to avoid mismatches. For example, if you specify:
597 </p><pre class="screen">
598 alternates user@example
600 Mutt will consider “<span class="quote"><code class="literal">some-user@example</code></span>” as
601 being your address, too which may not be desired. As a solution, in such
602 cases addresses should be specified as:
603 </p><pre class="screen">
604 alternates '^user@example$'
606 The <code class="literal">-group</code> flag causes all of the subsequent regular expressions
607 to be added to the named group.
609 The <span class="command"><strong>unalternates</strong></span> command can be used to write exceptions to
610 <span class="command"><strong>alternates</strong></span> patterns. If an address matches something in an
611 <span class="command"><strong>alternates</strong></span> command, but you nonetheless do not think it is
612 from you, you can list a more precise pattern under an <span class="command"><strong>unalternates</strong></span>
615 To remove a regular expression from the <span class="command"><strong>alternates</strong></span> list, use the
616 <span class="command"><strong>unalternates</strong></span> command with exactly the same <span class="emphasis"><em>regexp</em></span>.
617 Likewise, if the <span class="emphasis"><em>regexp</em></span> for an <span class="command"><strong>alternates</strong></span> command matches
618 an entry on the <span class="command"><strong>unalternates</strong></span> list, that <span class="command"><strong>unalternates</strong></span>
619 entry will be removed. If the <span class="emphasis"><em>regexp</em></span> for <span class="command"><strong>unalternates</strong></span>
620 is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries</em></span> on <span class="command"><strong>alternates</strong></span> will be removed.
621 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lists"></a>12. Mailing Lists</h2></div></div></div><a id="subscribe"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">lists</code> [
622 <code class="option">-group</code>
623 <em class="replaceable"><code>name</code></em>
625 <em class="replaceable"><code>regexp</code></em>
627 <em class="replaceable"><code>regexp</code></em>
628 ...]<br /><code class="command">unlists</code> [
629 <code class="option">-group</code>
630 <em class="replaceable"><code>name</code></em>
632 <em class="replaceable"><code>*</code></em>
634 <em class="replaceable"><code>regexp</code></em>
635 ... }<br /><code class="command">subscribe</code> [
636 <code class="option">-group</code>
637 <em class="replaceable"><code>name</code></em>
639 <em class="replaceable"><code>regexp</code></em>
641 <em class="replaceable"><code>regexp</code></em>
642 ...]<br /><code class="command">unsubscribe</code> [
643 <code class="option">-group</code>
644 <em class="replaceable"><code>name</code></em>
646 <em class="replaceable"><code>*</code></em>
648 <em class="replaceable"><code>regexp</code></em>
650 Mutt has a few nice features for <a class="link" href="advancedusage.html#using-lists" title="8. Handling Mailing Lists">handling mailing lists</a>. In order to take advantage of them, you must
651 specify which addresses belong to mailing lists, and which mailing
652 lists you are subscribed to. Mutt also has limited support for
653 auto-detecting mailing lists: it supports parsing
654 <code class="literal">mailto:</code> links in the common
655 <code class="literal">List-Post:</code> header which has the same effect as
656 specifying the list address via the <span class="command"><strong>lists</strong></span> command
657 (except the group feature). Once you have done this, the
658 <a class="link" href="gettingstarted.html#list-reply"><code class="literal"><list-reply></code></a>
659 function will work for all known lists.
660 Additionally, when you send a message to a subscribed list, Mutt will
661 add a Mail-Followup-To header to tell other users' mail user agents
662 not to send copies of replies to your personal address.
663 </p><div class="note"><h3 class="title">Note</h3><p>
664 The Mail-Followup-To header is a non-standard extension which is not
665 supported by all mail user agents. Adding it is not bullet-proof against
666 receiving personal CCs of list messages. Also note that the generation
667 of the Mail-Followup-To header is controlled by the
668 <a class="link" href="reference.html#followup-to" title="3.68. followup_to">$followup_to</a>
669 configuration variable since it's common practice on some mailing lists
670 to send Cc upons replies (which is more a group- than a list-reply).
672 More precisely, Mutt maintains lists of patterns for the addresses
673 of known and subscribed mailing lists. Every subscribed mailing
674 list is known. To mark a mailing list as known, use the <span class="command"><strong>list</strong></span>
675 command. To mark it as subscribed, use <span class="command"><strong>subscribe</strong></span>.
677 You can use regular expressions with both commands. To mark all
678 messages sent to a specific bug report's address on Debian's bug
679 tracking system as list mail, for instance, you could say
680 </p><pre class="screen">
681 subscribe [0-9]*.*@bugs.debian.org</pre><p>
682 as it's often, it's sufficient to just give a portion of the list's e-mail address.
684 Specify as much of the address as you need to to remove ambiguity. For
685 example, if you've subscribed to the Mutt mailing list, you will receive mail
686 addressed to <code class="literal">mutt-users@mutt.org</code>. So, to tell Mutt
687 that this is a mailing list, you could add <code class="literal">lists mutt-users@</code> to your
688 initialization file. To tell Mutt that you are subscribed to it,
689 add <code class="literal"><span class="command"><strong>subscribe</strong></span> mutt-users</code> to your initialization file instead.
690 If you also happen to get mail from someone whose address is
691 <code class="literal">mutt-users@example.com</code>, you could use
692 <code class="literal"><span class="command"><strong>lists</strong></span> ^mutt-users@mutt\\.org$</code>
693 or <code class="literal"><span class="command"><strong>subscribe</strong></span> ^mutt-users@mutt\\.org$</code> to
694 match only mail from the actual list.
696 The <code class="literal">-group</code> flag adds all of the subsequent regular expressions
699 The “<span class="quote">unlists</span>” command is used to remove a token from the list of
700 known and subscribed mailing-lists. Use “<span class="quote">unlists *</span>” to remove all
703 To remove a mailing list from the list of subscribed mailing lists,
704 but keep it on the list of known mailing lists, use <span class="command"><strong>unsubscribe</strong></span>.
705 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mbox-hook"></a>13. Using Multiple Spool Mailboxes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mbox-hook</code>
706 <em class="replaceable"><code>[!]pattern</code></em>
708 <em class="replaceable"><code>mailbox</code></em>
710 This command is used to move read messages from a specified mailbox to a
711 different mailbox automatically when you quit or change folders.
712 <span class="emphasis"><em>pattern</em></span> is a regular expression specifying the mailbox to treat as a
713 “<span class="quote">spool</span>” mailbox and <span class="emphasis"><em>mailbox</em></span> specifies where mail should be saved when
716 Unlike some of the other <span class="emphasis"><em>hook</em></span> commands, only the <span class="emphasis"><em>first</em></span> matching
717 pattern is used (it is not possible to save read mail in more than a single
719 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailboxes"></a>14. Monitoring Incoming Mail</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mailboxes</code>
720 <em class="replaceable"><code>mailbox</code></em>
722 <em class="replaceable"><code>mailbox</code></em>
723 ...]<br /><code class="command">unmailboxes</code> {
724 <em class="replaceable"><code>*</code></em>
726 <em class="replaceable"><code>mailbox</code></em>
728 This command specifies folders which can receive mail and
729 which will be checked for new messages periodically.
731 <span class="emphasis"><em>folder</em></span> can either be a local file or directory
732 (Mbox/Mmdf or Maildir/Mh). If Mutt was built with POP and/or IMAP
733 support, <span class="emphasis"><em>folder</em></span> can also be a POP/IMAP folder
734 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>,
735 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>
738 Mutt provides a number of advanced features for handling (possibly many)
739 folders and new mail within them, please refer to
740 <a class="xref" href="advancedusage.html#handling-folders" title="9. Handling multiple folders">Section 9, “Handling multiple folders”</a> for details (including in what
741 situations and how often Mutt checks for new mail).
743 The “<span class="quote">unmailboxes</span>” command is used to remove a token from the list
744 of folders which receive mail. Use “<span class="quote">unmailboxes *</span>” to remove all
746 </p><div class="note"><h3 class="title">Note</h3><p>
747 The folders in the <span class="command"><strong>mailboxes</strong></span> command are resolved when
748 the command is executed, so if these names contain <a class="link" href="advancedusage.html#shortcuts" title="7. Mailbox Shortcuts">shortcut characters</a> (such as “<span class="quote">=</span>” and “<span class="quote">!</span>”), any variable
749 definition that affects these characters (like <a class="link" href="reference.html#folder" title="3.66. folder">$folder</a> and <a class="link" href="reference.html#spoolfile" title="3.269. spoolfile">$spoolfile</a>)
750 should be set before the <span class="command"><strong>mailboxes</strong></span> command. If
751 none of these shorcuts are used, a local path should be absolute as
752 otherwise Mutt tries to find it relative to the directory
753 from where Mutt was started which may not always be desired.
755 For Mbox and Mmdf folders, new mail is detected by comparing access and/or
756 modification times of files: Mutt assumes a folder has new mail if it wasn't
757 accessed after it was last modified. Utilities like <code class="literal">biff</code> or
758 <code class="literal">frm</code> or any other program which accesses the mailbox might cause
759 Mutt to never detect new mail for that mailbox if they do not properly reset the
760 access time. Other possible causes of Mutt not detecting new mail in these folders
761 are backup tools (updating access times) or filesystems mounted without
762 access time update support.
764 In cases where new mail detection for Mbox or Mmdf folders appears to be
766 <a class="link" href="reference.html#check-mbox-size" title="3.26. check_mbox_size">$check_mbox_size</a>
767 option can be used to make Mutt track and consult file sizes for new
768 mail detection instead which won't work for size-neutral changes.
769 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="my-hdr"></a>15. User-Defined Headers</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">my_hdr</code>
770 <em class="replaceable"><code>string</code></em>
771 <br /><code class="command">unmy_hdr</code> {
772 <em class="replaceable"><code>*</code></em>
774 <em class="replaceable"><code>field</code></em>
776 The <span class="command"><strong>my_hdr</strong></span> command allows you to create your own header
777 fields which will be added to every message you send and appear in the
778 editor if <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> is set.
780 For example, if you would like to add an “<span class="quote">Organization:</span>” header field to
781 all of your outgoing messages, you can put the command something like
782 shown in <a class="xref" href="configuration.html#ex-my-hdr" title="Example 3.11. Defining custom headers">Example 3.11, “Defining custom headers”</a> in your <code class="literal">.muttrc</code>.
783 </p><div class="example"><a id="ex-my-hdr"></a><p class="title"><b>Example 3.11. Defining custom headers</b></p><div class="example-contents"><pre class="screen">
784 my_hdr Organization: A Really Big Company, Anytown, USA
785 </pre></div></div><br class="example-break" /><div class="note"><h3 class="title">Note</h3><p>
786 Space characters are <span class="emphasis"><em>not</em></span> allowed between the keyword and
787 the colon (“<span class="quote">:</span>”). The standard for electronic mail (RFC2822) says that
788 space is illegal there, so Mutt enforces the rule.
790 If you would like to add a header field to a single message, you should
791 either set the <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> variable,
792 or use the <code class="literal"><edit-headers></code> function (default: “<span class="quote">E</span>”) in the compose menu so
793 that you can edit the header of your message along with the body.
795 To remove user defined header fields, use the <span class="command"><strong>unmy_hdr</strong></span>
796 command. You may specify an asterisk (“<span class="quote">*</span>”) to remove all header
797 fields, or the fields to remove. For example, to remove all “<span class="quote">To</span>” and
798 “<span class="quote">Cc</span>” header fields, you could use:
799 </p><pre class="screen">
801 </pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="save-hook"></a>16. Specify Default Save Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">save-hook</code>
802 <em class="replaceable"><code>[!]pattern</code></em>
804 <em class="replaceable"><code>mailbox</code></em>
806 This command is used to override the default mailbox used when saving
807 messages. <span class="emphasis"><em>mailbox</em></span> will be used as the default if the message
808 matches <span class="emphasis"><em>pattern</em></span>, see <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for information
811 To provide more flexibility and good defaults, Mutt applies the
812 expandos of <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> to
813 <span class="emphasis"><em>mailbox</em></span> after it was expanded.
814 </p><div class="example"><a id="ex-save-hook-exando"></a><p class="title"><b>Example 3.12. Using %-expandos in <span class="command">save-hook</span></b></p><div class="example-contents"><pre class="screen">
815 # default: save all to ~/Mail/<author name>
816 save-hook . ~/Mail/%F
818 # save from me@turing.cs.hmc.edu and me@cs.hmc.edu to $folder/elkins
819 save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins
821 # save from aol.com to $folder/spam
822 save-hook aol\\.com$ +spam
823 </pre></div></div><br class="example-break" /><p>
824 Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
825 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-hook"></a>17. Specify Default Fcc: Mailbox When Composing</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-hook</code>
826 <em class="replaceable"><code>[!]pattern</code></em>
828 <em class="replaceable"><code>mailbox</code></em>
830 This command is used to save outgoing mail in a mailbox other than
831 <a class="link" href="reference.html#record" title="3.211. record">$record</a>. Mutt searches the initial list of
832 message recipients for the first matching <span class="emphasis"><em>regexp</em></span> and uses <span class="emphasis"><em>mailbox</em></span>
833 as the default Fcc: mailbox. If no match is found the message will be saved
834 to <a class="link" href="reference.html#record" title="3.211. record">$record</a> mailbox.
836 To provide more flexibility and good defaults, Mutt applies the
837 expandos of <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> to
838 <span class="emphasis"><em>mailbox</em></span> after it was expanded.
840 See <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format of <span class="emphasis"><em>pattern</em></span>.
841 </p><pre class="screen">fcc-hook [@.]aol\\.com$ +spammers</pre><p>
842 ...will save a copy of all messages going to the aol.com domain to
843 the `+spammers' mailbox by default. Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
844 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-save-hook"></a>18. 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>
845 <em class="replaceable"><code>[!]pattern</code></em>
847 <em class="replaceable"><code>mailbox</code></em>
849 This command is a shortcut, equivalent to doing both a <a class="link" href="configuration.html#fcc-hook" title="17. Specify Default Fcc: Mailbox When Composing"><span class="command"><strong>fcc-hook</strong></span></a>
850 and a <a class="link" href="configuration.html#save-hook" title="16. Specify Default Save Mailbox"><span class="command"><strong>save-hook</strong></span></a> with its arguments,
851 including %-expansion on <span class="emphasis"><em>mailbox</em></span> according
852 to <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>.
853 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="send-hook"></a>19. 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>
854 <em class="replaceable"><code>[!]pattern</code></em>
856 <em class="replaceable"><code>command</code></em>
857 <br /><code class="command">send-hook</code>
858 <em class="replaceable"><code>[!]pattern</code></em>
860 <em class="replaceable"><code>command</code></em>
861 <br /><code class="command">send2-hook</code>
862 <em class="replaceable"><code>[!]pattern</code></em>
864 <em class="replaceable"><code>command</code></em>
866 These commands can be used to execute arbitrary configuration commands based
867 upon recipients of the message. <span class="emphasis"><em>pattern</em></span> is used to match
868 the message, see <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for details. <span class="emphasis"><em>command</em></span>
869 is executed when <span class="emphasis"><em>pattern</em></span> matches.
871 <span class="command"><strong>reply-hook</strong></span> is matched against the message you are <span class="emphasis"><em>replying to</em></span>,
872 instead of the message you are <span class="emphasis"><em>sending</em></span>. <span class="command"><strong>send-hook</strong></span> is
873 matched against all messages, both <span class="emphasis"><em>new</em></span>
874 and <span class="emphasis"><em>replies</em></span>.
875 </p><div class="note"><h3 class="title">Note</h3><p>
876 <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>
877 of the order specified in the user's configuration file.
879 <span class="command"><strong>send2-hook</strong></span> is matched every time a message is changed, either
880 by editing it, or by using the compose menu to change its recipients
881 or subject. <span class="command"><strong>send2-hook</strong></span> is executed after <span class="command"><strong>send-hook</strong></span>, and
882 can, e.g., be used to set parameters such as the <a class="link" href="reference.html#sendmail" title="3.230. sendmail">$sendmail</a> variable depending on the message's sender
885 For each type of <span class="command"><strong>send-hook</strong></span> or <span class="command"><strong>reply-hook</strong></span>, when multiple matches
886 occur, commands are executed in the order they are specified in the <code class="literal">.muttrc</code>
887 (for that type of hook).
889 Example: <code class="literal"><span class="command"><strong>send-hook</strong></span> mutt "<span class="command"><strong>set</strong></span> mime_forward signature=''"</code>
891 Another typical use for this command is to change the values of the
892 <a class="link" href="reference.html#attribution" title="3.16. attribution">$attribution</a>, <a class="link" href="reference.html#signature" title="3.235. signature">$signature</a> and <a class="link" href="reference.html#locale" title="3.117. locale">$locale</a>
893 variables in order to change the language of the attributions and
894 signatures based upon the recipients.
895 </p><div class="note"><h3 class="title">Note</h3><p>
896 <span class="command"><strong>send-hook</strong></span>'s are only executed once after getting the
897 initial list of recipients. Adding a recipient after replying or
898 editing the message will not cause any <span class="command"><strong>send-hook</strong></span> to be executed,
899 similarily if <a class="link" href="reference.html#autoedit" title="3.18. autoedit">$autoedit</a> is set
900 (as then the initial list of recipients is empty). Also note that <a class="link" href="configuration.html#my-hdr" title="15. User-Defined Headers"><span class="command"><strong>my_hdr</strong></span></a> commands which
901 modify recipient headers, or the message's subject, don't have any
902 effect on the current message when executed from a
903 <span class="command"><strong>send-hook</strong></span>.
904 </p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="message-hook"></a>20. Change Settings Before Formatting a Message</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">message-hook</code>
905 <em class="replaceable"><code>[!]pattern</code></em>
907 <em class="replaceable"><code>command</code></em>
909 This command can be used to execute arbitrary configuration commands
910 before viewing or formatting a message based upon information about the message.
911 <span class="emphasis"><em>command</em></span> is executed if the <span class="emphasis"><em>pattern</em></span> matches the message to be
912 displayed. When multiple matches occur, commands are executed in the order
913 they are specified in the <code class="literal">.muttrc</code>.
915 See <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for
916 information on the exact format of <span class="emphasis"><em>pattern</em></span>.
919 </p><pre class="screen">
920 message-hook ~A 'set pager=builtin'
921 message-hook '~f freshmeat-news' 'set pager="less \"+/^ subject: .*\""'
922 </pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="crypt-hook"></a>21. Choosing the Cryptographic Key of the Recipient</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">crypt-hook</code>
923 <em class="replaceable"><code>pattern</code></em>
925 <em class="replaceable"><code>keyid</code></em>
927 When encrypting messages with PGP/GnuPG or OpenSSL, you may want to associate a certain
928 key with a given e-mail address automatically, either because the
929 recipient's public key can't be deduced from the destination address,
930 or because, for some reasons, you need to override the key Mutt would
931 normally use. The <span class="command"><strong>crypt-hook</strong></span> command provides a
932 method by which you can specify the ID of the public key to be used
933 when encrypting messages to a certain recipient.
935 The meaning of <span class="emphasis"><em>keyid</em></span> is to be taken broadly in this context: You
936 can either put a numerical key ID here, an e-mail address, or even
938 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="push"></a>22. Adding Key Sequences to the Keyboard Buffer</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">push</code>
939 <em class="replaceable"><code>string</code></em>
941 This command adds the named string to the keyboard buffer. The string may
942 contain control characters, key names and function names like the sequence
943 string in the <a class="link" href="configuration.html#macro" title="8. Keyboard Macros">macro</a> command. You may use it to
944 automatically run a sequence of commands at startup, or when entering
945 certain folders. For example, <a class="xref" href="configuration.html#ex-folder-hook-push" title="Example 3.13. Embedding push in folder-hook">Example 3.13, “Embedding push in folder-hook”</a>
946 shows how to automatically collapse all threads when entering a folder.
947 </p><div class="example"><a id="ex-folder-hook-push"></a><p class="title"><b>Example 3.13. Embedding <span class="command">push</span> in <span class="command">folder-hook</span></b></p><div class="example-contents"><pre class="screen">
948 folder-hook . 'push <collapse-all>'
949 </pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="exec"></a>23. Executing Functions</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">exec</code>
950 <em class="replaceable"><code>function</code></em>
952 <em class="replaceable"><code>function</code></em>
954 This command can be used to execute any function. Functions are
955 listed in the <a class="link" href="reference.html#functions" title="4. Functions">function reference</a>.
956 “<span class="quote"><span class="command"><strong>exec</strong></span><code class="literal">function</code></span>” is equivalent to
957 “<span class="quote"><code class="literal">push <function></code></span>”.
958 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="score-command"></a>24. Message Scoring</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">score</code>
959 <em class="replaceable"><code>pattern</code></em>
961 <em class="replaceable"><code>value</code></em>
962 <br /><code class="command">unscore</code> {
963 <em class="replaceable"><code>*</code></em>
965 <em class="replaceable"><code>pattern</code></em>
967 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>
968 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="2. Patterns: Searching, Limiting and Tagging">patterns</a> section (note: For efficiency reasons, patterns
969 which scan information not available in the index, such as <code class="literal">˜b</code>,
970 <code class="literal">˜B</code> or <code class="literal">˜h</code>, may not be used). <span class="emphasis"><em>value</em></span> is a
971 positive or negative integer. A message's final score is the sum total of all
972 matching <span class="command"><strong>score</strong></span> entries. However, you may optionally prefix <span class="emphasis"><em>value</em></span> with
973 an equal sign (“<span class="quote">=</span>”) to cause evaluation to stop at a particular entry if there is
974 a match. Negative final scores are rounded up to 0.
976 The <span class="command"><strong>unscore</strong></span> command removes score entries from the list. You <span class="emphasis"><em>must</em></span>
977 specify the same pattern specified in the <span class="command"><strong>score</strong></span> command for it to be
978 removed. The pattern “<span class="quote">*</span>” is a special token which means to clear the list
979 of all score entries.
980 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spam"></a>25. Spam Detection</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">spam</code>
981 <em class="replaceable"><code>pattern</code></em>
983 <em class="replaceable"><code>format</code></em>
984 <br /><code class="command">nospam</code> {
985 <em class="replaceable"><code>*</code></em>
987 <em class="replaceable"><code>pattern</code></em>
989 Mutt has generalized support for external spam-scoring filters.
990 By defining your spam patterns with the <span class="command"><strong>spam</strong></span> and <code class="literal">nospam</code>
991 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
992 mail based on its spam attributes, as determined by the external
993 filter. You also can display the spam attributes in your index
994 display using the <code class="literal">%H</code> selector in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. (Tip: try <code class="literal">%?H?[%H] ?</code>
995 to display spam tags only when they are defined for a given message.)
997 Your first step is to define your external filter's spam patterns using
998 the <span class="command"><strong>spam</strong></span> command. <span class="emphasis"><em>pattern</em></span> should be a regular expression
999 that matches a header in a mail message. If any message in the mailbox
1000 matches this regular expression, it will receive a “<span class="quote">spam tag</span>” or
1001 “<span class="quote">spam attribute</span>” (unless it also matches a <span class="command"><strong>nospam</strong></span> pattern — see
1002 below.) The appearance of this attribute is entirely up to you, and is
1003 governed by the <span class="emphasis"><em>format</em></span> parameter. <span class="emphasis"><em>format</em></span> can be any static
1004 text, but it also can include back-references from the <span class="emphasis"><em>pattern</em></span>
1005 expression. (A regular expression “<span class="quote">back-reference</span>” refers to a
1006 sub-expression contained within parentheses.) <code class="literal">%1</code> is replaced with
1007 the first back-reference in the regex, <code class="literal">%2</code> with the second, etc.
1009 To match spam tags, mutt needs the corresponding header information
1010 which is always the case for local and POP folders but not for IMAP in
1011 the default configuration. Depending on the spam header to be analyzed,
1012 <a class="link" href="reference.html#imap-headers" title="3.99. imap_headers">$imap_headers</a> may need
1015 If you're using multiple spam filters, a message can have more than
1016 one spam-related header. You can define <span class="command"><strong>spam</strong></span> patterns for each
1017 filter you use. If a message matches two or more of these patterns, and
1018 the <a class="link" href="reference.html#spam-separator" title="3.268. spam_separator">$spam_separator</a> variable is set to a string, then the
1019 message's spam tag will consist of all the <span class="emphasis"><em>format</em></span> strings joined
1020 together, with the value of <a class="link" href="reference.html#spam-separator" title="3.268. spam_separator">$spam_separator</a> separating
1023 For example, suppose one uses DCC, SpamAssassin, and PureMessage, then
1024 the configuration might look like in <a class="xref" href="configuration.html#ex-spam" title="Example 3.14. Configuring spam detection">Example 3.14, “Configuring spam detection”</a>.
1025 </p><div class="example"><a id="ex-spam"></a><p class="title"><b>Example 3.14. Configuring spam detection</b></p><div class="example-contents"><pre class="screen">
1026 spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
1027 spam "X-Spam-Status: Yes" "90+/SA"
1028 spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
1029 set spam_separator=", "
1030 </pre></div></div><br class="example-break" /><p>
1031 If then a message is received that DCC registered with “<span class="quote">many</span>” hits
1032 under the “<span class="quote">Fuz2</span>” checksum, and that PureMessage registered with a
1033 97% probability of being spam, that message's spam tag would read
1034 <code class="literal">90+/DCC-Fuz2, 97/PM</code>. (The four characters before “<span class="quote">=many</span>” in a
1035 DCC report indicate the checksum used — in this case, “<span class="quote">Fuz2</span>”.)
1037 If the <a class="link" href="reference.html#spam-separator" title="3.268. spam_separator">$spam_separator</a> variable is unset, then each
1038 spam pattern match supersedes the previous one. Instead of getting
1039 joined <span class="emphasis"><em>format</em></span> strings, you'll get only the last one to match.
1041 The spam tag is what will be displayed in the index when you use
1042 <code class="literal">%H</code> in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. It's also the
1043 string that the <code class="literal">˜H</code> pattern-matching expression matches against for
1044 <code class="literal"><search></code> and <code class="literal"><limit></code> functions. And it's what sorting by spam
1045 attribute will use as a sort key.
1047 That's a pretty complicated example, and most people's actual
1048 environments will have only one spam filter. The simpler your
1049 configuration, the more effective Mutt can be, especially when it comes
1052 Generally, when you sort by spam tag, Mutt will sort <span class="emphasis"><em>lexically</em></span> —
1053 that is, by ordering strings alphanumerically. However, if a spam tag
1054 begins with a number, Mutt will sort numerically first, and lexically
1055 only when two numbers are equal in value. (This is like UNIX's
1056 <code class="literal">sort -n</code>.) A message with no spam attributes at all — that is, one
1057 that didn't match <span class="emphasis"><em>any</em></span> of your <span class="command"><strong>spam</strong></span> patterns — is sorted at
1058 lowest priority. Numbers are sorted next, beginning with 0 and ranging
1059 upward. Finally, non-numeric strings are sorted, with “<span class="quote">a</span>” taking lower
1060 priority than “<span class="quote">z</span>”. Clearly, in general, sorting by spam tags is most
1061 effective when you can coerce your filter to give you a raw number. But
1062 in case you can't, Mutt can still do something useful.
1064 The <span class="command"><strong>nospam</strong></span> command can be used to write exceptions to <span class="command"><strong>spam</strong></span>
1065 patterns. If a header pattern matches something in a <span class="command"><strong>spam</strong></span> command,
1066 but you nonetheless do not want it to receive a spam tag, you can list a
1067 more precise pattern under a <span class="command"><strong>nospam</strong></span> command.
1069 If the <span class="emphasis"><em>pattern</em></span> given to <span class="command"><strong>nospam</strong></span> is exactly the same as the
1070 <span class="emphasis"><em>pattern</em></span> on an existing <span class="command"><strong>spam</strong></span> list entry, the effect will be to
1071 remove the entry from the spam list, instead of adding an exception.
1072 Likewise, if the <span class="emphasis"><em>pattern</em></span> for a <span class="command"><strong>spam</strong></span> command matches an entry
1073 on the <span class="command"><strong>nospam</strong></span> list, that nospam entry will be removed. If the
1074 <span class="emphasis"><em>pattern</em></span> for <span class="command"><strong>nospam</strong></span> is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries on both lists</em></span>
1075 will be removed. This might be the default action if you use <span class="command"><strong>spam</strong></span>
1076 and <span class="command"><strong>nospam</strong></span> in conjunction with a <span class="command"><strong>folder-hook</strong></span>.
1078 You can have as many <span class="command"><strong>spam</strong></span> or <span class="command"><strong>nospam</strong></span> commands as you like.
1079 You can even do your own primitive <span class="command"><strong>spam</strong></span> detection within Mutt — for
1080 example, if you consider all mail from <code class="literal">MAILER-DAEMON</code> to be spam,
1081 you can use a <span class="command"><strong>spam</strong></span> command like this:
1082 </p><pre class="screen">
1083 spam "^From: .*MAILER-DAEMON" "999"
1084 </pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="set"></a>26. Setting and Querying Variables</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="var-types"></a>26.1. Variable Types</h3></div></div></div><p>
1085 Mutt supports these types of configuration variables:
1086 </p><div class="variablelist"><dl><dt><span class="term">boolean</span></dt><dd><p>
1087 A boolean expression, either “<span class="quote">yes</span>” or “<span class="quote">no</span>”.
1088 </p></dd><dt><span class="term">number</span></dt><dd><p>
1089 A signed integer number in the range -32768 to 32767.
1090 </p></dd><dt><span class="term">string</span></dt><dd><p>
1092 </p></dd><dt><span class="term">path</span></dt><dd><p>
1093 A specialized string for representing paths including support for
1094 mailbox shortcuts (see <a class="xref" href="advancedusage.html#shortcuts" title="7. Mailbox Shortcuts">Section 7, “Mailbox Shortcuts”</a>) as well as tilde
1095 (“<span class="quote">˜</span>”) for a user's home directory and more.
1096 </p></dd><dt><span class="term">quadoption</span></dt><dd><p>
1097 Like a boolean but triggers a prompt when set to “<span class="quote">ask-yes</span>”
1098 or “<span class="quote">ask-no</span>” with “<span class="quote">yes</span>” and “<span class="quote">no</span>”
1099 preselected respectively.
1100 </p></dd><dt><span class="term">sort order</span></dt><dd><p>
1101 A specialized string allowing only particular words as values depending
1103 </p></dd><dt><span class="term">regular expression</span></dt><dd><p>
1104 A regular expression, see <a class="xref" href="advancedusage.html#regexp" title="1. Regular Expressions">Section 1, “Regular Expressions”</a> for an introduction.
1105 </p></dd><dt><span class="term">folder magic</span></dt><dd><p>
1106 Specifies the type of folder to use: <span class="emphasis"><em>mbox</em></span>,
1107 <span class="emphasis"><em>mmdf</em></span>, <span class="emphasis"><em>mh</em></span>
1108 or <span class="emphasis"><em>maildir</em></span>.
1109 Currently only used to determine the type for newly created folders.
1110 </p></dd><dt><span class="term">e-mail address</span></dt><dd><p>
1111 An e-mail address either with or without
1112 realname. The older “<span class="quote"><code class="literal">user@example.org (Joe User)</code></span>”
1113 form is supported but strongly deprecated.
1114 </p></dd><dt><span class="term">user-defined</span></dt><dd><p>
1115 Arbitrary text, see <a class="xref" href="configuration.html#set-myvar" title="26.3. User-Defined Variables">Section 26.3, “User-Defined Variables”</a> for details.
1116 </p></dd></dl></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="set-commands"></a>26.2. Commands</h3></div></div></div><p>
1117 The following commands are available to manipulate and query variables:
1118 </p><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">set</code> {
1119 [ <code class="option">no</code> | <code class="option">inv</code> ]
1120 <em class="replaceable"><code>variable</code></em>
1122 <em class="replaceable"><code>variable=value</code></em>
1123 } [...]<br /><code class="command">toggle</code>
1124 <em class="replaceable"><code>variable</code></em>
1126 <em class="replaceable"><code>variable</code></em>
1127 ...]<br /><code class="command">unset</code>
1128 <em class="replaceable"><code>variable</code></em>
1130 <em class="replaceable"><code>variable</code></em>
1131 ...]<br /><code class="command">reset</code>
1132 <em class="replaceable"><code>variable</code></em>
1134 <em class="replaceable"><code>variable</code></em>
1136 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:
1137 boolean, number, string and quadoption. <span class="emphasis"><em>boolean</em></span> variables can be
1138 <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
1139 assigned a positive integer value.
1140 <span class="emphasis"><em>string</em></span> variables consist of any number of printable characters and
1141 must be enclosed in quotes if they contain spaces or tabs. You
1142 may also use the escape sequences “<span class="quote">\n</span>” and “<span class="quote">\t</span>” for newline and tab, respectively.
1143 <span class="emphasis"><em>quadoption</em></span> variables are used to control whether or not to be prompted
1144 for certain actions, or to specify a default action. A value of <span class="emphasis"><em>yes</em></span>
1145 will cause the action to be carried out automatically as if you had answered
1146 yes to the question. Similarly, a value of <span class="emphasis"><em>no</em></span> will cause the
1147 action to be carried out as if you had answered “<span class="quote">no.</span>” A value of
1148 <span class="emphasis"><em>ask-yes</em></span> will cause a prompt with a default answer of “<span class="quote">yes</span>” and
1149 <span class="emphasis"><em>ask-no</em></span> will provide a default answer of “<span class="quote">no.</span>”
1151 Prefixing a variable with “<span class="quote">no</span>” will unset it. Example: <code class="literal"><span class="command"><strong>set</strong></span> noaskbcc</code>.
1153 For <span class="emphasis"><em>boolean</em></span> variables, you may optionally prefix the variable name with
1154 <code class="literal">inv</code> to toggle the value (on or off). This is useful when writing
1155 macros. Example: <code class="literal"><span class="command"><strong>set</strong></span> invsmart_wrap</code>.
1157 The <span class="command"><strong>toggle</strong></span> command automatically prepends the <code class="literal">inv</code> prefix to all
1158 specified variables.
1160 The <span class="command"><strong>unset</strong></span> command automatically prepends the <code class="literal">no</code> prefix to all
1161 specified variables.
1163 Using the <code class="literal"><enter-command></code> function in the <span class="emphasis"><em>index</em></span> menu, you can query the
1164 value of a variable by prefixing the name of the variable with a question
1166 </p><pre class="screen">
1169 The question mark is actually only required for boolean and quadoption
1172 The <span class="command"><strong>reset</strong></span> command resets all given variables to the compile time
1173 defaults (hopefully mentioned in this manual). If you use the command
1174 <span class="command"><strong>set</strong></span> and prefix the variable with “<span class="quote">&</span>” this has the same
1175 behavior as the <span class="command"><strong>reset</strong></span> command.
1177 With the <span class="command"><strong>reset</strong></span> command there exists the special variable “<span class="quote">all</span>”,
1178 which allows you to reset all variables to their system defaults.
1179 </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="set-myvar"></a>26.3. User-Defined Variables</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-intro"></a>26.3.1. Introduction</h4></div></div></div><p>
1180 Along with the variables listed in the
1181 <a class="link" href="reference.html#variables" title="3. Configuration Variables">Configuration variables</a> section, Mutt
1182 supports user-defined variables with names starting
1183 with <code class="literal">my_</code> as in, for
1184 example, <code class="literal">my_cfgdir</code>.
1186 The <span class="command"><strong>set</strong></span> command either creates a
1187 custom <code class="literal">my_</code> variable or changes its
1188 value if it does exist already. The <span class="command"><strong>unset</strong></span> and <span class="command"><strong>reset</strong></span>
1189 commands remove the variable entirely.
1191 Since user-defined variables are expanded in the same way that
1192 environment variables are (except for
1193 the <a class="link" href="gettingstarted.html#shell-escape">shell-escape</a> command and
1194 backtick expansion), this feature can be used to make configuration
1195 files more readable.
1196 </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-examples"></a>26.3.2. Examples</h4></div></div></div><p>
1197 The following example defines and uses the variable <code class="literal">my_cfgdir</code>
1198 to abbreviate the calls of the <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> command:
1199 </p><div class="example"><a id="ex-myvar1"></a><p class="title"><b>Example 3.15. Using user-defined variables for config file readability</b></p><div class="example-contents"><pre class="screen">
1200 set my_cfgdir = $HOME/mutt/config
1202 source $my_cfgdir/hooks
1203 source $my_cfgdir/macros
1204 # more source commands...
1205 </pre></div></div><br class="example-break" /><p>
1206 A custom variable can also be used in macros to backup the current value
1207 of another variable. In the following example, the value of the
1208 <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a> is changed temporarily
1209 while its original value is saved as <code class="literal">my_delete</code>.
1210 After the macro has executed all commands, the original value of <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a> is restored.
1211 </p><div class="example"><a id="ex-myvar2"></a><p class="title"><b>Example 3.16. Using user-defined variables for backing up other config option values</b></p><div class="example-contents"><pre class="screen">
1213 <enter-command>set my_delete=$delete<enter>\
1214 <enter-command>set delete=yes<enter>\
1216 <enter-command>set delete=$my_delete<enter>'
1217 </pre></div></div><br class="example-break" /><p>
1218 Since Mutt expands such values already when parsing the configuration
1219 file(s), the value of <code class="literal">$my_delete</code> in the
1220 last example would be the value of <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a> exactly
1221 as it was at that point during parsing the configuration file. If
1222 another statement would change the value for <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a>
1223 later in the same or another file, it would have no effect on
1224 <code class="literal">$my_delete</code>. However, the expansion can
1225 be deferred to runtime, as shown in the next example, when escaping the
1227 </p><div class="example"><a id="ex-myvar3"></a><p class="title"><b>Example 3.17. Deferring user-defined variable expansion to runtime</b></p><div class="example-contents"><pre class="screen">
1228 macro pager <PageDown> "\
1229 <enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
1231 <enter-command> set pager_stop=\$my_old_pager_stop<Enter>\
1232 <enter-command> unset my_old_pager_stop<Enter>"
1233 </pre></div></div><br class="example-break" /><p>
1234 Note that there is a space
1235 between <code class="literal"><enter-command></code> and
1236 the <span class="command"><strong>set</strong></span> configuration command, preventing Mutt from
1237 recording the <span class="command"><strong>macro</strong></span>'s commands into its history.
1238 </p></div></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="source"></a>27. Reading Initialization Commands From Another File</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">source</code>
1239 <em class="replaceable"><code>filename</code></em>
1241 This command allows the inclusion of initialization commands
1242 from other files. For example, I place all of my aliases in
1243 <code class="literal">˜/.mail_aliases</code> so that I can make my
1244 <code class="literal">˜/.muttrc</code> readable and keep my aliases private.
1246 If the filename begins with a tilde (“<span class="quote">˜</span>”), it will be expanded to the
1247 path of your home directory.
1249 If the filename ends with a vertical bar (“<span class="quote">|</span>”), then <span class="emphasis"><em>filename</em></span> is
1250 considered to be an executable program from which to read input (eg.
1251 <code class="literal"><span class="command"><strong>source</strong></span> ˜/bin/myscript|</code>).
1252 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="unhook"></a>28. Removing Hooks</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">unhook</code> {
1253 <em class="replaceable"><code>*</code></em>
1255 <em class="replaceable"><code>hook-type</code></em>
1257 This command permits you to flush hooks you have previously defined.
1258 You can either remove all hooks by giving the “<span class="quote">*</span>” character as an
1259 argument, or you can remove all hooks of a specific type by saying
1260 something like <code class="literal"><span class="command"><strong>unhook</strong></span> send-hook</code>.
1261 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="formatstrings"></a>29. Format Strings</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-basics"></a>29.1. Basic usage</h3></div></div></div><p>
1262 Format strings are a general concept you'll find in several locations
1263 through the Mutt configuration, especially in the
1264 <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>,
1265 <a class="link" href="reference.html#pager-format" title="3.150. pager_format">$pager_format</a>,
1266 <a class="link" href="reference.html#status-format" title="3.282. status_format">$status_format</a>,
1267 and other related variables. These can be very straightforward,
1268 and it's quite possible you already know how to use them.
1270 The most basic format string element is a percent symbol followed
1271 by another character. For example, <code class="literal">%s</code>
1272 represents a message's Subject: header in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. The
1273 “<span class="quote">expandos</span>” available are documented with each format variable, but
1274 there are general modifiers available with all formatting expandos,
1275 too. Those are our concern here.
1277 Some of the modifiers are borrowed right out of C (though you might
1278 know them from Perl, Python, shell, or another language). These are
1279 the <code class="literal">[-]m.n</code> modifiers, as in <code class="literal">%-12.12s</code>. As with
1280 such programming languages, these modifiers allow you to specify the
1281 minimum and maximum size of the resulting string, as well as its
1282 justification. If the “<span class="quote">-</span>” sign follows the percent, the string will
1283 be left-justified instead of right-justified. If there's a number
1284 immediately following that, it's the minimum amount of space the
1285 formatted string will occupy — if it's naturally smaller than that, it
1286 will be padded out with spaces. If a decimal point and another number
1287 follow, that's the maximum space allowable — the string will not be
1288 permitted to exceed that width, no matter its natural size. Each of
1289 these three elements is optional, so that all these are legal format
1290 strings: <code class="literal">%-12s</code>, <code class="literal">%4c</code>,
1291 <code class="literal">%.15F</code> and <code class="literal">%-12.15L</code>.
1293 Mutt adds some other modifiers to format strings. If you use an equals
1294 symbol (<code class="literal">=</code>) as a numeric prefix (like the minus
1295 above), it will force the string to be centered within its minimum
1296 space range. For example, <code class="literal">%=14y</code> will reserve 14
1297 characters for the %y expansion — that's the X-Label: header, in
1298 <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>. If the expansion
1299 results in a string less than 14 characters, it will be centered in a
1300 14-character space. If the X-Label for a message were “<span class="quote">test</span>”, that
1301 expansion would look like “<span class="quote"> test </span>”.
1303 There are two very little-known modifiers that affect the way that an
1304 expando is replaced. If there is an underline (“<span class="quote">_</span>”) character
1305 between any format modifiers (as above) and the expando letter, it will
1306 expands in all lower case. And if you use a colon (“<span class="quote">:</span>”), it will
1307 replace all decimal points with underlines.
1308 </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-conditionals"></a>29.2. Conditionals</h3></div></div></div><p>
1309 Depending on the format string variable, some of its sequences can be
1310 used to optionally print a string if their value is nonzero. For
1311 example, you may only want to see the number of flagged messages if such
1312 messages exist, since zero is not particularly meaningful. To optionally
1313 print a string based upon one of the above sequences, the following
1315 </p><pre class="screen">
1316 %?<sequence_char>?<optional_string>?</pre><p>
1317 where <span class="emphasis"><em>sequence_char</em></span> is an expando, and
1318 <span class="emphasis"><em>optional_string</em></span> is the string you would like printed if
1319 <span class="emphasis"><em>sequence_char</em></span> is nonzero.
1320 <span class="emphasis"><em>optional_string</em></span> may contain other
1321 sequences as well as normal text, but you may not nest optional
1324 Here is an example illustrating how to optionally print the number of
1325 new messages in a mailbox in
1326 <a class="link" href="reference.html#status-format" title="3.282. status_format">$status_format</a>:
1327 </p><pre class="screen">
1328 %?n?%n new messages.?</pre><p>
1329 You can also switch between two strings using the following construct:
1330 </p><pre class="screen">
1331 %?<sequence_char>?<if_string>&<else_string>?</pre><p>
1332 If the value of <span class="emphasis"><em>sequence_char</em></span> is
1333 non-zero, <span class="emphasis"><em>if_string</em></span> will be expanded,
1334 otherwise <span class="emphasis"><em>else_string</em></span> will be expanded.
1335 </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-filters"></a>29.3. Filters</h3></div></div></div><p>
1336 Any format string ending in a vertical bar (“<span class="quote">|</span>”) will be
1337 expanded and piped through the first word in the string, using spaces
1338 as separator. The string returned will be used for display.
1339 If the returned string ends in %, it will be passed through
1340 the formatter a second time. This allows the filter to generate a
1341 replacement format string including % expandos.
1343 All % expandos in a format string are expanded before the script
1345 </p><div class="example"><a id="ex-fmtpipe"></a><p class="title"><b>Example 3.18. Using external filters in format strings</b></p><div class="example-contents"><pre class="screen">
1346 set status_format="script.sh '%r %f (%L)'|"
1347 </pre></div></div><br class="example-break" /><p>
1348 will make Mutt expand <code class="literal">%r</code>,
1349 <code class="literal">%f</code> and <code class="literal">%L</code>
1350 before calling the script. The example also shows that arguments can be
1351 quoted: the script will receive the expanded string between the single quotes
1352 as the only argument.
1354 A practical example is the <code class="literal">mutt_xtitle</code>
1355 script installed in the <code class="literal">samples</code>
1356 subdirectory of the Mutt documentation: it can be used as filter for
1357 <a class="link" href="reference.html#status-format" title="3.282. status_format">$status_format</a> to set the current
1358 terminal's title, if supported.
1359 </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-padding"></a>29.4. Padding</h3></div></div></div><p>
1360 In most format strings, Mutt supports different types of padding using
1362 </p><div class="variablelist"><dl><dt><span class="term"><code class="literal">%|X</code></span></dt><dd><p>
1363 When this occurs, Mutt will fill the rest of the
1364 line with the character <code class="literal">X</code>. For
1365 example, filling the rest of the line with dashes is
1367 </p><pre class="screen">
1368 set status_format = "%v on %h: %B: %?n?%n&no? new messages %|-"</pre></dd><dt><span class="term">
1369 <code class="literal">%>X</code>
1371 Since the previous expando stops at the end of line, there must be a way
1372 to fill the gap between two items via the <code class="literal">%>X</code>
1373 expando: it puts as many characters <code class="literal">X</code> in between two
1374 items so that the rest of the line will be right-justified. For example,
1375 to not put the version string and hostname the above example on the left
1376 but on the right and fill the gap with spaces, one might use (note the
1377 space after <code class="literal">%></code>):
1378 </p><pre class="screen">
1379 set status_format = "%B: %?n?%n&no? new messages %> (%v on %h)"</pre></dd><dt><span class="term"><code class="literal">%*X</code>
1381 Normal right-justification will print everything to the left of the
1382 <code class="literal">%></code>, displaying padding and whatever lies to the
1383 right only if there's room. By contrast, “<span class="quote">soft-fill</span>” gives
1384 priority to the right-hand side, guaranteeing space to display it and
1385 showing padding only if there's still room. If necessary, soft-fill will
1386 eat text leftwards to make room for rightward text. For example, to
1387 right-justify the subject making sure as much as possible of it fits on
1388 screen, one might use (note two spaces after <code class="literal">%*
1389 </code>: the second ensures there's a space between the truncated
1390 right-hand side and the subject):
1391 </p><pre class="screen">
1392 set index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?)%* %s"</pre></dd></dl></div></div></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>