]> git.notmuchmail.org Git - notmuch/blobdiff - vim/notmuch.vim
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / vim / notmuch.vim
index cad95178e29d18c4b142b5bc5948c6253f3a4b8a..c1c2f63d20178dab69f92c9ff9aab4631dda6ee5 100644 (file)
@@ -317,6 +317,9 @@ ruby << EOF
        $curbuf.render do |b|
                q = $curbuf.query(get_cur_view)
                q.sort = Notmuch::SORT_OLDEST_FIRST
+               $exclude_tags.each { |t|
+                       q.add_tag_exclude(t)
+               }
                msgs = q.search_messages
                msgs.each do |msg|
                        m = Mail.read(msg.filename)
@@ -477,6 +480,7 @@ ruby << EOF
 
        $db_name = nil
        $email = $email_name = $email_address = nil
+       $exclude_tags = []
        $searches = []
        $threads = []
        $messages = []
@@ -496,6 +500,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,8 +643,11 @@ 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
+                               count = count_threads ? q.count_threads : q.count_messages
                                b << "%9d %-20s (%s)" % [count, name, search]
                        end
                end
@@ -648,6 +657,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
 
@@ -657,7 +669,7 @@ ruby << EOF
                                date = Time.at(e.newest_date).strftime(date_fmt)
                                subject = e.messages.first['subject']
                                if $mail_installed
-                                       subject = Mail::Field.new("Subject: " + subject).to_s
+                                       subject = Mail::Field.parse("Subject: " + subject).to_s
                                else
                                        subject = subject.force_encoding('utf-8')
                                end