vim: show first message of the thread
authorFelipe Contreras <felipe.contreras@gmail.com>
Sat, 12 Oct 2013 09:33:06 +0000 (04:33 -0500)
committerFelipe Contreras <felipe.contreras@gmail.com>
Wed, 20 Nov 2013 13:23:29 +0000 (07:23 -0600)
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
vim/notmuch.vim

index 72bf73b312e9a30ab661849f94a12eb2cd7008f9..11ea4fd363467865e973a0571b18c9c7bfcc39c6 100644 (file)
@@ -557,6 +557,7 @@ ruby << EOF
        def search_render(search)
                date_fmt = VIM::evaluate('g:notmuch_rb_date_format')
                q = $curbuf.query(search)
+               q.sort = Notmuch::SORT_NEWEST_FIRST
                $threads.clear
                t = q.search_threads
 
@@ -564,10 +565,11 @@ ruby << EOF
                        items.each do |e|
                                authors = e.authors.to_utf8.split(/[,|]/).map { |a| author_filter(a) }.join(",")
                                date = Time.at(e.newest_date).strftime(date_fmt)
+                               subject = e.messages.first['subject']
                                if $mail_installed
-                                       subject = Mail::Field.new("Subject: " + e.subject).to_s
+                                       subject = Mail::Field.new("Subject: " + subject).to_s
                                else
-                                       subject = e.subject.force_encoding('utf-8')
+                                       subject = subject.force_encoding('utf-8')
                                end
                                b << "%-12s %3s %-20.20s | %s (%s)" % [date, e.matched_messages, authors, subject, e.tags]
                                $threads << e.thread_id