All the specs allow for inserting user defined specifiers—‘u’.
The next character in the format string should be a letter. Gnus
will call the function gnus-user-format-function-
‘X’, where
‘X’ is the letter following ‘%u’. The function will be passed
a single parameter—what the parameter means depends on what buffer
it’s being called from. The function should return a string, which will
be inserted into the buffer just like information from any other
specifier. This function may also be called with dummy values, so it
should protect against that.
Also Gnus supports extended user-defined specs, such as ‘%u&foo;’.
Gnus will call the function gnus-user-format-function-
‘foo’.
You can also use tilde modifiers (see Advanced Formatting to achieve much the same without defining new functions. Here’s an example: ‘%~(form (count-lines (point-min) (point)))@’. The form given here will be evaluated to yield the current line number, and then inserted.