From: Karel Zak Date: Tue, 3 Jan 2012 11:31:42 +0000 (+0100) Subject: improve virtual_mailboxes command, update docs X-Git-Tag: neomutt-20160404~13^2~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85441d7eae227463ef76ce625a49c92b5fd07ba9;p=neomutt improve virtual_mailboxes command, update docs Signed-off-by: Karel Zak --- diff --git a/README.notmuch b/README.notmuch index c93616c44..cd7a1ee1d 100644 --- a/README.notmuch +++ b/README.notmuch @@ -81,6 +81,10 @@ notmuch support for mutt * muttrc: + Note that you can use notmuch specific mutt config file, see -F in + mutt docs. + + virtual-mailboxes [ ...] 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 "+archive -inbox\n" + macro index I "-inbox\n" + + # mark emails for git-am + # (e.g. "git am -i -3 $(notmuch search --output=files tag:PATCH)" + # + macro index P "PATCH\n" + macro index P "-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 5697c6d7c..03a20fc6d 100644 --- 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; }