aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranz Fellner <alpine.art.de@gmail.com>2015-01-22 13:52:47 +0100
committerDavid Bremner <david@tethera.net>2015-01-22 20:34:31 +0100
commit9d4ff29ad86e24d0cc3500ca1d0ef2ab91cde222 (patch)
treeec7b0b2a42a255ab601a500a88506c076c683525
parentd241a486facf1002b29e499c2fb96a302bfd825b (diff)
VIM: Respect exclude_tags specified in .notmuch-config
Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list.
-rw-r--r--vim/notmuch.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index cad95178..cb6695a8 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -477,6 +477,7 @@ ruby << EOF
$db_name = nil
$email = $email_name = $email_address = nil
+ $exclude_tags = []
$searches = []
$threads = []
$messages = []
@@ -496,6 +497,8 @@ ruby << EOF
$email_address = get_config_item('user.primary_email')
$email_name = get_config_item('user.name')
$email = "%s <%s>" % [$email_name, $email_address]
+ ignore_tags = get_config_item('search.exclude_tags')
+ $exclude_tags = ignore_tags.split("\n")
end
def vim_puts(s)
@@ -637,6 +640,9 @@ ruby << EOF
$searches.clear
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
b << "%9d %-20s (%s)" % [count, name, search]
@@ -648,6 +654,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