Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] Gmail Labels Sidebar
Date: Fri, 12 Jun 2009 12:10:27 -0700	[thread overview]
Message-ID: <1244833003-sup-9212@entry> (raw)
In-Reply-To: <1244556424-sup-1426@tomsk>

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 <wmorgan-sup at masanjin.net>


  parent reply	other threads:[~2009-06-12 19:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09  0:37 Andrei Thorp
2009-06-09  1:05 ` Ben Walton
2009-06-09  2:14   ` Edward Z. Yang
2009-06-09  2:24     ` Ben Walton
2009-06-09 13:33       ` Andrei Thorp
2009-06-09 13:42         ` Andrei Thorp
2009-06-12 19:14           ` William Morgan
2009-06-09 14:11         ` Marcus Williams
2009-06-09 14:24           ` Marcus Williams
     [not found]             ` <80055d7c0906090735x581d27a2pfeb3ca2d470bb099@mail.gmail.com>
2009-06-09 14:37               ` [sup-talk] Fwd: " Andrei Thorp
2009-06-09 14:29           ` [sup-talk] " Marcus Williams
2009-06-12 19:10           ` William Morgan [this message]
2009-06-12 20:18             ` Marcus Williams
2009-06-12 18:56       ` William Morgan
2009-06-12 19:03         ` Andrei Thorp

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244833003-sup-9212@entry \
    --to=wmorgan-sup@masanjin.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox