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