From: David Sterba Date: Sat, 1 Sep 2012 07:31:54 +0000 (+0200) Subject: format: support optional modifier for g (notmuch labels) X-Git-Tag: neomutt-20160404~13^2~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3aa28265dbb1a3406c3bb19e93e71f83058a4ac;p=neomutt format: support optional modifier for g (notmuch labels) Used in index_format like this %?g?(%g)? will show nothing if there are no notmuch labels, eg. in mixed mail setups. Signed-off-by: David Sterba --- diff --git a/hdrline.c b/hdrline.c index 1b27d4637..50f2966d9 100644 --- a/hdrline.c +++ b/hdrline.c @@ -591,7 +591,10 @@ hdr_format_str (char *dest, break; #ifdef USE_NOTMUCH case 'g': - mutt_format_s (dest, destlen, prefix, nm_header_get_tags(hdr)); + if (!optional) + mutt_format_s (dest, destlen, prefix, nm_header_get_tags(hdr)); + else if (!nm_header_get_tags(hdr)) + optional = 0; break; #endif case 'H': diff --git a/init.h b/init.h index 9145100ec..50f93a846 100644 --- a/init.h +++ b/init.h @@ -1316,6 +1316,7 @@ struct option_t MuttVars[] = { ** .dt %E .dd number of messages in current thread ** .dt %f .dd sender (address + real name), either From: or Return-Path: ** .dt %F .dd author name, or recipient name if the message is from you + ** .dt %g .dd message labels (e.g. notmuch tags) ** .dt %H .dd spam attribute(s) of this message ** .dt %i .dd message-id of the current message ** .dt %l .dd number of lines in the message (does not work with maildir,