X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/19304f7c526fbe36ba0db2fb80bcaf3bd974d81d..24d1372aec0208946117089a703451c458a4c09a:/doc/configuration.html diff --git a/doc/configuration.html b/doc/configuration.html index 9915532..0e89131 100644 --- a/doc/configuration.html +++ b/doc/configuration.html @@ -1,74 +1,78 @@ -Chapter 3. Configuration

Chapter 3. Configuration

Table of Contents

1. Location of initialization files
2. Syntax of Initialization Files
3. Address groups
4. Defining/Using aliases
5. Changing the default key bindings
6. Defining aliases for character sets
7. Setting variables based upon mailbox
8. Keyboard macros
9. Using color and mono video attributes
10. Message header display
11. Alternative addresses
12. Mailing lists
13. Using Multiple spool mailboxes
14. Monitoring incoming mail
15. User defined headers
16. Specify default save mailbox
17. Specify default Fcc: mailbox when composing
18. Specify default save filename and default Fcc: mailbox at once
19. Change settings based upon message recipients
20. Change settings before formatting a message
21. Choosing the cryptographic key of the recipient
22. Adding key sequences to the keyboard buffer
23. Executing functions
24. Message Scoring
25. Spam detection
26. Setting and Querying Variables
26.1. Commands
26.2. User-defined variables
27. Reading initialization commands from another file
28. Removing hooks
29. Format Strings
29.1. Basic usage
29.2. Filters

1. Location of initialization files

+

Chapter 3. Configuration

1. Location of Initialization Files

While the default configuration (or “preferences”) make Mutt usable right out of the box, it is often desirable to tailor Mutt to suit your own tastes. When Mutt is first invoked, it will attempt to read the “system” configuration file (defaults set by your local -system administrator), unless the “-n” command line option is specified. This file is typically +system administrator), unless the “-n” command line option is specified. This file is typically /usr/local/share/mutt/Muttrc or /etc/Muttrc. Mutt will next look for a file named .muttrc in your home directory. If this file does not exist and your home directory has -a subdirectory named .mutt, mutt try to load a file named +a subdirectory named .mutt, Mutt tries to load a file named .mutt/muttrc.

.muttrc is the file where you will usually place your commands to configure Mutt.

-In addition, mutt supports version specific configuration files that are +In addition, Mutt supports version specific configuration files that are parsed instead of the default files as explained above. For instance, if your system has a Muttrc-0.88 file in the system configuration -directory, and you are running version 0.88 of mutt, this file will be +directory, and you are running version 0.88 of Mutt, this file will be sourced instead of the Muttrc file. The same is true of the user configuration file, if you have a file .muttrc-0.88.6 in your home -directory, when you run mutt version 0.88.6, it will source this file +directory, when you run Mutt version 0.88.6, it will source this file instead of the default .muttrc file. The version number is the -same which is visible using the “-v” command line switch or using the show-version key (default: +same which is visible using the “-v” command line switch or using the show-version key (default: V) from the index menu.

2. Syntax of Initialization Files

An initialization file consists of a series of commands. Each line of the file may contain one or more commands. When multiple commands are used, they must be separated by a semicolon -(;). +(“;”).

Example 3.1. Multiple configuration commands per line

 set realname='Mutt user' ; ignore x-
 

The hash mark, or pound sign (“#”), is used as a “comment” character. You can use it to annotate your initialization file. All text after the comment character -to the end of the line is ignored. For example, +to the end of the line is ignored.

Example 3.2. Commenting configuration files

 my_hdr X-Disclaimer: Why are you listening to me? # This is a comment
 

-Single quotes (') and double quotes (") can be used to quote strings +Single quotes (“'”) and double quotes (“"”) can be used to quote strings which contain spaces or other special characters. The difference between the two types of quotes is similar to that of many popular shell programs, namely that a single quote is used to specify a literal string (one that is not interpreted for shell variables or quoting with a backslash [see next paragraph]), while double quotes indicate a string for which should be evaluated. For example, backticks are evaluated inside of double -quotes, but not for single quotes. +quotes, but not for single quotes.

-\ quotes the next character, just as in shells such as bash and zsh. +“\” quotes the next character, just as in shells such as bash and zsh. For example, if want to put quotes “"” inside of a string, you can use “\” to force the next character to be a literal instead of interpreted character. @@ -79,30 +83,34 @@ set realname="Michael \"MuttDude\" Elkins" “\n” and “\r” have their usual C meanings of linefeed and carriage-return, respectively.

-A \ at the end of a line can be used to split commands over -multiple lines, provided that the split points don't appear in the -middle of command names. -

+A “\” at the end of a line can be used to split commands over +multiple lines as it “escapes” the line end, provided that the split points don't appear in the +middle of command names. Lines are first concatenated before +interpretation so that a multi-line can be commented by commenting out +the first line only. +

Example 3.4. Splitting long configuration commands over several lines

+set status_format="some very \
+long value split \
+over several lines"
+

It is also possible to substitute the output of a Unix command in an initialization file. This is accomplished by enclosing the command in -backticks (``). For example, -

Example 3.4. Using external command's output in configuration files

-my_hdr X-Operating-System: `uname -a`
-

-The output of the Unix command “uname -a” will be substituted before the +backticks (``). In Example 3.5, “Using external command's output in configuration files”, the output of the +Unix command “uname -a” will be substituted before the line is parsed. -

Note

Since initialization files are line oriented, only the first line of output from the Unix command will be substituted. -

-Both environment variables and mutt variables can be accessed by +

Example 3.5. Using external command's output in configuration files

+my_hdr X-Operating-System: `uname -a`
+

+Both environment variables and Mutt variables can be accessed by prepending “$” to the name of the variable. For example, -

Example 3.5. Using environment variables in configuration files

+

Example 3.6. Using environment variables in configuration files

 set record=+sent_on_$HOSTNAME
 

-will cause mutt to save outgoing messages to a folder named -“sent_on_kremvax” if the environment variable HOSTNAME is set to -“kremvax.” (See $record for +will cause Mutt to save outgoing messages to a folder named +“sent_on_kremvax” if the environment variable $HOSTNAME is set to +“kremvax.” (See $record for details.)

Mutt expands the variable when it is assigned, not when it is used. If @@ -110,7 +118,7 @@ the value of a variable on the right-hand side of an assignment changes after the assignment, the variable on the left-hand side will not be affected.

-The commands understood by mutt are explained in the next paragraphs. +The commands understood by Mutt are explained in the next paragraphs. For a complete list, see the command reference.

All configuration files are expected to be in the current locale as @@ -119,19 +127,21 @@ which doesn't have a default value since it's determined by Mutt at startup. If a configuration file is not encoded in the same character set the $config_charset variable should be used: all lines starting with the next are recoded -from $config_charset to $charset. +from $config_charset +to $charset.

This mechanism should be avoided if possible as it has the following implications:

  • These variables should be set early in a configuration -file with $charset preceding $config_charset so Mutt -know what character set to convert to.

  • If $config_charset is set, it should be set +file with $charset preceding +$config_charset so Mutt +knows what character set to convert to.

  • If $config_charset is set, it should be set in each configuration file because the value is global and not per configuration file.

  • Because Mutt first recodes a line before it attempts to parse it, a conversion introducing question marks or other characters as part of errors (unconvertable characters, transliteration) may introduce syntax errors or silently change the meaning of certain tokens (e.g. inserting -question marks into regular expressions).

3. Address groups

Usage:

group [ +question marks into regular expressions).

3. Address Groups

Usage:

group [ -group name ...] { @@ -140,7 +150,7 @@ question marks into regular expressions).

-addr expr -... }

ungroup [ +... }
ungroup [ -group name ...] { @@ -152,30 +162,30 @@ question marks into regular expressions).

-addr expr ... }

-group is used to directly add either addresses or +group is used to directly add either addresses or regular expressions to the specified group or groups. The different -categories of arguments to the group command can be +categories of arguments to the group command can be in any order. The flags -rx and -addr specify what the following strings (that cannot begin with a hyphen) should be interpreted as: either a regular expression or an email address, respectively.

These address groups can also be created implicitly by the -alias, lists, -subscribe and -alternates commands by specifying the +alias, lists, +subscribe and +alternates commands by specifying the optional -group option.

Once defined, these address groups can be used in patterns to search for and limit the display to messages matching a group.

-ungroup is used to remove addresses or regular +ungroup is used to remove addresses or regular expressions from the specified group or groups. The syntax is similar to -the group command, however the special character +the group command, however the special character * can be used to empty a group of all of its contents. -

4. Defining/Using aliases

Usage:

alias [ +

4. Defining/Using Aliases

Usage:

alias [ -group name ...] @@ -184,63 +194,61 @@ contents. address [ address -...]

+...]
unalias [ +-group +name +...] { +* + | +key +... }

It's usually very cumbersome to remember or type out the address of someone you are communicating with. Mutt allows you to create “aliases” which map a short string to a full address.

Note

If you want to create an alias for more than -one address, you must separate the addresses with a comma (“,”). +one address, you must separate the addresses with a comma (“,”).

The optional -group argument to -alias causes the aliased address(es) to be added to +alias causes the aliased address(es) to be added to the named group.

To remove an alias or aliases (“*” means all aliases): -

unalias [ --group -name -...] { -* - | -key -... }

+

 alias muttdude me@cs.hmc.edu (Michael Elkins)
 alias theguys manny, moe, jack
 

Unlike other mailers, Mutt doesn't require aliases to be defined -in a special file. The alias command can appear anywhere in -a configuration file, as long as this file is sourced. Consequently, you can have multiple alias files, or -you can have all aliases defined in your muttrc. +in a special file. The alias command can appear anywhere in +a configuration file, as long as this file is sourced. Consequently, you can have multiple alias files, or +you can have all aliases defined in your .muttrc.

On the other hand, the <create-alias> function can use only one file, the one pointed to by the $alias_file variable (which is ˜/.muttrc by default). This file is not special either, in the sense that Mutt will happily append aliases to any file, but in -order for the new aliases to take effect you need to explicitly source this file too. -

-For example: -

Example 3.6. Configuring external alias files

+order for the new aliases to take effect you need to explicitly source this file too.
+

Example 3.7. Configuring external alias files

 source /usr/local/share/Mutt.aliases
 source ~/.mail_aliases
 set alias_file=~/.mail_aliases
 

-To use aliases, you merely use the alias at any place in mutt where mutt +To use aliases, you merely use the alias at any place in Mutt where Mutt prompts for addresses, such as the To: or Cc: prompt. You can also enter aliases in your editor at the appropriate headers if you have the -$edit_headers variable set. +$edit_headers variable set.

In addition, at the various address prompts, you can use the tab character to expand a partial alias to the full alias. If there are multiple matches, -mutt will bring up a menu with the matching aliases. In order to be -presented with the full list of aliases, you must hit tab with out a partial +Mutt will bring up a menu with the matching aliases. In order to be +presented with the full list of aliases, you must hit tab without a partial alias, such as at the beginning of the prompt or after a comma denoting multiple addresses.

In the alias menu, you can select as many aliases as you want with the select-entry key (default: <Return>), and use the exit key (default: q) to return to the address prompt. -

5. Changing the default key bindings

Usage:

bind +

5. Changing the Default Key Bindings

Usage:

bind map key @@ -258,10 +266,10 @@ This is not a real menu, but is used as a fallback for all of the other menus except for the pager and editor modes. If a key is not defined in another menu, Mutt will look for a binding to use in this menu. This allows you to bind a key to a certain function in multiple menus instead of having -multiple bind statements to accomplish the same task. +multiple bind statements to accomplish the same task.

alias

The alias menu is the list of your personal aliases as defined in your -muttrc. It is the mapping from a short alias name to the full email +.muttrc. It is the mapping from a short alias name to the full email address(es) of the recipient(s).

attach

The attachment menu is used to access the attachments on received messages. @@ -288,7 +296,7 @@ The postpone menu is similar to the index menu, except is used when recalling a message the user was composing, but saved until later.

query

The query menu is the browser for results returned by -$query_command. +$query_command.

mix

The mixmaster screen is used to select remailer options for outgoing messages (if Mutt is compiled with Mixmaster support). @@ -309,56 +317,59 @@ space (“ ”) or semi-colon (“function specifies which action to take when key is pressed. For a complete list of functions, see the reference. The special function <noop> unbinds the specified key sequence. -

6. Defining aliases for character sets

Usage:

charset-hook +

6. Defining Aliases for Character Sets

Usage:

charset-hook alias charset -

iconv-hook +
iconv-hook charset local-charset

-The charset-hook command defines an alias for a character set. +The charset-hook command defines an alias for a character set. This is useful to properly display messages which are tagged with a -character set name not known to mutt. +character set name not known to Mutt.

-The iconv-hook command defines a system-specific name for a +The iconv-hook command defines a system-specific name for a character set. This is helpful when your systems character conversion library insists on using strange, system-specific names for character sets. -

7. Setting variables based upon mailbox

Usage:

folder-hook +

7. Setting Variables Based Upon Mailbox

Usage:

folder-hook [!]regexp command

It is often desirable to change settings based on which mailbox you are -reading. The folder-hook command provides a method by which you can execute +reading. The folder-hook command provides a method by which you can execute any configuration command. regexp is a regular expression specifying in which mailboxes to execute command before loading. If a mailbox -matches multiple folder-hook's, they are executed in the order given in the -muttrc. +matches multiple folder-hooks, they are executed in the order given in the +.muttrc.

Note

-If you use the “!” shortcut for $spoolfile at the beginning of the pattern, you must place it +If you use the “!” shortcut for $spoolfile at the beginning of the pattern, you must place it inside of double or single quotes in order to distinguish it from the logical not operator for the expression.

Note

Settings are not restored when you leave the mailbox. For example, a command action to perform is to change the sorting method based upon the mailbox being read: -

-folder-hook mutt set sort=threads
-

+ +

+folder-hook mutt "set sort=threads"

+ However, the sorting method is not restored to its previous value when reading a different mailbox. To specify a default command, use the -pattern “.” before other folder-hooks adjusting a value on a per-folder basis -because folder-hooks are evaluated in the order given in the configuration file. -The following example will set the sort variable +pattern “.” before other folder-hooks adjusting a value on a per-folder basis +because folder-hooks are evaluated in the order given in the +configuration file. +

+The following example will set the sort variable to date-sent for all folders but to threads for all folders containing “mutt” in their name. -

Example 3.7. Setting sort method based on mailbox name

-folder-hook . set sort=date-sent
-folder-hook mutt set sort=threads
-

8. Keyboard macros

Usage:

macro +

Example 3.8. Setting sort method based on mailbox name

+folder-hook . "set sort=date-sent"
+folder-hook mutt "set sort=threads"
+

8. Keyboard Macros

Usage:

macro menu key @@ -379,13 +390,13 @@ commas. Whitespace may not be used in between the menu arguments and the commas separating them.

key and sequence are expanded by the same rules as the -key bindings with some additions. The +key bindings with some additions. The first is that control characters in sequence can also be specified as ^x. In order to get a caret (“^”) you need to use ^^. Secondly, to specify a certain key such as up or to invoke a function directly, you can use the format <key name> and <function name>. For a listing of key -names see the section on key bindings. Functions +names see the section on key bindings. Functions are listed in the reference.

The advantage with using function names directly is that the macros will @@ -395,17 +406,17 @@ and portable, and also facilitates defining of macros in files used by more than one user (e.g., the system Muttrc).

Optionally you can specify a descriptive text after sequence, -which is shown in the help screens. +which is shown in the help screens if they contain a description.

Note

Macro definitions (if any) listed in the help screen(s), are silently truncated at the screen width, and are not wrapped. -

9. Using color and mono video attributes

Usage:

color +

9. Using Color and Mono Video Attributes

Usage:

color object foreground background -

color { +
color { header | body @@ -415,7 +426,7 @@ silently truncated at the screen width, and are not wrapped. background regexp -

color +
color index foreground @@ -423,16 +434,20 @@ silently truncated at the screen width, and are not wrapped. background pattern -

uncolor +
uncolor { index - { + | +header + | +body + } { * | pattern ... }

If your terminal supports color, you can spice up Mutt by creating your own color scheme. To define the color of an object (type of information), you -must specify both a foreground color and a background color (it is not +must specify both a foreground color and a background color (it is not possible to only specify one or the other).

header and body match regexp @@ -440,7 +455,7 @@ in the header/body of a message, index ma (see Section 2, “Patterns: Searching, Limiting and Tagging”) in the message index.

object can be one of: -

  • attachment

  • bold (hiliting bold patterns in the body of messages)

  • error (error messages printed by Mutt)

  • hdrdefault (default color of the message header in the pager)

  • indicator (arrow or bar used to indicate the current item in a menu)

  • markers (the “+” markers at the beginning of wrapped lines in the pager)

  • message (informational messages)

  • normal

  • quoted (text matching $quote_regexp in the body of a message)

  • quoted1, quoted2, ..., quotedN (higher levels of quoting)

  • search (hiliting of words in the pager)

  • signature

  • status (mode lines used to display info about the mailbox or message)

  • tilde (the “˜” used to pad blank lines in the pager)

  • tree (thread tree drawn in the message index and attachment menu)

  • underline (hiliting underlined patterns in the body of messages)

+

  • attachment

  • bold (hiliting bold patterns in the body of messages)

  • error (error messages printed by Mutt)

  • hdrdefault (default color of the message header in the pager)

  • indicator (arrow or bar used to indicate the current item in a menu)

  • markers (the “+” markers at the beginning of wrapped lines in the pager)

  • message (informational messages)

  • normal

  • quoted (text matching $quote_regexp in the body of a message)

  • quoted1, quoted2, ..., quotedN (higher levels of quoting)

  • search (hiliting of words in the pager)

  • signature

  • status (mode lines used to display info about the mailbox or message)

  • tilde (the “˜” used to pad blank lines in the pager)

  • tree (thread tree drawn in the message index and attachment menu)

  • underline (hiliting underlined patterns in the body of messages)

foreground and background can be one of the following:

  • white

  • black

  • green

  • magenta

  • blue

  • cyan

  • yellow

  • red

  • default

  • colorx

foreground can optionally be prefixed with the keyword bright to make @@ -449,7 +464,7 @@ the foreground color boldfaced (e.g., brightred). If your terminal supports it, the special keyword default can be used as a transparent color. The value brightdefault is also valid. If Mutt is linked against the S-Lang library, you also need to set -the COLORFGBG environment variable to the default colors of your +the $COLORFGBG environment variable to the default colors of your terminal for this to work; for example (for Bourne-like shells):

 set COLORFGBG="green;black"
@@ -459,24 +474,24 @@ The S-Lang library requires you to use th
 and brown keywords instead of white and yellow when
 setting this variable.
 

Note

-The uncolor command can be applied to the index object only. It -removes entries from the list. You must specify the same pattern -specified in the color command for it to be removed. The pattern “*” is -a special token which means to clear the color index list of all entries. +The uncolor command can be applied to the index, header and body objects only. It +removes entries from the list. You must specify the same pattern +specified in the color command for it to be removed. The pattern “*” is +a special token which means to clear the color list of all entries.

Mutt also recognizes the keywords color0, color1, …, -colorN-1 (N being the number of colors supported +colorN-1 (N being the number of colors supported by your terminal). This is useful when you remap the colors for your display (for example by changing the color associated with color2 for your xterm), since color names may then lose their normal meaning. -

+

If your terminal does not support color, it is still possible change the video -attributes through the use of the “mono” command: -

Usage:

mono +attributes through the use of the “mono” command. Usage: +

mono object attribute -

mono { +
mono { header | body @@ -484,26 +499,30 @@ attributes through the use of the “mono” command: attribute regexp -

mono +
mono index attribute pattern -

unmono +
unmono { index - { + | +header + | +body + } { * | pattern ... }

-For object, see the color command. attribute +For object, see the color command. attribute can be one of the following: -

  • none

  • bold

  • underline

  • reverse

  • standout

10. Message header display

Usage:

ignore +

  • none

  • bold

  • underline

  • reverse

  • standout

10. Message Header Display

10.1. Selecting Headers

Usage:

ignore pattern [ pattern -...]

unignore { +...]
unignore { * | pattern @@ -521,38 +540,36 @@ The “unignore” command will make Mutt display hea For example, if you do “ignore x-” it is possible to “unignore x-mailer”.

“unignore *” will remove all tokens from the ignore list. -

-For example: -

Example 3.8. Header weeding

+

Example 3.9. Header weeding

 # Sven's draconian header weeding
 ignore *
 unignore from date subject to cc
 unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
 unignore posted-to:
-

Usage:

hdr_order +


10.2. Ordering Displayed Headers

Usage:

hdr_order header [ header -...]

unhdr_order { +...]
unhdr_order { * | header ... }

-With the hdr_order command you can specify an order in -which mutt will attempt to present these headers to you when viewing messages. +With the hdr_order command you can specify an order in +which Mutt will attempt to present these headers to you when viewing messages.

-“unhdr_order *” will clear all previous headers from the order list, +“unhdr_order *” will clear all previous headers from the order list, thus removing the header order effects set by the system-wide startup file. -

Example 3.9. Configuring header display order

+

Example 3.10. Configuring header display order

 hdr_order From Date: From: To: Cc: Subject:
-

11. Alternative addresses

Usage:

alternates [ +


11. Alternative Addresses

Usage:

alternates [ -group name ...] regexp [ regexp -...]

unalternates [ +...]
unalternates [ -group name ...] { @@ -560,17 +577,17 @@ hdr_order From Date: From: To: Cc: Subject: | regexp ... }

-With various functions, mutt will treat messages differently, +With various functions, Mutt will treat messages differently, depending on whether you sent them or whether you received them from someone else. For instance, when replying to a message that you -sent to a different party, mutt will automatically suggest to send -the response to the original message's recipients -- responding to -yourself won't make much sense in many cases. (See $reply_to.) +sent to a different party, Mutt will automatically suggest to send +the response to the original message's recipients — responding to +yourself won't make much sense in many cases. (See $reply_to.)

Many users receive e-mail under a number of different addresses. To -fully use mutt's features here, the program must be able to +fully use Mutt's features here, the program must be able to recognize what e-mail addresses you receive mail under. That's the -purpose of the alternates command: It takes a list of regular +purpose of the alternates command: It takes a list of regular expressions, each of which can identify an address under which you receive e-mail.

@@ -580,7 +597,7 @@ as possible to avoid mismatches. For example, if you specify:

 alternates user@example
 

-mutt will consider “some-user@example” as +Mutt will consider “some-user@example” as being your address, too which may not be desired. As a solution, in such cases addresses should be specified as:

@@ -589,40 +606,40 @@ alternates '^user@example$'
 The -group flag causes all of the subsequent regular expressions
 to be added to the named group.
 

-The unalternates command can be used to write exceptions to -alternates patterns. If an address matches something in an -alternates command, but you nonetheless do not think it is -from you, you can list a more precise pattern under an unalternates +The unalternates command can be used to write exceptions to +alternates patterns. If an address matches something in an +alternates command, but you nonetheless do not think it is +from you, you can list a more precise pattern under an unalternates command.

-To remove a regular expression from the alternates list, use the -unalternates command with exactly the same regexp. -Likewise, if the regexp for an alternates command matches -an entry on the unalternates list, that unalternates -entry will be removed. If the regexp for unalternates -is “*”, all entries on alternates will be removed. -

12. Mailing lists

Usage:

lists [ +To remove a regular expression from the alternates list, use the +unalternates command with exactly the same regexp. +Likewise, if the regexp for an alternates command matches +an entry on the unalternates list, that unalternates +entry will be removed. If the regexp for unalternates +is “*”, all entries on alternates will be removed. +

12. Mailing Lists

Usage:

lists [ -group name ...] regexp [ regexp -...]

unlists [ +...]
unlists [ -group name ...] { * | regexp -... }

subscribe [ +... }
subscribe [ -group name ...] regexp [ regexp -...]

unsubscribe [ +...]
unsubscribe [ -group name ...] { @@ -632,8 +649,15 @@ is “*”, all entries

Mutt has a few nice features for handling mailing lists. In order to take advantage of them, you must specify which addresses belong to mailing lists, and which mailing -lists you are subscribed to. Once you have done this, the <list-reply> function will work for all known lists. -Additionally, when you send a message to a subscribed list, mutt will +lists you are subscribed to. Mutt also has limited support for +auto-detecting mailing lists: it supports parsing +mailto: links in the common +List-Post: header which has the same effect as +specifying the list address via the lists command +(except the group feature). Once you have done this, the +<list-reply> +function will work for all known lists. +Additionally, when you send a message to a subscribed list, Mutt will add a Mail-Followup-To header to tell other users' mail user agents not to send copies of replies to your personal address.

Note

@@ -641,30 +665,32 @@ The Mail-Followup-To header is a non-standard extension which is not supported by all mail user agents. Adding it is not bullet-proof against receiving personal CCs of list messages. Also note that the generation of the Mail-Followup-To header is controlled by the -$followup_to -configuration variable. +$followup_to +configuration variable since it's common practice on some mailing lists +to send Cc upons replies (which is more a group- than a list-reply).

More precisely, Mutt maintains lists of patterns for the addresses of known and subscribed mailing lists. Every subscribed mailing -list is known. To mark a mailing list as known, use the “lists” -command. To mark it as subscribed, use “subscribe”. +list is known. To mark a mailing list as known, use the list +command. To mark it as subscribed, use subscribe.

-You can use regular expressions with both commands. To mark all -messages sent to a specific bug report's address on mutt's bug +You can use regular expressions with both commands. To mark all +messages sent to a specific bug report's address on Debian's bug tracking system as list mail, for instance, you could say -“subscribe [0-9]*@bugs.guug.de”. Often, it's sufficient to just -give a portion of the list's e-mail address. +

+subscribe [0-9]*.*@bugs.debian.org

+as it's often, it's sufficient to just give a portion of the list's e-mail address.

Specify as much of the address as you need to to remove ambiguity. For example, if you've subscribed to the Mutt mailing list, you will receive mail -addressed to mutt-users@mutt.org. So, to tell Mutt -that this is a mailing list, you could add “lists mutt-users@” to your -initialization file. To tell mutt that you are subscribed to it, -add “subscribe mutt-users” to your initialization file instead. +addressed to mutt-users@mutt.org. So, to tell Mutt +that this is a mailing list, you could add lists mutt-users@ to your +initialization file. To tell Mutt that you are subscribed to it, +add subscribe mutt-users to your initialization file instead. If you also happen to get mail from someone whose address is -mutt-users@example.com, you could use -“lists ^mutt-users@mutt\\.org$” -or “subscribe ^mutt-users@mutt\\.org$” to +mutt-users@example.com, you could use +lists ^mutt-users@mutt\\.org$ +or subscribe ^mutt-users@mutt\\.org$ to match only mail from the actual list.

The -group flag adds all of the subsequent regular expressions @@ -675,8 +701,8 @@ known and subscribed mailing-lists. Use “unlists * tokens.

To remove a mailing list from the list of subscribed mailing lists, -but keep it on the list of known mailing lists, use “unsubscribe”. -

13. Using Multiple spool mailboxes

Usage:

mbox-hook +but keep it on the list of known mailing lists, use unsubscribe. +

13. Using Multiple Spool Mailboxes

Usage:

mbox-hook [!]pattern mailbox @@ -690,11 +716,11 @@ read. Unlike some of the other hook commands, only the first matching pattern is used (it is not possible to save read mail in more than a single mailbox). -

14. Monitoring incoming mail

Usage:

mailboxes +

14. Monitoring Incoming Mail

Usage:

mailboxes mailbox [ mailbox -...]

unmailboxes { +...]
unmailboxes { * | mailbox @@ -705,7 +731,7 @@ which will be checked for new messages periodically. folder can either be a local file or directory (Mbox/Mmdf or Maildir/Mh). If Mutt was built with POP and/or IMAP support, folder can also be a POP/IMAP folder -URL. The URL syntax is described in Section 1.2, “URL syntax”, +URL. The URL syntax is described in Section 1.2, “URL Syntax”, POP and IMAP are described in Section 3, “POP3 Support” and Section 4, “IMAP Support” respectively.

@@ -718,13 +744,13 @@ The “unmailboxes” command is used to remove a tok of folders which receive mail. Use “unmailboxes *” to remove all tokens.

Note

-The folders in the mailboxes command are resolved when +The folders in the mailboxes command are resolved when the command is executed, so if these names contain shortcut characters (such as “=” and “!”), any variable -definition that affects these characters (like $folder and $spoolfile) -should be set before the mailboxes command. If +definition that affects these characters (like $folder and $spoolfile) +should be set before the mailboxes command. If none of these shorcuts are used, a local path should be absolute as -otherwise mutt tries to find it relative to the directory -from where mutt was started which may not always be desired. +otherwise Mutt tries to find it relative to the directory +from where Mutt was started which may not always be desired.

For Mbox and Mmdf folders, new mail is detected by comparing access and/or modification times of files: Mutt assumes a folder has new mail if it wasn't @@ -737,42 +763,42 @@ access time update support.

In cases where new mail detection for Mbox or Mmdf folders appears to be unreliable, the -$check_mbox_size +$check_mbox_size option can be used to make Mutt track and consult file sizes for new -mail detection instead. -

15. User defined headers

Usage:

my_hdr +mail detection instead which won't work for size-neutral changes. +

15. User-Defined Headers

Usage:

my_hdr string -

unmy_hdr { +
unmy_hdr { * | field ... }

-The my_hdr command allows you to create your own header -fields which will be added to every message you send. +The my_hdr command allows you to create your own header +fields which will be added to every message you send and appear in the +editor if $edit_headers is set.

For example, if you would like to add an “Organization:” header field to -all of your outgoing messages, you can put the command -

Example 3.10. Defining custom headers

+all of your outgoing messages, you can put the command something like
+shown in Example 3.11, “Defining custom headers” in your .muttrc.
+

Example 3.11. Defining custom headers

 my_hdr Organization: A Really Big Company, Anytown, USA
-

-in your .muttrc. -

Note

+


Note

Space characters are not allowed between the keyword and the colon (“:”). The standard for electronic mail (RFC2822) says that space is illegal there, so Mutt enforces the rule.

If you would like to add a header field to a single message, you should -either set the $edit_headers variable, +either set the $edit_headers variable, or use the <edit-headers> function (default: “E”) in the compose menu so that you can edit the header of your message along with the body.

-To remove user defined header fields, use the unmy_hdr +To remove user defined header fields, use the unmy_hdr command. You may specify an asterisk (“*”) to remove all header fields, or the fields to remove. For example, to remove all “To” and “Cc” header fields, you could use:

 unmy_hdr to cc
-

16. Specify default save mailbox

Usage:

save-hook +

16. Specify Default Save Mailbox

Usage:

save-hook [!]pattern mailbox @@ -783,11 +809,9 @@ matches pattern, see

To provide more flexibility and good defaults, Mutt applies the -expandos of $index_format to +expandos of $index_format to mailbox after it was expanded. -

-Examples: -

Example 3.11. Using %-expandos in save-hook

+

Example 3.12. Using %-expandos in save-hook

 # default: save all to ~/Mail/<author name>
 save-hook . ~/Mail/%F
 
@@ -797,46 +821,44 @@ save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins
 # save from aol.com to $folder/spam
 save-hook aol\\.com$ +spam
 

-Also see the fcc-save-hook command. -

17. Specify default Fcc: mailbox when composing

Usage:

fcc-hook +Also see the fcc-save-hook command. +

17. Specify Default Fcc: Mailbox When Composing

Usage:

fcc-hook [!]pattern mailbox

This command is used to save outgoing mail in a mailbox other than -$record. Mutt searches the initial list of +$record. Mutt searches the initial list of message recipients for the first matching regexp and uses mailbox as the default Fcc: mailbox. If no match is found the message will be saved -to $record mailbox. +to $record mailbox.

To provide more flexibility and good defaults, Mutt applies the -expandos of $index_format to +expandos of $index_format to mailbox after it was expanded.

See Message Matching in Hooks for information on the exact format of pattern. -

-Example: fcc-hook [@.]aol\\.com$ +spammers -

-The above will save a copy of all messages going to the aol.com domain to -the `+spammers' mailbox by default. Also see the fcc-save-hook command. -

18. Specify default save filename and default Fcc: mailbox at once

Usage:

fcc-save-hook +

fcc-hook [@.]aol\\.com$ +spammers

+...will save a copy of all messages going to the aol.com domain to +the `+spammers' mailbox by default. Also see the fcc-save-hook command. +

18. Specify Default Save Filename and Default Fcc: Mailbox at Once

Usage:

fcc-save-hook [!]pattern mailbox

-This command is a shortcut, equivalent to doing both a fcc-hook -and a save-hook with its arguments, +This command is a shortcut, equivalent to doing both a fcc-hook +and a save-hook with its arguments, including %-expansion on mailbox according -to $index_format. -

19. Change settings based upon message recipients

Usage:

reply-hook +to $index_format. +

19. Change Settings Based Upon Message Recipients

Usage:

reply-hook [!]pattern command -

send-hook +
send-hook [!]pattern command -

send2-hook +
send2-hook [!]pattern command @@ -846,38 +868,40 @@ upon recipients of the message. pattern the message, see Message Matching in Hooks for details. command is executed when pattern matches.

-reply-hook is matched against the message you are replying to, -instead of the message you are sending. send-hook is +reply-hook is matched against the message you are replying to, +instead of the message you are sending. send-hook is matched against all messages, both new and replies.

Note

-reply-hooks are matched before the send-hook, regardless +reply-hooks are matched before the send-hook, regardless of the order specified in the user's configuration file.

-send2-hook is matched every time a message is changed, either +send2-hook is matched every time a message is changed, either by editing it, or by using the compose menu to change its recipients -or subject. send2-hook is executed after send-hook, and -can, e.g., be used to set parameters such as the $sendmail variable depending on the message's sender +or subject. send2-hook is executed after send-hook, and +can, e.g., be used to set parameters such as the $sendmail variable depending on the message's sender address.

-For each type of send-hook or reply-hook, when multiple matches -occur, commands are executed in the order they are specified in the muttrc +For each type of send-hook or reply-hook, when multiple matches +occur, commands are executed in the order they are specified in the .muttrc (for that type of hook).

-Example: send-hook mutt "set mime_forward signature=''" +Example: send-hook mutt "set mime_forward signature=''"

Another typical use for this command is to change the values of the -$attribution, $signature and $locale +$attribution, $signature and $locale variables in order to change the language of the attributions and signatures based upon the recipients.

Note

-send-hook's are only executed once after getting the initial -list of recipients. Adding a recipient after replying or editing the -message will not cause any send-hook to be executed. Also note that -my_hdr commands which modify recipient headers, or the message's -subject, don't have any effect on the current message when executed -from a send-hook. -

20. Change settings before formatting a message

Usage:

message-hook +send-hook's are only executed once after getting the +initial list of recipients. Adding a recipient after replying or +editing the message will not cause any send-hook to be executed, +similarily if $autoedit is set +(as then the initial list of recipients is empty). Also note that my_hdr commands which +modify recipient headers, or the message's subject, don't have any +effect on the current message when executed from a +send-hook. +

20. Change Settings Before Formatting a Message

Usage:

message-hook [!]pattern command @@ -886,7 +910,7 @@ This command can be used to execute arbitrary configuration commands before viewing or formatting a message based upon information about the message. command is executed if the pattern matches the message to be displayed. When multiple matches occur, commands are executed in the order -they are specified in the muttrc. +they are specified in the .muttrc.

See Message Matching in Hooks for information on the exact format of pattern. @@ -895,7 +919,7 @@ Example:

 message-hook ~A 'set pager=builtin'
 message-hook '~f freshmeat-news' 'set pager="less \"+/^  subject: .*\""'
-

21. Choosing the cryptographic key of the recipient

Usage:

crypt-hook +

21. Choosing the Cryptographic Key of the Recipient

Usage:

crypt-hook pattern keyid @@ -904,76 +928,77 @@ When encrypting messages with PGP/GnuPG or OpenSSL, you may want to associate a key with a given e-mail address automatically, either because the recipient's public key can't be deduced from the destination address, or because, for some reasons, you need to override the key Mutt would -normally use. The crypt-hook command provides a +normally use. The crypt-hook command provides a method by which you can specify the ID of the public key to be used when encrypting messages to a certain recipient.

The meaning of keyid is to be taken broadly in this context: You can either put a numerical key ID here, an e-mail address, or even just a real name. -

22. Adding key sequences to the keyboard buffer

Usage:

push +

22. Adding Key Sequences to the Keyboard Buffer

Usage:

push string

This command adds the named string to the keyboard buffer. The string may contain control characters, key names and function names like the sequence -string in the macro command. You may use it to +string in the macro command. You may use it to automatically run a sequence of commands at startup, or when entering -certain folders. For example, the following command will automatically -collapse all threads when entering a folder: -

Example 3.12. Embedding push in folder-hook

+certain folders. For example, Example 3.13, “Embedding push in folder-hook”
+shows how to automatically collapse all threads when entering a folder.
+

Example 3.13. Embedding push in folder-hook

 folder-hook . 'push <collapse-all>'
-

23. Executing functions

Usage:

exec +


23. Executing Functions

Usage:

exec function [ function ...]

This command can be used to execute any function. Functions are listed in the function reference. -“exec function” is equivalent to “push <function>”. +“execfunction” is equivalent to +“push <function>”.

24. Message Scoring

Usage:

score pattern value -

unscore { +
unscore { * | pattern ... }

-The score commands adds value to a message's score if pattern +The score commands adds value to a message's score if pattern matches it. pattern is a string in the format described in the patterns section (note: For efficiency reasons, patterns which scan information not available in the index, such as ˜b, ˜B or ˜h, may not be used). value is a positive or negative integer. A message's final score is the sum total of all -matching score entries. However, you may optionally prefix value with -an equal sign (=) to cause evaluation to stop at a particular entry if there is +matching score entries. However, you may optionally prefix value with +an equal sign (“=”) to cause evaluation to stop at a particular entry if there is a match. Negative final scores are rounded up to 0.

-The unscore command removes score entries from the list. You must -specify the same pattern specified in the score command for it to be +The unscore command removes score entries from the list. You must +specify the same pattern specified in the score command for it to be removed. The pattern “*” is a special token which means to clear the list of all score entries. -

25. Spam detection

Usage:

spam +

25. Spam Detection

Usage:

spam pattern format -

nospam { +
nospam { * | pattern }

Mutt has generalized support for external spam-scoring filters. -By defining your spam patterns with the spam and nospam +By defining your spam patterns with the spam and nospam commands, you can limit, search, and sort your mail based on its spam attributes, as determined by the external filter. You also can display the spam attributes in your index -display using the %H selector in the $index_format variable. (Tip: try %?H?[%H] ? +display using the %H selector in the $index_format variable. (Tip: try %?H?[%H] ? to display spam tags only when they are defined for a given message.)

Your first step is to define your external filter's spam patterns using -the spam command. pattern should be a regular expression +the spam command. pattern should be a regular expression that matches a header in a mail message. If any message in the mailbox matches this regular expression, it will receive a “spam tag” or -“spam attribute” (unless it also matches a nospam pattern -- see +“spam attribute” (unless it also matches a nospam pattern — see below.) The appearance of this attribute is entirely up to you, and is governed by the format parameter. format can be any static text, but it also can include back-references from the pattern @@ -981,96 +1006,134 @@ expression. (A regular expression “back-reference sub-expression contained within parentheses.) %1 is replaced with the first back-reference in the regex, %2 with the second, etc.

+To match spam tags, mutt needs the corresponding header information +which is always the case for local and POP folders but not for IMAP in +the default configuration. Depending on the spam header to be analyzed, +$imap_headers may need +to be adjusted. +

If you're using multiple spam filters, a message can have more than -one spam-related header. You can define spam patterns for each +one spam-related header. You can define spam patterns for each filter you use. If a message matches two or more of these patterns, and -the $spam_separator variable is set to a string, then the +the $spam_separator variable is set to a string, then the message's spam tag will consist of all the format strings joined -together, with the value of $spam_separator separating +together, with the value of $spam_separator separating them.

-For example, suppose I use DCC, SpamAssassin, and PureMessage. I might -define these spam settings: -

Example 3.13. Configuring spam detection

+For example, suppose one uses DCC, SpamAssassin, and PureMessage, then
+the configuration might look like in Example 3.14, “Configuring spam detection”.
+

Example 3.14. Configuring spam detection

 spam "X-DCC-.*-Metrics:.*(....)=many"         "90+/DCC-%1"
 spam "X-Spam-Status: Yes"                     "90+/SA"
 spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
 set spam_separator=", "
 

-If I then received a message that DCC registered with “many” hits +If then a message is received that DCC registered with “many” hits under the “Fuz2” checksum, and that PureMessage registered with a 97% probability of being spam, that message's spam tag would read 90+/DCC-Fuz2, 97/PM. (The four characters before “=many” in a -DCC report indicate the checksum used -- in this case, “Fuz2”.) +DCC report indicate the checksum used — in this case, “Fuz2”.)

-If the $spam_separator variable is unset, then each +If the $spam_separator variable is unset, then each spam pattern match supersedes the previous one. Instead of getting joined format strings, you'll get only the last one to match.

The spam tag is what will be displayed in the index when you use -%H in the $index_format variable. It's also the +%H in the $index_format variable. It's also the string that the ˜H pattern-matching expression matches against for <search> and <limit> functions. And it's what sorting by spam attribute will use as a sort key.

That's a pretty complicated example, and most people's actual environments will have only one spam filter. The simpler your -configuration, the more effective mutt can be, especially when it comes +configuration, the more effective Mutt can be, especially when it comes to sorting.

-Generally, when you sort by spam tag, mutt will sort lexically -- +Generally, when you sort by spam tag, Mutt will sort lexically — that is, by ordering strings alphanumerically. However, if a spam tag -begins with a number, mutt will sort numerically first, and lexically +begins with a number, Mutt will sort numerically first, and lexically only when two numbers are equal in value. (This is like UNIX's -sort -n.) A message with no spam attributes at all -- that is, one -that didn't match any of your spam patterns -- is sorted at +sort -n.) A message with no spam attributes at all — that is, one +that didn't match any of your spam patterns — is sorted at lowest priority. Numbers are sorted next, beginning with 0 and ranging upward. Finally, non-numeric strings are sorted, with “a” taking lower priority than “z”. Clearly, in general, sorting by spam tags is most effective when you can coerce your filter to give you a raw number. But -in case you can't, mutt can still do something useful. +in case you can't, Mutt can still do something useful.

-The nospam command can be used to write exceptions to spam -patterns. If a header pattern matches something in a spam command, +The nospam command can be used to write exceptions to spam +patterns. If a header pattern matches something in a spam command, but you nonetheless do not want it to receive a spam tag, you can list a -more precise pattern under a nospam command. +more precise pattern under a nospam command.

-If the pattern given to nospam is exactly the same as the -pattern on an existing spam list entry, the effect will be to +If the pattern given to nospam is exactly the same as the +pattern on an existing spam list entry, the effect will be to remove the entry from the spam list, instead of adding an exception. -Likewise, if the pattern for a spam command matches an entry -on the nospam list, that nospam entry will be removed. If the -pattern for nospam is “*”, all entries on both lists -will be removed. This might be the default action if you use spam -and nospam in conjunction with a folder-hook. -

-You can have as many spam or nospam commands as you like. -You can even do your own primitive spam detection within mutt -- for +Likewise, if the pattern for a spam command matches an entry +on the nospam list, that nospam entry will be removed. If the +pattern for nospam is “*”, all entries on both lists +will be removed. This might be the default action if you use spam +and nospam in conjunction with a folder-hook. +

+You can have as many spam or nospam commands as you like. +You can even do your own primitive spam detection within Mutt — for example, if you consider all mail from MAILER-DAEMON to be spam, -you can use a spam command like this: +you can use a spam command like this:

 spam "^From: .*MAILER-DAEMON"       "999"
-

26. Setting and Querying Variables

26.1. Commands

+

26. Setting and Querying Variables

26.1. Variable Types

+Mutt supports these types of configuration variables: +

boolean

+A boolean expression, either “yes” or “no”. +

number

+A signed integer number in the range -32768 to 32767. +

string

+Arbitrary text. +

path

+A specialized string for representing paths including support for +mailbox shortcuts (see Section 7, “Mailbox Shortcuts”) as well as tilde +(“˜”) for a user's home directory and more. +

quadoption

+Like a boolean but triggers a prompt when set to “ask-yes” +or “ask-no” with “yes” and “no” +preselected respectively. +

sort order

+A specialized string allowing only particular words as values depending +on the variable. +

regular expression

+A regular expression, see Section 1, “Regular Expressions” for an introduction. +

folder magic

+Specifies the type of folder to use: mbox, +mmdf, mh +or maildir. +Currently only used to determine the type for newly created folders. +

e-mail address

+An e-mail address either with or without +realname. The older “user@example.org (Joe User)” +form is supported but strongly deprecated. +

user-defined

+Arbitrary text, see Section 26.3, “User-Defined Variables” for details. +

26.2. Commands

The following commands are available to manipulate and query variables:

Usage:

set { [ no | inv ] variable | variable=value - } [...]

toggle + } [...]
toggle variable [ variable -...]

unset +...]
unset variable [ variable -...]

reset +...]
reset variable [ variable ...]

-This command is used to set (and unset) configuration variables. There are four basic types of variables: +This command is used to set (and unset) configuration variables. There are four basic types of variables: boolean, number, string and quadoption. boolean variables can be set (true) or unset (false). number variables can be assigned a positive integer value. @@ -1085,16 +1148,16 @@ action to be carried out as if you had answered “no.ask-yes will cause a prompt with a default answer of “yes” and ask-no will provide a default answer of “no.”

-Prefixing a variable with “no” will unset it. Example: set noaskbcc. +Prefixing a variable with “no” will unset it. Example: set noaskbcc.

For boolean variables, you may optionally prefix the variable name with inv to toggle the value (on or off). This is useful when writing -macros. Example: set invsmart_wrap. +macros. Example: set invsmart_wrap.

-The toggle command automatically prepends the inv prefix to all +The toggle command automatically prepends the inv prefix to all specified variables.

-The unset command automatically prepends the no prefix to all +The unset command automatically prepends the no prefix to all specified variables.

Using the <enter-command> function in the index menu, you can query the @@ -1106,23 +1169,23 @@ set ?allow_8bit The question mark is actually only required for boolean and quadoption variables.

-The reset command resets all given variables to the compile time +The reset command resets all given variables to the compile time defaults (hopefully mentioned in this manual). If you use the command -set and prefix the variable with “&” this has the same -behavior as the reset command. +set and prefix the variable with “&” this has the same +behavior as the reset command.

-With the reset command there exists the special variable “all”, +With the reset command there exists the special variable “all”, which allows you to reset all variables to their system defaults. -

26.2. User-defined variables

26.2.1. Introduction

+

26.3. User-Defined Variables

26.3.1. Introduction

Along with the variables listed in the -Configuration variables section, mutt +Configuration variables section, Mutt supports user-defined variables with names starting with my_ as in, for example, my_cfgdir.

-The set command either creates a +The set command either creates a custom my_ variable or changes its -value if it does exist already. The unset and reset +value if it does exist already. The unset and reset commands remove the variable entirely.

Since user-defined variables are expanded in the same way that @@ -1130,10 +1193,10 @@ environment variables are (except for the shell-escape command and backtick expansion), this feature can be used to make configuration files more readable. -

26.2.2. Examples

+

26.3.2. Examples

The following example defines and uses the variable my_cfgdir -to abbreviate the calls of the source command: -

Example 3.14. Using user-defined variables for config file readability

+to abbreviate the calls of the source command:
+

Example 3.15. Using user-defined variables for config file readability

 set my_cfgdir = $HOME/mutt/config
 
 source $my_cfgdir/hooks
@@ -1142,26 +1205,26 @@ source $my_cfgdir/macros
 

A custom variable can also be used in macros to backup the current value of another variable. In the following example, the value of the -$delete is changed temporarily +$delete is changed temporarily while its original value is saved as my_delete. -After the macro has executed all commands, the original value of $delete is restored. -

Example 3.15. Using user-defined variables for backing up other config option values

+After the macro has executed all commands, the original value of $delete is restored.
+

Example 3.16. Using user-defined variables for backing up other config option values

 macro pager ,x '\
 <enter-command>set my_delete=$delete<enter>\
 <enter-command>set delete=yes<enter>\
 ...\
 <enter-command>set delete=$my_delete<enter>'
 

-Since mutt expands such values already when parsing the configuration +Since Mutt expands such values already when parsing the configuration file(s), the value of $my_delete in the -last example would be the value of $delete exactly +last example would be the value of $delete exactly as it was at that point during parsing the configuration file. If -another statement would change the value for $delete +another statement would change the value for $delete later in the same or another file, it would have no effect on $my_delete. However, the expansion can be deferred to runtime, as shown in the next example, when escaping the dollar sign. -

Example 3.16. Deferring user-defined variable expansion to runtime

+

Example 3.17. Deferring user-defined variable expansion to runtime

 macro pager <PageDown> "\
 <enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
 <next-page>\
@@ -1170,9 +1233,9 @@ macro pager <PageDown> "\
 

Note that there is a space between <enter-command> and -the set configuration command, preventing mutt from -recording the macro's commands into its history. -

27. Reading initialization commands from another file

Usage:

source +the set configuration command, preventing Mutt from +recording the macro's commands into its history. +

27. Reading Initialization Commands From Another File

Usage:

source filename

This command allows the inclusion of initialization commands @@ -1183,10 +1246,10 @@ from other files. For example, I place all of my aliases in If the filename begins with a tilde (“˜”), it will be expanded to the path of your home directory.

-If the filename ends with a vertical bar (|), then filename is +If the filename ends with a vertical bar (“|”), then filename is considered to be an executable program from which to read input (eg. -source ˜/bin/myscript|). -

28. Removing hooks

Usage:

unhook { +source ˜/bin/myscript|). +

28. Removing Hooks

Usage:

unhook { * | hook-type @@ -1194,58 +1257,82 @@ considered to be an executable program from which to read input (eg. This command permits you to flush hooks you have previously defined. You can either remove all hooks by giving the “*” character as an argument, or you can remove all hooks of a specific type by saying -something like unhook send-hook. +something like unhook send-hook.

29. Format Strings

29.1. Basic usage

Format strings are a general concept you'll find in several locations -through the mutt configuration, especially in the -$index_format, -$pager_format, -$status_format, -and other “*_format” variables. These can be very straightforward, +through the Mutt configuration, especially in the +$index_format, +$pager_format, +$status_format, +and other related variables. These can be very straightforward, and it's quite possible you already know how to use them.

The most basic format string element is a percent symbol followed by another character. For example, %s -represents a message's Subject: header in the $index_format variable. The +represents a message's Subject: header in the $index_format variable. The “expandos” available are documented with each format variable, but there are general modifiers available with all formatting expandos, too. Those are our concern here.

Some of the modifiers are borrowed right out of C (though you might know them from Perl, Python, shell, or another language). These are -the [-]m.n modifiers, as in %-12.12s. As with +the [-]m.n modifiers, as in %-12.12s. As with such programming languages, these modifiers allow you to specify the minimum and maximum size of the resulting string, as well as its justification. If the “-” sign follows the percent, the string will be left-justified instead of right-justified. If there's a number immediately following that, it's the minimum amount of space the -formatted string will occupy -- if it's naturally smaller than that, it +formatted string will occupy — if it's naturally smaller than that, it will be padded out with spaces. If a decimal point and another number -follow, that's the maximum space allowable -- the string will not be +follow, that's the maximum space allowable — the string will not be permitted to exceed that width, no matter its natural size. Each of these three elements is optional, so that all these are legal format -strings: -%-12s -%4c -%.15F -%-12.15L +strings: %-12s, %4c, +%.15F and %-12.15L.

Mutt adds some other modifiers to format strings. If you use an equals symbol (=) as a numeric prefix (like the minus above), it will force the string to be centered within its minimum space range. For example, %=14y will reserve 14 -characters for the %y expansion -- that's the X-Label: header, in -$index_format. If the expansion +characters for the %y expansion — that's the X-Label: header, in +$index_format. If the expansion results in a string less than 14 characters, it will be centered in a -14-character space. If the X-Label for a message were "test", that -expansion would look like “ test ”. +14-character space. If the X-Label for a message were “test”, that +expansion would look like “     test     ”.

There are two very little-known modifiers that affect the way that an expando is replaced. If there is an underline (“_”) character between any format modifiers (as above) and the expando letter, it will expands in all lower case. And if you use a colon (“:”), it will replace all decimal points with underlines. -

29.2. Filters

+

29.2. Conditionals

+Depending on the format string variable, some of its sequences can be +used to optionally print a string if their value is nonzero. For +example, you may only want to see the number of flagged messages if such +messages exist, since zero is not particularly meaningful. To optionally +print a string based upon one of the above sequences, the following +construct is used: +

+%?<sequence_char>?<optional_string>?

+where sequence_char is an expando, and +optional_string is the string you would like printed if +sequence_char is nonzero. +optional_string may contain other +sequences as well as normal text, but you may not nest optional +strings. +

+Here is an example illustrating how to optionally print the number of +new messages in a mailbox in +$status_format: +

+%?n?%n new messages.?

+You can also switch between two strings using the following construct: +

+%?<sequence_char>?<if_string>&<else_string>?

+If the value of sequence_char is +non-zero, if_string will be expanded, +otherwise else_string will be expanded. +

29.3. Filters

Any format string ending in a vertical bar (“|”) will be expanded and piped through the first word in the string, using spaces as separator. The string returned will be used for display. @@ -1255,10 +1342,10 @@ replacement format string including % expandos.

All % expandos in a format string are expanded before the script is called so that: -

Example 3.17. Using external filters in format strings

+

Example 3.18. Using external filters in format strings

 set status_format="script.sh '%r %f (%L)'|"
 

-will make mutt expand %r, +will make Mutt expand %r, %f and %L before calling the script. The example also shows that arguments can be quoted: the script will receive the expanded string between the single quotes @@ -1266,7 +1353,40 @@ as the only argument.

A practical example is the mutt_xtitle script installed in the samples -subdirectory of the mutt documentation: it can be used as filter for -$status_format to set the current +subdirectory of the Mutt documentation: it can be used as filter for +$status_format to set the current terminal's title, if supported. -

+

29.4. Padding

+In most format strings, Mutt supports different types of padding using +special %-expandos: +

%|X

+When this occurs, Mutt will fill the rest of the +line with the character X. For +example, filling the rest of the line with dashes is +done by setting: +

+set status_format = "%v on %h: %B: %?n?%n&no? new messages %|-"
+%>X +

+Since the previous expando stops at the end of line, there must be a way +to fill the gap between two items via the %>X +expando: it puts as many characters X in between two +items so that the rest of the line will be right-justified. For example, +to not put the version string and hostname the above example on the left +but on the right and fill the gap with spaces, one might use (note the +space after %>): +

+set status_format = "%B: %?n?%n&no? new messages %> (%v on %h)"
%*X +

+Normal right-justification will print everything to the left of the +%>, displaying padding and whatever lies to the +right only if there's room. By contrast, “soft-fill” gives +priority to the right-hand side, guaranteeing space to display it and +showing padding only if there's still room. If necessary, soft-fill will +eat text leftwards to make room for rightward text. For example, to +right-justify the subject making sure as much as possible of it fits on +screen, one might use (note two spaces after %* +: the second ensures there's a space between the truncated +right-hand side and the subject): +

+set index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?)%*  %s"