From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Fri, 12 Jun 2009 12:10:27 -0700 Subject: [sup-talk] Gmail Labels Sidebar In-Reply-To: <1244556424-sup-1426@tomsk> References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com> <1244509454-sup-1208@ntdws12.chass.utoronto.ca> <1244513641-sup-360@javelin> <1244514031-sup-2335@ntdws12.chass.utoronto.ca> <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com> <1244556424-sup-1426@tomsk> Message-ID: <1244833003-sup-9212@entry> Reformatted excerpts from Marcus Williams's message of 2009-06-09: > William - if you want to add this to sup/bin feel free. Its basically > the regen_text method lifted and edited slightly from the > label-list-mode Nice idea. I'd add such a thing, but I think you can make it significantly simpler. (As you point out, locking the index is not necessary.) Something like: #!/usr/bin/env ruby require 'sup' i = Redwood::Index.new; i.load l = Redwood::LabelManager.new File.join(ENV["HOME"], ".sup", "labels.txt") l.all_labels. map { |label| [label, l.string_for(label)] }. sort_by { |label, name| name }. each do |label, name| total = i.num_results_for :label => label unread = (label == :unread)? total : i.num_results_for(:labels => [label, :unread]) printf "%20s: %6d messages, %6d unread\n", name, total, unread end puts "yay" -- William