]> granicus.if.org Git - neomutt/commitdiff
improve virtual_mailboxes command, update docs
authorKarel Zak <kzak@redhat.com>
Tue, 3 Jan 2012 11:31:42 +0000 (12:31 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 15:30:04 +0000 (16:30 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
README.notmuch
buffy.c

index c93616c44d6b094286e582c1a3e56afa13502e54..cd7a1ee1dc2d51fd66f0fd474f1f84ad18cc7d08 100644 (file)
@@ -81,6 +81,10 @@ notmuch support for mutt
 
  * muttrc:
 
+   Note that you can use notmuch specific mutt config file, see -F <config> in
+   mutt docs.
+
+
    virtual-mailboxes <description> <uri> [ ...]
 
       This command specifies one or more virtual folder. The folders are
@@ -146,3 +150,85 @@ notmuch support for mutt
       message. This command will be useful when you have a new email ion your INBOX
       and you want to see the rest of the archived thread.
 
+
+* .muttrc example:
+
+       set nm_default_uri="notmuch:///home/kzak/Mail/Maildir"
+       set virtual_spoolfile   = yes
+
+       virtual-mailboxes \
+          "INBOX"                "notmuch://?query=tag:inbox and NOT tag:archive" \
+          "Util-linux"           "notmuch://?query=tag:ul and NOT tag:archive" \
+          "Bugs"                 "notmuch://?query=tag:bug NOT tag:archive" \
+          "RH"                   "notmuch://?query=tag:rh and NOT tag:archive" \
+          "Fedora"               "notmuch://?query=tag:fed and NOT tag:archive" \
+          "Linux"                "notmuch://?query=tag:lk and NOT tag:archive" \
+          "NFS"                  "notmuch://?query=tag:nfs and NOT tag:archive" \
+          "Filesystems"          "notmuch://?query=tag:fs and NOT tag:archive" \
+          "Security"             "notmuch://?query=tag:sec" \
+          "Partitioning"         "notmuch://?query=tag:part" \
+          "GNU"                  "notmuch://?query=tag:gnu" \
+          "udev"                 "notmuch://?query=tag:udev" \
+          "initrd"               "notmuch://?query=tag:initrd" \
+          "Linux CZ"             "notmuch://?query=tag:cz" \
+          "Notmuch"              "notmuch://?query=tag:nm" \
+          "Procps"               "notmuch://?query=tag:proc" \
+       \
+          " Util-linux  [archive]" "notmuch://?query=tag:ul and tag:archive" \
+          " Bugs        [archive]" "notmuch://?query=tag:bug and tag:archive" \
+          " RH          [archive]" "notmuch://?query=tag:rh and tag:archive" \
+          " Fedora      [archive]" "notmuch://?query=tag:fed and tag:archive" \
+          " Linux       [archive]" "notmuch://?query=tag:lk and tag:archive" \
+          " Filesystems [archive]" "notmuch://?query=tag:fs and tag:archive" \
+
+       macro index A "<modify-labels-then-hide>+archive -inbox\n<sync-mailbox>"
+       macro index I "<modify-labels-then-hide>-inbox\n<sync-mailbox>"
+
+       # mark emails for git-am
+       # (e.g. "git am -i -3 $(notmuch search --output=files tag:PATCH)"
+       #
+       macro index P "<modify-labels>PATCH\n"
+       macro index <Esc>P "<modify-labels>-PATCH\n"
+
+
+* .procmailrc example:
+
+       NOINBOX="-r inbox"
+
+       ### Add 'kw' (keyword) tag to all interesting e-mails and make the emails
+       ### visible in inbox.
+       :0
+       * ^Subject:.*(mount|umount|libmount|losetup|util-linux|blkid|hwclock|mkswap|fdisk|parted|partition|gpt|topology)
+       {
+               TAGS="-t kw"
+               NOINBOX=""
+       }
+
+       ### Lists
+
+       :0:notmuch.lock
+       * ^List-Id:.*linux.linux.cz
+       | notmuch-deliver $NOINBOX -t cz $TAGS linux.cz
+
+       :0:notmuch.lock
+       * ^X-Mailing-List:.*util-linux@vger.kernel.org
+       | notmuch-deliver -t ul $TAGS util-linux
+
+       :0:notmuch.lock
+       * ^List-Id:.*parted-devel.lists.alioth.debian.org
+       | notmuch-deliver $NOINBOX -t part $TAGS parted
+
+       ### [...cut to make the example short...] ###
+
+       ### All unmatched mails
+       :0:notmuch.lock
+       * ^From
+       | notmuch-deliver $TAGS misc
+
+       ### fallback if notmuch does not work
+       :0:
+       * ^From
+       Mail/Maildir/misc/
+
+
+
diff --git a/buffy.c b/buffy.c
index 5697c6d7c79aec7e7dd7c1a8d0a1202319309783..03a20fc6dbe9592fd403fd7e4cdb1550da09de83 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -387,11 +387,22 @@ int mutt_parse_virtual_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, B
 
   while (MoreArgs (s))
   {
+    char *desc;
+
+    mutt_extract_token (path, s, 0);
+    if (path->data && *path->data)
+      desc = safe_strdup( path->data);
+    else
+      continue;
+
     mutt_extract_token (path, s, 0);
     strfcpy (buf, path->data, sizeof (buf));
 
     /* Skip empty tokens. */
-    if(!*buf) continue;
+    if(!*buf) {
+           FREE(&desc);
+           continue;
+    }
 
     /* avoid duplicates */
     for (tmp = &VirtIncoming; *tmp; tmp = &((*tmp)->next))
@@ -406,14 +417,11 @@ int mutt_parse_virtual_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, B
     if (!*tmp)
       *tmp = buffy_new (buf);
 
-    mutt_extract_token (path, s, 0);
-    if (path->data && *path->data)
-      (*tmp)->desc = safe_strdup( path->data);
-
     (*tmp)->new = 0;
     (*tmp)->notified = 1;
     (*tmp)->newly_created = 0;
     (*tmp)->size = 0;
+    (*tmp)->desc = desc;
   }
   return 0;
 }