- do_read do |db|
- q = db.query(get_cur_view)
- q.sort = 0
- msgs = q.search_messages
- msgs.each do |msg|
- m = Mail.read(msg.filename)
- part = m.find_first_text
- nm_m = Message.new(msg, m)
- $messages << nm_m
- date_fmt = VIM::evaluate('g:notmuch_rb_datetime_format')
- date = Time.at(msg.date).strftime(date_fmt)
- nm_m.start = b.count
- b << "%s %s (%s)" % [msg['from'], date, msg.tags]
- b << "Subject: %s" % [msg['subject']]
- b << "To: %s" % msg['to']
- b << "Cc: %s" % msg['cc']
- b << "Date: %s" % msg['date']
- nm_m.body_start = b.count
- b << "--- %s ---" % part.mime_type
- part.convert.each_line do |l|
- b << l.chomp
- end
- b << ""
- nm_m.end = b.count
+ q = $curbuf.query(get_cur_view)
+ q.sort = Notmuch::SORT_OLDEST_FIRST
+ msgs = q.search_messages
+ msgs.each do |msg|
+ m = Mail.read(msg.filename)
+ part = m.find_first_text
+ nm_m = Message.new(msg, m)
+ $messages << nm_m
+ date_fmt = VIM::evaluate('g:notmuch_rb_datetime_format')
+ date = Time.at(msg.date).strftime(date_fmt)
+ nm_m.start = b.count
+ b << "%s %s (%s)" % [msg['from'], date, msg.tags]
+ b << "Subject: %s" % [msg['subject']]
+ b << "To: %s" % msg['to']
+ b << "Cc: %s" % msg['cc']
+ b << "Date: %s" % msg['date']
+ nm_m.body_start = b.count
+ b << "--- %s ---" % part.mime_type
+ part.convert.each_line do |l|
+ b << l.chomp