RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
authorFranz Fellner <alpine.art.de@gmail.com>
Mon, 20 Oct 2014 19:30:46 +0000 (21:30 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:05:25 +0000 (10:05 -0800)
ad/cd05e135179a1b0d02ea4b2400b461bddc4e1c [new file with mode: 0644]

diff --git a/ad/cd05e135179a1b0d02ea4b2400b461bddc4e1c b/ad/cd05e135179a1b0d02ea4b2400b461bddc4e1c
new file mode 100644 (file)
index 0000000..1c1a5a2
--- /dev/null
@@ -0,0 +1,112 @@
+Return-Path: <alpine.art.de@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 12E78431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 12:30:41 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id NarNoymHCfPB for <notmuch@notmuchmail.org>;\r
+       Mon, 20 Oct 2014 12:30:37 -0700 (PDT)\r
+Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com\r
+       [209.85.217.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id DCA4E431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 12:30:36 -0700 (PDT)\r
+Received: by mail-lb0-f177.google.com with SMTP id w7so4502667lbi.36\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 12:30:35 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=date:from:to:message-id:in-reply-to:references:subject:mime-version\r
+       :content-type:content-transfer-encoding;\r
+       bh=V5Iljf0RWDAjpuSxV+iFShMqnEBD7FKTly97+dnsPcc=;\r
+       b=Nn/tLGBfIkYily0zHzcTdr3YGyteyufimkWuBpYks9P9OckTwcyr/hFIHu1OTJgtL4\r
+       GMl0dOZNqOHq3grhR9T5qGvJiX1RHp9r1O5jkfqI6zMrdlfE3SAxkcy0h8j8tEmaUbUw\r
+       fu1G2YoR9x4bkh7sfKPnn4cbotKmT0FU4Yc66OEbhJyP2ZrzXuAwcuaZbpm4VJu4rTji\r
+       jU6PkZ7Ot3F2EcCoEY1Ci6y0vKfVNol3qqIrla4eIP4XrLdPZ+MSS5kJkBY0fzX+GqcR\r
+       F140C8NKgNdCgmoSWbCCit9M977JjAgxDrRjX7znk9TWE0fhP9ISR4jxZaGqVD4cEObU\r
+       AT8w==\r
+X-Received: by 10.152.25.130 with SMTP id c2mr11614565lag.80.1413833435352;\r
+       Mon, 20 Oct 2014 12:30:35 -0700 (PDT)\r
+Received: from localhost (p5B00FFDE.dip0.t-ipconnect.de. [91.0.255.222])\r
+       by mx.google.com with ESMTPSA id\r
+       ju20sm3608028lab.14.2014.10.20.12.30.33 for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Mon, 20 Oct 2014 12:30:34 -0700 (PDT)\r
+Date: Mon, 20 Oct 2014 21:30:46 +0200\r
+From: Franz Fellner <alpine.art.de@gmail.com>\r
+To: Franz Fellner <alpine.art.de@gmail.com>, \r
+ notmuch@notmuchmail.org\r
+Message-ID: <544562e67550f_25b371be9894@TP_L520.notmuch>\r
+In-Reply-To: <20141017180750.GE20696@TP_L520.localdomain>\r
+References: <20141017180750.GE20696@TP_L520.localdomain>\r
+Subject: RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config\r
+Mime-Version: 1.0\r
+Content-Type: text/plain;\r
+ charset=utf-8\r
+Content-Transfer-Encoding: 7bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 Oct 2014 19:30:41 -0000\r
+\r
+Exclude mails tagged with any tag specified in\r
+notmuch config get search.exclude_tags\r
+in folders list and search list.\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index 5c86fcd..522a366 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -647,6 +647,7 @@ ruby << EOF\r
+       $db_name = nil\r
+       $all_emails = []\r
+       $email = $email_name = $email_address = nil\r
++      $exclude_tags = []\r
+       $searches = []\r
+       $threads = []\r
+       $messages = []\r
+@@ -672,6 +673,8 @@ ruby << EOF\r
+               # Add the primary to this too as we use it for checking\r
+               # addresses when doing a reply\r
+               $all_emails.unshift($email_address)\r
++              ignore_tags = get_config_item('search.exclude_tags')\r
++              $exclude_tags = ignore_tags.split("\n")\r
+       end\r
\r
+       def vim_puts(s)\r
+@@ -859,6 +862,9 @@ ruby << EOF\r
+                       end\r
+                       folders.each do |name, search|\r
+                               q = $curbuf.query(search)\r
++                              $exclude_tags.each { |t|\r
++                                      q.add_tag_exclude(t)\r
++                              }\r
+                               $searches << search\r
+                               count = count_threads ? q.search_threads.count : q.search_messages.count\r
+                               if name == ''\r
+@@ -874,6 +880,9 @@ ruby << EOF\r
+               date_fmt = VIM::evaluate('g:notmuch_date_format')\r
+               q = $curbuf.query(search)\r
+               q.sort = Notmuch::SORT_NEWEST_FIRST\r
++              $exclude_tags.each { |t|\r
++                      q.add_tag_exclude(t)\r
++              }\r
+               $threads.clear\r
+               t = q.search_threads\r
\r