Mode Line Formatting Formatting Variables User-Defined Specs
It is frequently useful to post-process the fields in some way.
Padding, limiting, cutting off parts and suppressing certain values can
be achieved by using tilde modifiers. A typical tilde spec might
look like `%~(cut 3)~(ignore "0")y
'.
These are the valid modifiers:
pad
pad-left
|
Pad the field to the left with spaces until it reaches the required length. |
pad-right
|
Pad the field to the right with spaces until it reaches the required length. |
max
max-left
|
Cut off characters from the left until it reaches the specified length. |
max-right
|
Cut off characters from the right until it reaches the specified length. |
cut
cut-left
|
Cut off the specified number of characters from the left. |
cut-right
|
Cut off the specified number of characters from the right. |
ignore
|
Return an empty string if the field is equal to the specified value. |
form
|
Use the specified form as the field value when the ` |
Let's take an example. The `%o
' spec in the summary mode lines
will return a date in compact ISO8601 format---`19960809T230410
'.
This is quite a mouthful, so we want to shave off the century number and
the time, leaving us with a six-character date. That would be
`%~(cut-left 2)~(max-right 6)~(pad 6)o
'. (Cutting is done before
maxing, and we need the padding to ensure that the date is never less
than 6 characters to make it look nice in columns.)
Ignoring is done first; then cutting; then maxing; and then as the very last operation, padding.
If you use lots of these advanced thingies, you'll find that Gnus gets quite slow. This can be helped enormously by running M-x gnus-compile when you are satisfied with the look of your lines. See Compilation.
Mode Line Formatting Formatting Variables User-Defined Specs