]> granicus.if.org Git - neomutt/commitdiff
index_format: add support of %K (#452)
authorKevin Decherf <kevin@kdecherf.com>
Fri, 17 Mar 2017 02:34:20 +0000 (03:34 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 17 Mar 2017 02:34:20 +0000 (02:34 +0000)
Unlike %B, %K will remain empty if there is no list detected for the
message.

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
hdrline.c
init.h

index 3e90bbfe0fb814c4e3c9ec539c5465c7e35bc3d1..5e38a3083e2368d6cce7c8c81538a4745da45fb0 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -420,7 +420,7 @@ static char *apply_subject_mods (ENVELOPE *env)
 /* %a = address of author
  * %A = reply-to address (if present; otherwise: address of author
  * %b = filename of the originating folder
- * %B = the list to which the letter was sent
+ * %B = the list to which the letter was sent, or else the folder name (%b).
  * %c = size of message in bytes
  * %C = current message number
  * %d = date and time of message using $date_format and sender's timezone
@@ -433,6 +433,7 @@ static char *apply_subject_mods (ENVELOPE *env)
  * %g = message labels (e.g. notmuch tags)
  * %i = message-id
  * %I = initials of author
+ * %K = the list to which the letter was sent (if any; otherwise: empty)
  * %l = number of lines in the message
  * %L = like %F, except `lists' are displayed first
  * %m = number of messages in the mailbox
@@ -524,6 +525,7 @@ hdr_format_str (char *dest,
       break;
 
     case 'B':
+    case 'K':
       if (!first_mailing_list (dest, destlen, hdr->env->to) &&
          !first_mailing_list (dest, destlen, hdr->env->cc))
        dest[0] = 0;
@@ -533,6 +535,13 @@ hdr_format_str (char *dest,
        mutt_format_s (dest, destlen, prefix, buf2);
        break;
       }
+      if (op == 'K')
+      {
+        if (optional)
+          optional = 0;
+        /* break if 'K' returns nothing */
+        break;
+      }
       /* fall through if 'B' returns nothing */
 
     case 'b':
diff --git a/init.h b/init.h
index 4980957118e7517f77747f9a8c6a610f062cf4ed..11ea140b048268758ac2a5cbc4ab5aaddc77d3fe 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1460,6 +1460,7 @@ struct option_t MuttVars[] = {
   ** .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 %K .dd the list to which the letter was sent (if any; otherwise: empty).
   ** .dt %l .dd number of lines in the message (does not work with maildir,
   **            mh, and possibly IMAP folders)
   ** .dt %L .dd If an address in the ``To:'' or ``Cc:'' header field matches an address