| | 3258 | </para> |
| | 3259 | |
| | 3260 | </sect1> |
| | 3261 | |
| | 3262 | <sect1 id="formatstrings"> |
| | 3263 | <title>Format Strings</title> |
| | 3264 | |
| | 3265 | <para> |
| | 3266 | Format strings are a general concept you'll find in several locations |
| | 3267 | through the mutt configuration, especially in the |
| | 3268 | <link linkend="index-format">$index_format"</link>, |
| | 3269 | <link linkend="pager-format">$pager_format"</link>, |
| | 3270 | <link linkend="status-format">$status_format"</link>, |
| | 3271 | and other ``*_format'' variables. These can be very straightforward, |
| | 3272 | and it's quite possible you already know how to use them. |
| | 3273 | </para> |
| | 3274 | |
| | 3275 | <para> |
| | 3276 | The most basic format string element is a percent symbol followed |
| | 3277 | by another character. For example, <literal>%s</literal> |
| | 3278 | represents a message's Subject: header in the <link |
| | 3279 | linkend="index-format">$index_format"</link> variable. The |
| | 3280 | ``expandos'' available are documented with each format variable, but |
| | 3281 | there are general modifiers available with all formatting expandos, |
| | 3282 | too. Those are our concern here. |
| | 3283 | </para> |
| | 3284 | |
| | 3285 | <para> |
| | 3286 | Some of the modifers are borrowed right out of C (though you might |
| | 3287 | know them from Perl, Python, shell, or another langugage). These are |
| | 3288 | the [-]m.n modifiers, as in <literal>%-12.12s</literal>. As with |
| | 3289 | such programming languages, these modifiers allow you to specify the |
| | 3290 | minumum and maximum size of the resulting string, as well as its |
| | 3291 | justification. If the ``-'' sign follows the percent, the string will |
| | 3292 | be left-justified instead of right-justified. If there's a number |
| | 3293 | immediately following that, it's the minimum amount of space the |
| | 3294 | formatted string will occupy -- if it's naturally smaller than that, it |
| | 3295 | will be padded out with spaces. If a decimal point and another number |
| | 3296 | follow, that's the maximum space allowable -- the string will not be |
| | 3297 | permitted to exceed that width, no matter its natural size. Each of |
| | 3298 | these three elements is optional, so that all these are legal format |
| | 3299 | strings: |
| | 3300 | <literal>%-12s</literal> |
| | 3301 | <literal>%4c</literal> |
| | 3302 | <literal>%.15F</literal> |
| | 3303 | <literal>%-12.15L</literal> |
| | 3304 | </para> |
| | 3305 | |
| | 3306 | <para> |
| | 3307 | Mutt adds some other modifiers to format strings. If you use an equals |
| | 3308 | symbol (<literal>=</literal>) as a numeric prefix (like the minus |
| | 3309 | above), it will force the string to be centered within its minimum |
| | 3310 | space range. For example, <literal>%=14y</literal> will reserve 14 |
| | 3311 | characters for the %y expansion -- that's the X-Label: header, in |
| | 3312 | <literal>$index_format</literal>. If the expansion |
| | 3313 | results in a string less than 14 characters, it will be centered in a |
| | 3314 | 14-character space. If the X-Label for a message were "test", that |
| | 3315 | expansion would look like `` test ''. |
| | 3316 | </para> |
| | 3317 | |
| | 3318 | <para> |
| | 3319 | There are two very little-known modifiers that affect the way that an |
| | 3320 | expando is replaced. If there is an underline (``_'') character |
| | 3321 | between any format modifiers (as above) and the expando letter, it will |
| | 3322 | expands in all lower case. And if you use a colon (``:''), it will |
| | 3323 | replace all decimal points with underlines. |