From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads
Date: Mon, 28 Jan 2013 17:52:19 +0200 [thread overview]
Message-ID: <1359388340-27136-5-git-send-email-kirill@shutemov.name> (raw)
In-Reply-To: <1359388340-27136-1-git-send-email-kirill@shutemov.name>
From: "Kirill A. Shutemov" <kirill@shutemov.name>
If the option set, folders list shows count of threads, not messages
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
notmuch-ruby.vim | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index 81da9b3..cda5df4 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -53,6 +53,7 @@ let s:notmuch_rb_date_format_default = '%d.%m.%y'
let s:notmuch_rb_datetime_format_default = '%d.%m.%y %H:%M:%S'
let s:notmuch_rb_reader_default = 'terminal -e "mutt -f %s"'
let s:notmuch_rb_sendmail_default = '/usr/sbin/sendmail'
+let s:notmuch_rb_folders_count_threads_default = 0
if !exists('g:notmuch_rb_date_format')
let g:notmuch_rb_date_format = s:notmuch_rb_date_format_default
@@ -70,6 +71,10 @@ if !exists('g:notmuch_rb_sendmail')
let g:notmuch_rb_sendmail = s:notmuch_rb_sendmail_default
endif
+if !exists('g:notmuch_rb_folders_count_threads')
+ let g:notmuch_rb_folders_count_threads = s:notmuch_rb_folders_count_threads_default
+endif
+
function! s:new_file_buffer(type, fname)
exec printf('edit %s', a:fname)
execute printf('set filetype=notmuch-%s', a:type)
@@ -536,12 +541,15 @@ ruby << EOF
def folders_render()
$curbuf.render do |b|
folders = VIM::evaluate('g:notmuch_rb_folders')
+ count_threads = VIM::evaluate('g:notmuch_rb_folders_count_threads')
$searches.clear
do_read do |db|
folders.each do |name, search|
q = db.query(search)
$searches << search
- b << "%9d %-20s (%s)" % [q.search_messages.count, name, search]
+ count = count_threads == 0 ?
+ q.search_messages.count : q.search_threads.count
+ b << "%9d %-20s (%s)" % [count, name, search]
end
end
end
--
1.7.10.4
next prev parent reply other threads:[~2013-01-28 15:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
2013-01-28 15:52 ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Kirill A. Shutemov
2013-04-02 19:31 ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail Kirill A. Shutemov
2013-04-02 19:21 ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail Kirill A. Shutemov
2013-04-02 19:33 ` Felipe Contreras
2013-01-28 15:52 ` Kirill A. Shutemov [this message]
2013-04-02 19:39 ` [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads Felipe Contreras
2013-01-28 15:52 ` [PATCH 5/5] Drop harmful reply buffer preparation Kirill A. Shutemov
2013-04-02 19:46 ` Felipe Contreras
2013-01-28 18:09 ` [PATCH 0/5] Random patches for notmuch-vim-ruby David Bremner
2013-04-02 19:52 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359388340-27136-5-git-send-email-kirill@shutemov.name \
--to=kirill@shutemov.name \
--cc=felipe.contreras@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).