add $CHECK as message format string

$CHECK will be replaced with a small 'x' if the message is selected or a
whitespace if not.
add count_selected_messages primitive

This primitive will return the number of selected messages