From tero@tilus.net Fri Jan 1 08:19:45 2010 From: tero@tilus.net (Tero Tilus) Date: Fri, 01 Jan 2010 15:19:45 +0200 Subject: [sup-devel] [PATCH] XapianIndex.each_message_in_thread_for yields messages in cronological order In-Reply-To: <1262287125-sup-5933@masanjin.net> References: <1261485246-sup-4236@tilus.net> <1261938751-sup-9421@zyrg.net> <1262136474-sup-312@tilus.net> <1262182085-sup-1405@masanjin.net> <1262190807-sup-434@zyrg.net> <1262287125-sup-5933@masanjin.net> Message-ID: <1262345828-sup-6789@tilus.net> William Morgan, 2009-12-31 21:41: > Out of curiousity, Tero, could the problem also be solved by giving > the in-reply-to header precedence over the references header? Well, yes and no. ;) I think what it needs is to do is a) consider only the first message in In-reply-to: (like it already does), b) prioritize In-reply-to: ahead of References: (like it already does!) and c) if In-reply-to: would create a loop or diamond, resolve by dropping another link ("topmost" conflicting?) and keep the one from In-reply-to: (currently it drops the link suggested by In-reply-to: over another potentially coming from (messed up) References:). Lemme speculate on this a bit. Current threading implementation tries to give In-reply-to: precedence over References: but it still could leave the (in my previous mail described way) malformed References: affecting the real root of the thread. By the time we encounter the In-reply-to: headers which would need to take precedence over the References:, there could already be bogus parent to the root. Say we have First (no In-reply-to: or References:) +- Second (In-reply-to: First; References: First) +- Third (In-reply-to: Second, First; no References:) +- Fourth (In-reply-to: Third; References: Second, First, Third) If Third is a reply to both Second and First (in that order). Then Fourth might have References: Second, First, Third. If, when threading, Fourth is the first processed message then First is seen as a reply to Second. Now when itself Second is processed, the In-reply-to: in it would create a loop and is discarded, (see ThreadSet#link). Resulting in Second +- First +- Third +- Fourth which is exactly what the example headers I posted seem to produce (real root jumps in the middle of one of the branches). -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ From wmorgan-sup@masanjin.net Fri Jan 1 10:13:08 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Fri, 01 Jan 2010 07:13:08 -0800 Subject: [sup-devel] [PATCH] fixed am/pm in thread-list-mode for ruby1.8 In-Reply-To: <1262297415-sup-6997@changeling.local> References: <1262270484-sup-8396@changeling.local> <1262289195-sup-4420@masanjin.net> <1262289317-sup-7991@changeling.local> <1262290432-sup-9868@masanjin.net> <1262293338-sup-9364@changeling.local> <1262294449-sup-8418@localdomain> <1262297415-sup-6997@changeling.local> Message-ID: <1262358668-sup-7399@masanjin.net> Reformatted excerpts from Eric Sherman's message of 2009-12-31: > Hmm. Maybe this issue only exists on OSX. I suspect so. Can you provide a patch that uses the downcase trick and doesn't check for the ruby version or the OS? (Maybe with a helpful comment.) That should work everywhere, lame as it may be. -- William From sup-bugs@masanjin.net Fri Jan 1 14:05:26 2010 From: sup-bugs@masanjin.net (William Morgan) Date: Fri, 01 Jan 2010 19:05:26 +0000 Subject: [sup-devel] [issue40] ruby 1.9: lockfile gem failure In-Reply-To: <1262372726.5.0.155183041676.issue40@masanjin.net> Message-ID: <1262372726.5.0.155183041676.issue40@masanjin.net> New submission from William Morgan : If the lock file is there, the lockfile gem dies with this error: $XXX/ruby/gems/1.9.1/gems/lockfile-1.4.3/lib/lockfile.rb:475:in `load_lock_id': undefined method `each' for # (NoMethodError) It appears the gem is not 1.9-ready, so we'll need to work around it somehow. ---------- messages: 102 nosy: w priority: bug ruby_version: 1.9.1 status: unread sup_version: git title: ruby 1.9: lockfile gem failure _________________________________________ Sup issue tracker _________________________________________ From wmorgan-sup@masanjin.net Fri Jan 1 14:09:09 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Fri, 01 Jan 2010 11:09:09 -0800 Subject: [sup-devel] Ruby 1.9 encoding fixes In-Reply-To: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262372864-sup-22@masanjin.net> Branch ruby-1.9-encoding, merged into next. Thank you very much! Using the xapian-full and ncursesw gems, I can now run Sup under 1.9, though there are a few warts (for some reason the secondary questions like "are you sure you want to quit?" aren't getting keystrokes.) Anyways, getting close! -- William From rlane@club.cc.cmu.edu Fri Jan 1 15:47:07 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 1 Jan 2010 12:47:07 -0800 Subject: [sup-devel] [PATCH] ruby 1.9: use String#ord in ask_getch and ask_yes_or_no Message-ID: <1262378827-16722-1-git-send-email-rlane@club.cc.cmu.edu> In Ruby 1.9, character literals and the return value from string index accesses are now themselves strings and need to be converted to integers with String#ord. This was breaking ask_getch. Integer#ord is defined on Ruby 1.8 so this won't cause problems there. --- lib/sup/buffer.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 4498b08..c826ab9 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -611,7 +611,7 @@ EOS def ask_getch question, accept=nil raise "impossible!" if @asking - accept = accept.split(//).map { |x| x[0] } if accept + accept = accept.split(//).map { |x| x.ord } if accept status, title = get_status_and_title @focus_buf Ncurses.sync do @@ -647,7 +647,7 @@ EOS ## returns true (y), false (n), or nil (ctrl-g / cancel) def ask_yes_or_no question case(r = ask_getch question, "ynYN") - when ?y, ?Y + when ?y.ord, ?Y.ord true when nil nil -- 1.6.3.3 From pi+sup@pihost.us Fri Jan 1 15:59:02 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Fri, 01 Jan 2010 13:59:02 -0700 Subject: [sup-devel] [PATCH 01/10] open mail source files as binary In-Reply-To: <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262378704-sup-5011@home.mrtheplague.net> Excerpts from Rich Lane's message of Thu Dec 31 16:36:49 -0700 2009: > diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb > index c2bd27a..0852576 100644 > --- a/lib/sup/maildir.rb > +++ b/lib/sup/maildir.rb > @@ -59,7 +59,7 @@ class Maildir < Source > File.stat(tmp_path) > rescue Errno::ENOENT #this is what we want. > begin > - File.open(tmp_path, 'w') do |f| > + File.open(tmp_path, 'wb:BINARY') do |f| > yield f #provide a writable interface for the caller This patch causes the following warning on Ruby 1.8: warning: encoding options not supported in 1.8: wb:BINARY Especially if you use Maildir for a source, the resulting torrent of warnings makes Sup a bit difficult to use. I've gone and reverted this diff locally for now. I suppose I could also stop running sup with the -w flag... From sup-bugs@masanjin.net Fri Jan 1 16:38:15 2010 From: sup-bugs@masanjin.net (anonymous) Date: Fri, 01 Jan 2010 21:38:15 +0000 Subject: [sup-devel] [issue41] killed threads don't show up in search In-Reply-To: <1262381895.96.0.844866246353.issue41@masanjin.net> Message-ID: <1262381895.96.0.844866246353.issue41@masanjin.net> New submission from anonymous: Killing threads works, but 'L' will only list the number of killed threads, when I navigate to the search it won't show anything. Same goes for a search: label:killed This is using Xapian ---------- messages: 103 nosy: anonymous priority: bug ruby_version: 1.8.7 status: unread sup_version: sup 0.9.1 title: killed threads don't show up in search _________________________________________ Sup issue tracker _________________________________________ From wmorgan-sup@masanjin.net Fri Jan 1 16:43:13 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Fri, 01 Jan 2010 13:43:13 -0800 Subject: [sup-devel] [PATCH 01/10] open mail source files as binary In-Reply-To: <1262378704-sup-5011@home.mrtheplague.net> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> <1262378704-sup-5011@home.mrtheplague.net> Message-ID: <1262382164-sup-4751@masanjin.net> Reformatted excerpts from Anthony Martinez's message of 2010-01-01: > Especially if you use Maildir for a source, the resulting torrent of > warnings makes Sup a bit difficult to use. > > I've gone and reverted this diff locally for now. I suppose I could > also stop running sup with the -w flag... I'm happy with either wrapping that whole thing in a RUBY_VERSION test, or mandating that thou shalt not run sup with -w. Votes? -- William From rlane@club.cc.cmu.edu Fri Jan 1 16:44:34 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 1 Jan 2010 13:44:34 -0800 Subject: [sup-devel] [PATCH] xapian: respect :skip_killed in each_message_in_thread_for Message-ID: <1262382274-24324-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/xapian_index.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index cebb148..955ec8f 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -127,7 +127,7 @@ EOS while not queue.empty? thread_id = queue.pop next if seen_threads.member? thread_id - return false if thread_killed? thread_id + return false if opts[:skip_killed] && thread_killed?(thread_id) seen_threads << thread_id docs = term_docids(mkterm(:thread, thread_id)).map { |x| @xapian.document x } docs.each do |doc| -- 1.6.3.3 From sup-bugs@masanjin.net Fri Jan 1 16:46:33 2010 From: sup-bugs@masanjin.net (anonymous) Date: Fri, 01 Jan 2010 21:46:33 +0000 Subject: [sup-devel] [issue42] --all-sources needs specifying of at least one source to work In-Reply-To: <1262382393.53.0.979430173798.issue42@masanjin.net> Message-ID: <1262382393.53.0.979430173798.issue42@masanjin.net> New submission from anonymous: sup-tweak-labels -r killed --all-sources Error: no sources specified. Try --help for help. or sup-tweak-labels all-sources -r killed which: no gpg in (/bin:/usr/bin:/sbin:/usr/sbin:/opt/kde/bin:/usr/bin/perlbin/site:/usr/bin/perlbi n/vendor:/usr/bin/perlbin/core:/opt/qt/bin) Error: Unknown source: all-sources. Did you add it with sup-add first?. Try --help for help. It's a bit annoying to have to specify an existing source to have --all-sources work. ---------- messages: 104 nosy: anonymous priority: bug ruby_version: 1.8.7 status: unread sup_version: 0.9.1 title: --all-sources needs specifying of at least one source to work _________________________________________ Sup issue tracker _________________________________________ From rlane@club.cc.cmu.edu Fri Jan 1 16:48:29 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 01 Jan 2010 16:48:29 -0500 Subject: [sup-devel] [PATCH 01/10] open mail source files as binary In-Reply-To: <1262382164-sup-4751@masanjin.net> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> <1262378704-sup-5011@home.mrtheplague.net> <1262382164-sup-4751@masanjin.net> Message-ID: <1262382312-sup-2326@zyrg.net> Excerpts from William Morgan's message of Fri Jan 01 16:43:13 -0500 2010: > Reformatted excerpts from Anthony Martinez's message of 2010-01-01: > > Especially if you use Maildir for a source, the resulting torrent of > > warnings makes Sup a bit difficult to use. > > > > I've gone and reverted this diff locally for now. I suppose I could > > also stop running sup with the -w flag... > > I'm happy with either wrapping that whole thing in a RUBY_VERSION test, > or mandating that thou shalt not run sup with -w. Votes? It doesn't sound very useful to have -w writing messages to the screen in an ncurses app. Could you redirect stderr to a file instead? Is it possible to do this from inside Sup? That warning's existence annoys me. I thought it was a feature that Ruby 1.8 ignored the encoding in the mode string. From wmorgan-sup@masanjin.net Fri Jan 1 16:57:33 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Fri, 01 Jan 2010 13:57:33 -0800 Subject: [sup-devel] [PATCH 01/10] open mail source files as binary In-Reply-To: <1262382312-sup-2326@zyrg.net> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> <1262378704-sup-5011@home.mrtheplague.net> <1262382164-sup-4751@masanjin.net> <1262382312-sup-2326@zyrg.net> Message-ID: <1262382906-sup-5813@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-01: > It doesn't sound very useful to have -w writing messages to the screen > in an ncurses app. Could you redirect stderr to a file instead? Is it > possible to do this from inside Sup? Some experimentation suggests we can do $stderr = File.open(File.join(BASE_DIR, "warnings.txt"), "w") and subsequent warns go to that file. At least, it works in irb. > That warning's existence annoys me. I thought it was a feature that > Ruby 1.8 ignored the encoding in the mode string. Yeah, lame. -- William From rlane@club.cc.cmu.edu Fri Jan 1 17:14:00 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 1 Jan 2010 14:14:00 -0800 Subject: [sup-devel] [PATCH] ruby 1.9: expect nil start_offset when an MBox::Loader is first created Message-ID: <1262384040-27801-1-git-send-email-rlane@club.cc.cmu.edu> Various callers (including sup-add) passed a nil start_offset. Through a convoluted path probably involving the fact that nil.to_i == 0, this did the right thing on Ruby 1.8. It crashes on 1.9, so change initialize to expect a nil offset and replace it with 0. --- lib/sup/mbox/loader.rb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb index 520e2ec..54d227d 100644 --- a/lib/sup/mbox/loader.rb +++ b/lib/sup/mbox/loader.rb @@ -12,7 +12,7 @@ class Loader < Source attr_reader :labels ## uri_or_fp is horrific. need to refactor. - def initialize uri_or_fp, start_offset=0, usual=true, archived=false, id=nil, labels=nil + def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, labels=nil @mutex = Mutex.new @labels = Set.new((labels || []) - LabelManager::RESERVED_LABELS) @@ -29,6 +29,7 @@ class Loader < Source @path = uri_or_fp.path end + start_offset ||= 0 super uri_or_fp, start_offset, usual, archived, id end -- 1.6.3.3 From pi+sup@pihost.us Fri Jan 1 20:16:20 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Fri, 01 Jan 2010 18:16:20 -0700 Subject: [sup-devel] [PATCH 01/10] open mail source files as binary In-Reply-To: <1262382164-sup-4751@masanjin.net> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> <1262378704-sup-5011@home.mrtheplague.net> <1262382164-sup-4751@masanjin.net> Message-ID: <1262394142-sup-2602@home.mrtheplague.net> Excerpts from William Morgan's message of Fri Jan 01 14:43:13 -0700 2010: > Reformatted excerpts from Anthony Martinez's message of 2010-01-01: > > Especially if you use Maildir for a source, the resulting torrent of > > warnings makes Sup a bit difficult to use. > > > > I've gone and reverted this diff locally for now. I suppose I could > > also stop running sup with the -w flag... > > I'm happy with either wrapping that whole thing in a RUBY_VERSION test, > or mandating that thou shalt not run sup with -w. Votes? Well... the only reason I ran it with warnings enabled to begin with: $ ack -a --nogroup ' -w' HACKING:6: ruby -I lib -w bin/sup I think redirecting stderr to .sup/warnings is the way to go. From rlane@club.cc.cmu.edu Fri Jan 1 22:30:40 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 1 Jan 2010 19:30:40 -0800 Subject: [sup-devel] [PATCH] switch default index to Xapian Message-ID: <1262403040-24105-1-git-send-email-rlane@club.cc.cmu.edu> Previous versions didn't add an :index entry in config.yaml, so preserve compatibility by using Ferret if no index is specified and the ferret directory exists. --- This patch is meant for 0.10. AFAIK the xapian index has feature-parity with ferret. There are a couple of issues remaining with queries: Names are stemmed and otherwise munged for convenient searching by Xapian::TermGenerator, while email addresses are stored verbatim. Xapian::QueryParser needs to do the same alterations to search terms, so the parser uses separate from_{name,email} fields. This is not user-friendly but could be worked around by having parse_query insert an OR over both fields where it sees a from: prefix (same for to). A more pernicious issue is that QueryParser defaults to AND if there isn't an explicit operator (which is what we want), but if there are multiple boolean (label/email) terms over the same field it will OR them. So, "label:sup label:patch" will result in the union instead of the intersection. Assuming we don't want to write our own query parser, this needs to be made configurable in Xapian. I took a stab at it a few months ago but didn't get anywhere. There's also the issue of long delays when flushing the index to disk on exit. One option is to keep the delay and log an info message saying what's going on. A second option is to set the XAPIAN_FLUSH_THRESHOLD environment variable to something low in bin/sup, which will limit the final delay but potentially cause short delays during normal use. A third option is to detect when the user has been idle for a while and flush the index then. We can easily fix the first and third issues before 0.10. Are there any others I've forgotten? lib/sup.rb | 5 +++-- lib/sup/index.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/sup.rb b/lib/sup.rb index 144f5e3..fa19de2 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -54,7 +54,7 @@ module Redwood YAML_DOMAIN = "masanjin.net" YAML_DATE = "2006-10-01" - DEFAULT_INDEX = 'ferret' + DEFAULT_INDEX = 'xapian' ## record exceptions thrown in threads nicely @exceptions = [] @@ -229,7 +229,8 @@ else :confirm_top_posting => true, :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", - :sent_source => "sup://sent" + :sent_source => "sup://sent", + :index => Redwood::DEFAULT_INDEX, } begin FileUtils.mkdir_p Redwood::BASE_DIR diff --git a/lib/sup/index.rb b/lib/sup/index.rb index 87d8d52..cc78292 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -174,7 +174,7 @@ class BaseIndex end end -index_name = ENV['SUP_INDEX'] || $config[:index] || DEFAULT_INDEX +index_name = ENV['SUP_INDEX'] || $config[:index] || (File.exists?(File.join(BASE_DIR, 'ferret')) ? 'ferret' : DEFAULT_INDEX) case index_name when "xapian"; require "sup/xapian_index" when "ferret"; require "sup/ferret_index" -- 1.6.3.3 From rlane@club.cc.cmu.edu Fri Jan 1 23:37:26 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 1 Jan 2010 20:37:26 -0800 Subject: [sup-devel] [PATCH] xapian: translate from/to query term prefixes to search over both name and email fields Message-ID: <1262407046-2029-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/xapian_index.rb | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index cebb148..c192b26 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -159,14 +159,15 @@ EOS subs = HookManager.run("custom-search", :subs => s) || s subs = subs.gsub(/\b(to|from):(\S+)\b/) do - field, name = $1, $2 - if(p = ContactManager.contact_for(name)) - [field, p.email] - elsif name == "me" - [field, "(" + AccountManager.user_emails.join("||") + ")"] + field, value = $1, $2 + email_field, name_field = %w(email name).map { |x| "#{field}_#{x}" } + if(p = ContactManager.contact_for(value)) + "#{email_field}:#{p.email}" + elsif value == "me" + '(' + AccountManager.user_emails.map { |e| "#{email_field}:#{e}" }.join(' OR ') + ')' else - [field, name] - end.join(":") + "(#{email_field}:#{value} OR #{name_field}:#{value})" + end end ## if we see a label:deleted or a label:spam term anywhere in the query @@ -250,6 +251,8 @@ EOS end end + debug "translated query: #{subs.inspect}" + qp = Xapian::QueryParser.new qp.database = @xapian qp.stemmer = Xapian::Stem.new(STEM_LANGUAGE) @@ -260,6 +263,8 @@ EOS BOOLEAN_PREFIX.each { |k,v| qp.add_boolean_prefix k, v } xapian_query = qp.parse_query(subs, Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_WILDCARD, PREFIX['body']) + debug "parsed xapian query: #{xapian_query.description}" + raise ParseError if xapian_query.nil? or xapian_query.empty? query[:qobj] = xapian_query query[:text] = s -- 1.6.3.3 From hyperbolist@gmail.com Sat Jan 2 00:14:05 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Sat, 02 Jan 2010 00:14:05 -0500 Subject: [sup-devel] [PATCH] fixed am/pm display for ruby 1.8 darwin (v2) Message-ID: <1262409241-sup-3697@changeling.local> --- lib/sup/util.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sup/util.rb b/lib/sup/util.rb index c27e527..206c18a 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -513,9 +513,9 @@ class Time strftime "%b %e" else if is_the_same_day? from - strftime("%l:%M%P") + strftime("%l:%M%p").downcase # emulate %P (missing on ruby 1.8 darwin) elsif is_the_day_before? from - "Yest." + nearest_hour.strftime("%l%P") + "Yest." + nearest_hour.strftime("%l%p").downcase # emulate %P else strftime "%b %e" end -- 1.6.5.7 From bburky@bburky.com Sat Jan 2 00:59:08 2010 From: bburky@bburky.com (Blake Burkhart) Date: Fri, 01 Jan 2010 23:59:08 -0600 Subject: [sup-devel] [PATCH] fixed am/pm in thread-list-mode for ruby1.8 In-Reply-To: <1262358668-sup-7399@masanjin.net> References: <1262270484-sup-8396@changeling.local> <1262289195-sup-4420@masanjin.net> <1262289317-sup-7991@changeling.local> <1262290432-sup-9868@masanjin.net> <1262293338-sup-9364@changeling.local> <1262294449-sup-8418@localdomain> <1262297415-sup-6997@changeling.local> <1262358668-sup-7399@masanjin.net> Message-ID: <1262410432-sup-3347@Backspace.local> Excerpts from William Morgan's message of Fri Jan 01 09:13:08 -0600 2010: > Reformatted excerpts from Eric Sherman's message of 2009-12-31: > > Hmm. Maybe this issue only exists on OSX. > > I suspect so. Can you provide a patch that uses the downcase trick and > doesn't check for the ruby version or the OS? (Maybe with a helpful > comment.) That should work everywhere, lame as it may be. I don't know if you need any more examples of this, but I'm running Mac OS 10.6, and can reproduce this with the three different versions of ruby I happen to have installed. Apple supplied ruby: $ /usr/bin/ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] $ /usr/bin/ruby -e 'puts Time.now().strftime("%l:%M%P")' 11:27P Ruby from the MacPorts package manager, patchlevel 174: $ ruby --version ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10] $ ruby -e 'puts Time.now().strftime("%l:%M%P")' 11:25P And [MacRuby][1], which is completely beta everything, but is 1.9: $ macruby --version MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64] $ macruby -e 'puts Time.now().strftime("%l:%M%P")' 11:25P I'm pretty sure that *should* work on MacRuby, but it's not. I think that's possibly their fault though. I guess I could report it as a bug to them then. I'm not really using that ruby version for anything, so I don't know how complete it is. [1]: http://www.macruby.org/ -- Blake Burkhart From hyperbolist@gmail.com Sat Jan 2 01:13:50 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Sat, 02 Jan 2010 01:13:50 -0500 Subject: [sup-devel] [PATCH] fixed am/pm in thread-list-mode for ruby1.8 In-Reply-To: <1262410432-sup-3347@Backspace.local> References: <1262270484-sup-8396@changeling.local> <1262289195-sup-4420@masanjin.net> <1262289317-sup-7991@changeling.local> <1262290432-sup-9868@masanjin.net> <1262293338-sup-9364@changeling.local> <1262294449-sup-8418@localdomain> <1262297415-sup-6997@changeling.local> <1262358668-sup-7399@masanjin.net> <1262410432-sup-3347@Backspace.local> Message-ID: <1262412365-sup-4135@changeling.local> Excerpts from Blake Burkhart's message of Sat Jan 02 00:59:08 -0500 2010: > Excerpts from William Morgan's message of Fri Jan 01 09:13:08 -0600 2010: > > I suspect so. Can you provide a patch that uses the downcase trick and > > doesn't check for the ruby version or the OS? (Maybe with a helpful > > comment.) That should work everywhere, lame as it may be. > > And [MacRuby][1], which is completely beta everything, but is 1.9: > $ macruby --version > MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64] > $ macruby -e 'puts Time.now().strftime("%l:%M%P")' > 11:25P > > I'm pretty sure that *should* work on MacRuby, but it's not. I think that's > possibly their fault though. I guess I could report it as a bug to them then. > I'm not really using that ruby version for anything, so I don't know how > complete it is. > > [1]: http://www.macruby.org/ I've resubmitted the patch in a new thread titled "[PATCH] fixed am/pm display for ruby 1.8 darwin (v2)", but like William says it should work everywhere including MacRuby because it just emulate's %P by downcase()ing %p. From rlane@club.cc.cmu.edu Sat Jan 2 11:42:15 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 2 Jan 2010 08:42:15 -0800 Subject: [sup-devel] [PATCH] force binary encoding before parsing decrypted messages Message-ID: <1262450535-5439-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/crypto.rb | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb index fb2661a..91652c7 100644 --- a/lib/sup/crypto.rb +++ b/lib/sup/crypto.rb @@ -130,6 +130,7 @@ class CryptoManager end output = IO.read output_fn.path + output.force_encoding Encoding::ASCII_8BIT if output.respond_to? :force_encoding ## there's probably a better way to do this, but we're using the output to ## look for a valid signature being present. @@ -157,6 +158,7 @@ class CryptoManager msg = RMail::Parser.read output if msg.header.content_type =~ %r{^multipart/} && !msg.multipart? output = "MIME-Version: 1.0\n" + output + output.force_encoding Encoding::ASCII_8BIT if output.respond_to? :force_encoding msg = RMail::Parser.read output end notice = Chunk::CryptoNotice.new :valid, "This message has been decrypted for display" -- 1.6.3.3 From rlane@club.cc.cmu.edu Sat Jan 2 18:50:00 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 2 Jan 2010 15:50:00 -0800 Subject: [sup-devel] [PATCH] support high colors in colors.yaml Message-ID: <1262476200-25885-1-git-send-email-rlane@club.cc.cmu.edu> Add constants for colors >15 so that they can be used in the colors config file. You can use integers for all available colors. If you're running xterm-256color or compatible you can use "cXYZ" for the 6x6x6 color cube and "gXY" for grayscale. --- Using `tput` might be bad if we support any platforms that don't have it. Somebody with more artistic talent should submit a nice colorscheme for contrib/. lib/sup/colormap.rb | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-) diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index c4a4024..dcae2d5 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -1,5 +1,23 @@ module Curses COLOR_DEFAULT = -1 + + NUM_COLORS = `tput colors`.to_i + MAX_PAIRS = `tput pairs`.to_i + + def self.color! name, value + const_set "COLOR_#{name.to_s.upcase}", value + end + + ## numeric colors + 0.upto(Curses::NUM_COLORS) { |x| color! x, x } + + if Curses::NUM_COLORS == 256 + ## xterm 6x6x6 color cube + 0.upto(5) { |x| 0.upto(5) { |y| 0.upto(5) { |z| color! "c#{x}#{y}#{z}", 16 + z + 6*y + 36*x } } } + + ## xterm 6x6 grayscale + 0.upto(5) { |x| 0.upto(5) { |y| color! "g#{x}#{y}", (16+6*6*6) + y + 6*x } } + end end module Redwood @@ -7,12 +25,6 @@ module Redwood class Colormap @@instance = nil - CURSES_COLORS = [Curses::COLOR_BLACK, Curses::COLOR_RED, Curses::COLOR_GREEN, - Curses::COLOR_YELLOW, Curses::COLOR_BLUE, - Curses::COLOR_MAGENTA, Curses::COLOR_CYAN, - Curses::COLOR_WHITE, Curses::COLOR_DEFAULT] - NUM_COLORS = (CURSES_COLORS.size - 1) * (CURSES_COLORS.size - 1) - DEFAULT_COLORS = { :status => { :fg => "white", :bg => "blue", :attrs => ["bold"] }, :index_old => { :fg => "white", :bg => "default" }, @@ -68,8 +80,8 @@ class Colormap def add sym, fg, bg, attr=nil, opts={} raise ArgumentError, "color for #{sym} already defined" if @entries.member? sym - raise ArgumentError, "color '#{fg}' unknown" unless CURSES_COLORS.include? fg - raise ArgumentError, "color '#{bg}' unknown" unless CURSES_COLORS.include? bg + raise ArgumentError, "color '#{fg}' unknown" unless (-1...Curses::NUM_COLORS).include? fg + raise ArgumentError, "color '#{bg}' unknown" unless (-1...Curses::NUM_COLORS).include? bg attrs = [attr].flatten.compact @entries[sym] = [fg, bg, attrs, nil] @@ -127,7 +139,7 @@ class Colormap if(cp = @color_pairs[[fg, bg]]) ## nothing else ## need to get a new colorpair - @next_id = (@next_id + 1) % NUM_COLORS + @next_id = (@next_id + 1) % Curses::MAX_PAIRS @next_id += 1 if @next_id == 0 # 0 is always white on black id = @next_id debug "colormap: for color #{sym}, using id #{id} -> #{fg}, #{bg}" @@ -169,7 +181,7 @@ class Colormap if user_colors && (ucolor = user_colors[k]) if(ufg = ucolor[:fg]) begin - fg = Curses.const_get "COLOR_#{ufg.upcase}" + fg = Curses.const_get "COLOR_#{ufg.to_s.upcase}" rescue NameError error ||= "Warning: there is no color named \"#{ufg}\", using fallback." warn "there is no color named \"#{ufg}\"" @@ -178,7 +190,7 @@ class Colormap if(ubg = ucolor[:bg]) begin - bg = Curses.const_get "COLOR_#{ubg.upcase}" + bg = Curses.const_get "COLOR_#{ubg.to_s.upcase}" rescue NameError error ||= "Warning: there is no color named \"#{ubg}\", using fallback." warn "there is no color named \"#{ubg}\"" -- 1.6.3.3 From wmorgan-sup@masanjin.net Sun Jan 3 09:48:22 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 06:48:22 -0800 Subject: [sup-devel] Ruby 1.9 encoding fixes In-Reply-To: <1262442839-sup-7738@peray> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262372864-sup-22@masanjin.net> <1262442839-sup-7738@peray> Message-ID: <1262530083-sup-8232@masanjin.net> Reformatted excerpts from Nicolas Pouillard's message of 2010-01-02: > Gem files will remain installed in /home/ertai/.gem/ruby/1.8/gems/xapian-full-1.1.3 for inspection. > Results logged to /home/ertai/.gem/ruby/1.8/gems/xapian-full-1.1.3/gem_make.out Anything interested in that file? -- William From wmorgan-sup@masanjin.net Sun Jan 3 09:59:09 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 06:59:09 -0800 Subject: [sup-devel] [PATCH] ruby 1.9: use String#ord in ask_getch and ask_yes_or_no In-Reply-To: <1262378827-16722-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262378827-16722-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262530723-sup-1531@masanjin.net> Applied to ruby-1.9.encodings and remerged into next. Thanks! -- William From wmorgan-sup@masanjin.net Sun Jan 3 10:00:03 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 07:00:03 -0800 Subject: [sup-devel] [PATCH] xapian: respect :skip_killed in each_message_in_thread_for In-Reply-To: <1262382274-24324-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262382274-24324-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262530787-sup-4704@masanjin.net> Applied directly to master. Thanks! -- William From wmorgan-sup@masanjin.net Sun Jan 3 10:00:21 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 07:00:21 -0800 Subject: [sup-devel] [PATCH] ruby 1.9: expect nil start_offset when an MBox::Loader is first created In-Reply-To: <1262384040-27801-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262384040-27801-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262530809-sup-2404@masanjin.net> Applied directly to master. Thanks! -- William From rlane@club.cc.cmu.edu Sun Jan 3 10:10:31 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 03 Jan 2010 10:10:31 -0500 Subject: [sup-devel] [PATCH] support high colors in colors.yaml In-Reply-To: <1262476200-25885-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262476200-25885-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262531429-sup-4730@zyrg.net> Excerpts from Rich Lane's message of 2010-01-02 18:50:00 -0500: > Add constants for colors >15 so that they can be used in the colors config > file. You can use integers for all available colors. If you're running > xterm-256color or compatible you can use "cXYZ" for the 6x6x6 color cube and > "gXY" for grayscale. Disregard this patch, grayscale should be one dimensional. I'll send out a fixed version. From wmorgan-sup@masanjin.net Sun Jan 3 10:14:57 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 07:14:57 -0800 Subject: [sup-devel] [PATCH] switch default index to Xapian In-Reply-To: <1262403040-24105-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262403040-24105-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262530826-sup-7476@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-01: > Previous versions didn't add an :index entry in config.yaml, so > preserve compatibility by using Ferret if no index is specified and > the ferret directory exists. I have done something a little more extensive in the branch ferret-deprecation, merged into next, so I'm going to drop this patch, unless you think I missed something. The current behavior is: 1. If a Xapian index exists, use Xapian 2. Otherwise, if a Ferret index exists, use Ferret 3. Otherwise (new index), use Xapian. The choice is overrideable by the environment variable (which I'd like to remove at some point), the config option, and a commandline flag --index added to most things in bin/. > Names are stemmed and otherwise munged for convenient searching by > Xapian::TermGenerator, while email addresses are stored verbatim. > Xapian::QueryParser needs to do the same alterations to search terms, so the > parser uses separate from_{name,email} fields. This is not user-friendly but > could be worked around by having parse_query insert an OR over both fields > where it sees a from: prefix (same for to). I'm fine with this solution. At some point (not necessarily for 0.10) I'd also like to add more email address munging so that the address bob at foo.com is matched by bob, foo, foo.com, and bob at foo.com, so maybe this is an analogous case. > A more pernicious issue is that QueryParser defaults to AND if there > isn't an explicit operator (which is what we want), but if there are > multiple boolean (label/email) terms over the same field it will OR > them. So, "label:sup label:patch" will result in the union instead of > the intersection. Assuming we don't want to write our own query > parser, this needs to be made configurable in Xapian. I took a stab at > it a few months ago but didn't get anywhere. Ok. Unfortunate, but not a dealbreaker by any means, especially if it's restricted to emails and labels. > There's also the issue of long delays when flushing the index to disk > on exit. One option is to keep the delay and log an info message > saying what's going on. A second option is to set the > XAPIAN_FLUSH_THRESHOLD environment variable to something low in > bin/sup, which will limit the final delay but potentially cause short > delays during normal use. A third option is to detect when the user > has been idle for a while and flush the index then. This is something I definitely would like to see fixed before 0.10, but I would be happy with the silly but trivial option #1. (I suspect #2/#3 will require some back-and-forth to get just right.) > We can easily fix the first and third issues before 0.10. Are there > any others I've forgotten? There was something with the counts in label-list-mode at some point, but the whole issue has been swapped out of my head. Ultimately getting us out of the world of Ferret is worth almost any amount of pain, so, who cares, and, as always, thank you. -- William From wmorgan-sup@masanjin.net Sun Jan 3 10:15:17 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 07:15:17 -0800 Subject: [sup-devel] [PATCH] fixed am/pm display for ruby 1.8 darwin (v2) In-Reply-To: <1262409241-sup-3697@changeling.local> References: <1262409241-sup-3697@changeling.local> Message-ID: <1262531703-sup-3752@masanjin.net> Applied directly to master. Thanks! -- William From wmorgan-sup@masanjin.net Sun Jan 3 10:16:03 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 07:16:03 -0800 Subject: [sup-devel] [PATCH] force binary encoding before parsing decrypted messages In-Reply-To: <1262450535-5439-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262450535-5439-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262531722-sup-1340@masanjin.net> Applied to the ruby-1.9-encoding branch, remerged into next. Thanks! -- William From rlane@club.cc.cmu.edu Sun Jan 3 10:24:18 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 3 Jan 2010 07:24:18 -0800 Subject: [sup-devel] [PATCHv2 1/3] support high colors in colors.yaml Message-ID: <1262532260-18353-1-git-send-email-rlane@club.cc.cmu.edu> Add constants for colors >15 so that they can be used in the colors config file. You can use integers for all available colors. If you're running xterm-256color or compatible you can use "cXYZ" for the 6x6x6 color cube and "gX" for 24 shades of gray. --- lib/sup/colormap.rb | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-) diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index c4a4024..71c715f 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -1,5 +1,23 @@ module Curses COLOR_DEFAULT = -1 + + NUM_COLORS = `tput colors`.to_i + MAX_PAIRS = `tput pairs`.to_i + + def self.color! name, value + const_set "COLOR_#{name.to_s.upcase}", value + end + + ## numeric colors + Curses::NUM_COLORS.times { |x| color! x, x } + + if Curses::NUM_COLORS == 256 + ## xterm 6x6x6 color cube + 6.times { |x| 6.times { |y| 6.times { |z| color! "c#{x}#{y}#{z}", 16 + z + 6*y + 36*x } } } + + ## xterm 24-shade grayscale + 24.times { |x| color! "g#{x}", (16+6*6*6) + x } + end end module Redwood @@ -7,12 +25,6 @@ module Redwood class Colormap @@instance = nil - CURSES_COLORS = [Curses::COLOR_BLACK, Curses::COLOR_RED, Curses::COLOR_GREEN, - Curses::COLOR_YELLOW, Curses::COLOR_BLUE, - Curses::COLOR_MAGENTA, Curses::COLOR_CYAN, - Curses::COLOR_WHITE, Curses::COLOR_DEFAULT] - NUM_COLORS = (CURSES_COLORS.size - 1) * (CURSES_COLORS.size - 1) - DEFAULT_COLORS = { :status => { :fg => "white", :bg => "blue", :attrs => ["bold"] }, :index_old => { :fg => "white", :bg => "default" }, @@ -68,8 +80,8 @@ class Colormap def add sym, fg, bg, attr=nil, opts={} raise ArgumentError, "color for #{sym} already defined" if @entries.member? sym - raise ArgumentError, "color '#{fg}' unknown" unless CURSES_COLORS.include? fg - raise ArgumentError, "color '#{bg}' unknown" unless CURSES_COLORS.include? bg + raise ArgumentError, "color '#{fg}' unknown" unless (-1...Curses::NUM_COLORS).include? fg + raise ArgumentError, "color '#{bg}' unknown" unless (-1...Curses::NUM_COLORS).include? bg attrs = [attr].flatten.compact @entries[sym] = [fg, bg, attrs, nil] @@ -127,7 +139,7 @@ class Colormap if(cp = @color_pairs[[fg, bg]]) ## nothing else ## need to get a new colorpair - @next_id = (@next_id + 1) % NUM_COLORS + @next_id = (@next_id + 1) % Curses::MAX_PAIRS @next_id += 1 if @next_id == 0 # 0 is always white on black id = @next_id debug "colormap: for color #{sym}, using id #{id} -> #{fg}, #{bg}" @@ -169,7 +181,7 @@ class Colormap if user_colors && (ucolor = user_colors[k]) if(ufg = ucolor[:fg]) begin - fg = Curses.const_get "COLOR_#{ufg.upcase}" + fg = Curses.const_get "COLOR_#{ufg.to_s.upcase}" rescue NameError error ||= "Warning: there is no color named \"#{ufg}\", using fallback." warn "there is no color named \"#{ufg}\"" @@ -178,7 +190,7 @@ class Colormap if(ubg = ucolor[:bg]) begin - bg = Curses.const_get "COLOR_#{ubg.upcase}" + bg = Curses.const_get "COLOR_#{ubg.to_s.upcase}" rescue NameError error ||= "Warning: there is no color named \"#{ubg}\", using fallback." warn "there is no color named \"#{ubg}\"" -- 1.6.3.3 From rlane@club.cc.cmu.edu Sun Jan 3 10:24:19 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 3 Jan 2010 07:24:19 -0800 Subject: [sup-devel] [PATCH 2/3] send color errors to the log instead of flashing In-Reply-To: <1262532260-18353-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262532260-18353-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262532260-18353-2-git-send-email-rlane@club.cc.cmu.edu> During startup, when these errors are most likely to occur, not enough buffer initialization has been done for BufferManager.flash to work. --- lib/sup/colormap.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index 71c715f..d28c550 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -213,7 +213,7 @@ class Colormap add symbol, fg, bg, attrs end - BufferManager.flash error if error + warn error if error end def self.instance; @@instance; end -- 1.6.3.3 From rlane@club.cc.cmu.edu Sun Jan 3 10:24:20 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 3 Jan 2010 07:24:20 -0800 Subject: [sup-devel] [PATCH 3/3] add keybinding 'Oc' to reload colors In-Reply-To: <1262532260-18353-2-git-send-email-rlane@club.cc.cmu.edu> References: <1262532260-18353-1-git-send-email-rlane@club.cc.cmu.edu> <1262532260-18353-2-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262532260-18353-3-git-send-email-rlane@club.cc.cmu.edu> --- bin/sup | 10 ++++++++++ lib/sup/colormap.rb | 6 +++++- 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/bin/sup b/bin/sup index 5571598..0716e55 100755 --- a/bin/sup +++ b/bin/sup @@ -96,6 +96,11 @@ global_keymap = Keymap.new do |k| k.add :recall_draft, "Edit most recent draft message", 'R' k.add :show_inbox, "Show the Inbox buffer", 'I' k.add :show_console, "Show the Console buffer", '~' + + ## Submap for less often used keybindings + k.add_multi "reload (c)olors", 'O' do |kk| + kk.add :reload_colors, "Reload colors", 'c' + end end ## the following magic enables wide characters when used with a ruby @@ -326,6 +331,11 @@ begin when :show_console b, new = bm.spawn_unless_exists("Console", :system => true) { ConsoleMode.new } b.mode.run + when :reload_colors + Colormap.reset + Colormap.populate_colormap + bm.completely_redraw_screen + bm.flash "reloaded colors" when :nothing, InputSequenceAborted when :redraw bm.completely_redraw_screen diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index d28c550..6f21f9a 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -68,11 +68,15 @@ class Colormap def initialize raise "only one instance can be created" if @@instance @@instance = self - @entries = {} @color_pairs = {[Curses::COLOR_WHITE, Curses::COLOR_BLACK] => 0} @users = [] @next_id = 0 + reset yield self if block_given? + end + + def reset + @entries = {} @entries[highlight_sym(:none)] = highlight_for(Curses::COLOR_WHITE, Curses::COLOR_BLACK, []) + [nil] -- 1.6.3.3 From wmorgan-sup@masanjin.net Sun Jan 3 10:27:24 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 07:27:24 -0800 Subject: [sup-devel] [PATCH] Move the mark-as-spam hook so it runs on all tagged threads. In-Reply-To: <1262292330-28131-1-git-send-email-pi+sup@pihost.us> References: <1262292330-28131-1-git-send-email-pi+sup@pihost.us> Message-ID: <1262532435-sup-3410@masanjin.net> Applied directly to master. Thanks! -- William From rlane@club.cc.cmu.edu Sun Jan 3 10:33:28 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 3 Jan 2010 07:33:28 -0800 Subject: [sup-devel] [PATCH] add a mouse-enabled colorpicker to contrib Message-ID: <1262532808-19401-1-git-send-email-rlane@club.cc.cmu.edu> Intended to make colorscheme creation easier. --- contrib/colorpicker.rb | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 104 insertions(+), 0 deletions(-) create mode 100644 contrib/colorpicker.rb diff --git a/contrib/colorpicker.rb b/contrib/colorpicker.rb new file mode 100644 index 0000000..c981a23 --- /dev/null +++ b/contrib/colorpicker.rb @@ -0,0 +1,104 @@ +require 'rubygems' + +begin + require 'ncursesw' +rescue LoadError + require 'ncurses' +end + +Ncurses.initscr +Ncurses.noecho +Ncurses.cbreak +Ncurses.start_color + +Ncurses.curs_set 0 +Ncurses.move 0, 0 +Ncurses.clear +Ncurses.refresh +cc = Ncurses.COLORS + +Ncurses::keypad(Ncurses::stdscr, 1) +Ncurses::mousemask(Ncurses::ALL_MOUSE_EVENTS | Ncurses::REPORT_MOUSE_POSITION, []) + +fail "color count is #{cc}, expected 256" unless cc == 256 + +1.upto(255) do |c| + Ncurses.init_pair(c, 0, c) +end + +def cell y, x, c + @map[[y,x]] = c + Ncurses.attron(Ncurses.COLOR_PAIR(c)) + Ncurses.mvaddstr(y, x, " ") + Ncurses.attroff(Ncurses.COLOR_PAIR(c)) +end + +def handle_click y, x + c = @map[[y,x]] or return + name = case c + when 0...16 + c.to_s + when 16...232 + 'c' + (c-16).to_s(6).rjust(3,'0') + when 232...256 + 'g' + (c-232).to_s + end + + Ncurses.mvaddstr 11, 0, "#{name} " + + Ncurses.attron(Ncurses.COLOR_PAIR(c)) + 10.times do |i| + 20.times do |j| + y = 13 + i + x = j + Ncurses.mvaddstr(y, x, " ") + end + end + Ncurses.attroff(Ncurses.COLOR_PAIR(c)) +end + + at map = {} + at fg = @bg = 0 + +begin + 16.times do |i| + cell 0, i, i + end + + 6.times do |i| + 6.times do |j| + 6.times do |k| + c = 16 + 6*6*i + 6*j + k + y = 2 + j + x = 7*i + k + cell y, x, c + end + end + end + + 16.times do |i| + c = 16 + 6*6*6 + i + cell 9, i, c + end + + handle_click 0, 0 + Ncurses.refresh + + while (c = Ncurses.getch) + case c + when 113 #q + break + when Ncurses::KEY_MOUSE + mev = Ncurses::MEVENT.new + Ncurses.getmouse(mev) + case(mev.bstate) + when Ncurses::BUTTON1_CLICKED + handle_click mev.y, mev.x + end + end + Ncurses.refresh + end + +ensure + Ncurses.endwin +end -- 1.6.3.3 From nicolas.pouillard@gmail.com Sun Jan 3 10:48:36 2010 From: nicolas.pouillard@gmail.com (Nicolas Pouillard) Date: Sun, 03 Jan 2010 16:48:36 +0100 Subject: [sup-devel] Ruby 1.9 encoding fixes In-Reply-To: <1262530083-sup-8232@masanjin.net> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> <1262372864-sup-22@masanjin.net> <1262442839-sup-7738@peray> <1262530083-sup-8232@masanjin.net> Message-ID: <1262533689-sup-7301@peray> Excerpts from William Morgan's message of Sun Jan 03 15:48:22 +0100 2010: > Reformatted excerpts from Nicolas Pouillard's message of 2010-01-02: > > Gem files will remain installed in /home/ertai/.gem/ruby/1.8/gems/xapian-full-1.1.3 for inspection. > > Results logged to /home/ertai/.gem/ruby/1.8/gems/xapian-full-1.1.3/gem_make.out > > Anything interested in that file? No. But I attach it just in case. -- Nicolas Pouillard http://nicolaspouillard.fr -------------- next part -------------- A non-text attachment was scrubbed... Name: gem_make.out.gz Type: application/x-gzip Size: 25765 bytes Desc: not available URL: From eg@gaute.vetsj.com Sun Jan 3 10:51:55 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Sun, 03 Jan 2010 16:51:55 +0100 Subject: [sup-devel] [issue36] label tab completion with utf-8 chars fail In-Reply-To: <1261749755.37.0.845609324711.issue36@masanjin.net> References: <1261749755.37.0.845609324711.issue36@masanjin.net> Message-ID: <1262533823-sup-5348@dolk> This goes for tab completion with contacts containing UTF-8 chars. Possibly other places as well. Similar exception, see attached exception log. - gaute Excerpts from Gaute Hope's message of 2009-12-25 15:02:35 +0100: > > New submission from Gaute Hope : > > When trying to label a thread with a label containing unicode chars and pressing > TAB I get this. When typing in the whole label manually it ads it with some > minor glitches in the rendering of the message-line. When restarting sup I get a > one space between the subject and the label that doesn't change background color > when selected. > > [2009-12-25 14:51:11 +0100] ERROR: oh crap, an exception > ---------------------------------------------------------------- > I'm very sorry. It seems that an error occurred in Sup. Please > accept my sincere apologies. If you don't mind, please send the > contents of /home/gaute/.sup/exception-log.txt and a brief report of the > circumstances to sup-talk at rubyforge dot orgs so that I might > address this problem. Thank you! > > Sincerely, > William > ---------------------------------------------------------------- > --- Encoding::CompatibilityError from thread: main > incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:461:in `block (2 levels) in > ask_many_with_completions' > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:461:in `select' > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:461:in `block in > ask_many_with_completions' > /home/gaute/dev/ruby/sup.git/lib/sup/textfield.rb:75:in `call' > /home/gaute/dev/ruby/sup.git/lib/sup/textfield.rb:75:in `handle_input' > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:572:in `ask' > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:450:in > `ask_many_with_completions' > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:519:in `ask_for_labels' > /home/gaute/dev/ruby/sup.git/lib/sup/util.rb:546:in `method_missing' > /home/gaute/dev/ruby/sup.git/lib/sup/modes/thread-index-mode.rb:536:in > `edit_labels' > /home/gaute/dev/ruby/sup.git/lib/sup/mode.rb:52:in `handle_input' > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:266:in `handle_input' > bin/sup:244:in `' > bin/sup:67:in `
' > > ---------- > messages: 97 > nosy: gauteh > priority: bug > ruby_version: 1.9.1 > status: unread > sup_version: git > title: label tab completion with utf-8 chars fail > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: exception-log.txt URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From eg@gaute.vetsj.com Sun Jan 3 10:56:17 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Sun, 03 Jan 2010 16:56:17 +0100 Subject: [sup-devel] [issue36] label tab completion with utf-8 chars fail In-Reply-To: <1262533823-sup-5348@dolk> References: <1261749755.37.0.845609324711.issue36@masanjin.net> <1262533823-sup-5348@dolk> Message-ID: <1262534029-sup-1213@dolk> Apparently I can't even send messages when I enter the UTF-8 email address manually. sup fails after having edited message and returning to the edit message view. Attached is the exception log. - gaute Excerpts from Gaute Hope's message of 2010-01-03 16:51:55 +0100: > This goes for tab completion with contacts containing UTF-8 chars. > Possibly other places as well. > > Similar exception, see attached exception log. > > - gaute > > Excerpts from Gaute Hope's message of 2009-12-25 15:02:35 +0100: > > > > New submission from Gaute Hope : > > > > When trying to label a thread with a label containing unicode chars and pressing > > TAB I get this. When typing in the whole label manually it ads it with some > > minor glitches in the rendering of the message-line. When restarting sup I get a > > one space between the subject and the label that doesn't change background color > > when selected. > > > > [2009-12-25 14:51:11 +0100] ERROR: oh crap, an exception > > ---------------------------------------------------------------- > > I'm very sorry. It seems that an error occurred in Sup. Please > > accept my sincere apologies. If you don't mind, please send the > > contents of /home/gaute/.sup/exception-log.txt and a brief report of the > > circumstances to sup-talk at rubyforge dot orgs so that I might > > address this problem. Thank you! > > > > Sincerely, > > William > > ---------------------------------------------------------------- > > --- Encoding::CompatibilityError from thread: main > > incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:461:in `block (2 levels) in > > ask_many_with_completions' > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:461:in `select' > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:461:in `block in > > ask_many_with_completions' > > /home/gaute/dev/ruby/sup.git/lib/sup/textfield.rb:75:in `call' > > /home/gaute/dev/ruby/sup.git/lib/sup/textfield.rb:75:in `handle_input' > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:572:in `ask' > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:450:in > > `ask_many_with_completions' > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:519:in `ask_for_labels' > > /home/gaute/dev/ruby/sup.git/lib/sup/util.rb:546:in `method_missing' > > /home/gaute/dev/ruby/sup.git/lib/sup/modes/thread-index-mode.rb:536:in > > `edit_labels' > > /home/gaute/dev/ruby/sup.git/lib/sup/mode.rb:52:in `handle_input' > > /home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:266:in `handle_input' > > bin/sup:244:in `' > > bin/sup:67:in `
' > > > > ---------- > > messages: 97 > > nosy: gauteh > > priority: bug > > ruby_version: 1.9.1 > > status: unread > > sup_version: git > > title: label tab completion with utf-8 chars fail > > > --- Encoding::CompatibilityError from thread: main > incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/buffer.rb:476:in `block (2 levels) in ask_many_emails_with_completions' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/buffer.rb:476:in `select' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/buffer.rb:476:in `block in ask_many_emails_with_completions' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/textfield.rb:74:in `call' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/textfield.rb:74:in `handle_input' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/buffer.rb:578:in `ask' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/buffer.rb:472:in `ask_many_emails_with_completions' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/util.rb:547:in `method_missing' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/buffer.rb:548:in `ask_for_contacts' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/util.rb:547:in `method_missing' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/lib/sup/modes/compose-mode.rb:24:in `spawn_nicely' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/bin/sup:331:in `' > /home/gaute/.gem/ruby/1.9.1/gems/sup-999/bin/sup:78:in `' > /home/gaute/.gem/ruby/1.9.1/bin/sup:19:in `load' > /home/gaute/.gem/ruby/1.9.1/bin/sup:19:in `
' -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: exception-log.txt URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rlane@club.cc.cmu.edu Sun Jan 3 11:07:16 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 3 Jan 2010 08:07:16 -0800 Subject: [sup-devel] [PATCH] utf-8 script encoding In-Reply-To: <1262533823-sup-5348@dolk> References: <1262533823-sup-5348@dolk> Message-ID: <1262534836-29113-1-git-send-email-rlane@club.cc.cmu.edu> --- Does this patch help? bin/sup | 1 + bin/sup-add | 1 + bin/sup-config | 1 + bin/sup-dump | 1 + bin/sup-recover-sources | 1 + bin/sup-sync | 1 + bin/sup-sync-back | 1 + bin/sup-tweak-labels | 1 + lib/sup.rb | 1 + lib/sup/account.rb | 1 + lib/sup/buffer.rb | 1 + lib/sup/colormap.rb | 1 + lib/sup/contact.rb | 1 + lib/sup/crypto.rb | 1 + lib/sup/draft.rb | 1 + lib/sup/ferret_index.rb | 1 + lib/sup/hook.rb | 1 + lib/sup/horizontal-selector.rb | 1 + lib/sup/imap.rb | 1 + lib/sup/index.rb | 1 + lib/sup/interactive-lock.rb | 1 + lib/sup/keymap.rb | 1 + lib/sup/label.rb | 1 + lib/sup/logger.rb | 1 + lib/sup/maildir.rb | 1 + lib/sup/mbox.rb | 1 + lib/sup/mbox/loader.rb | 1 + lib/sup/mbox/ssh-file.rb | 1 + lib/sup/mbox/ssh-loader.rb | 1 + lib/sup/message-chunks.rb | 1 + lib/sup/message.rb | 1 + lib/sup/mode.rb | 1 + lib/sup/modes/buffer-list-mode.rb | 1 + lib/sup/modes/completion-mode.rb | 1 + lib/sup/modes/compose-mode.rb | 1 + lib/sup/modes/console-mode.rb | 1 + lib/sup/modes/contact-list-mode.rb | 1 + lib/sup/modes/edit-message-mode.rb | 1 + lib/sup/modes/file-browser-mode.rb | 1 + lib/sup/modes/forward-mode.rb | 1 + lib/sup/modes/help-mode.rb | 1 + lib/sup/modes/inbox-mode.rb | 1 + lib/sup/modes/label-list-mode.rb | 1 + lib/sup/modes/label-search-results-mode.rb | 1 + lib/sup/modes/line-cursor-mode.rb | 1 + lib/sup/modes/log-mode.rb | 1 + lib/sup/modes/person-search-results-mode.rb | 1 + lib/sup/modes/poll-mode.rb | 1 + lib/sup/modes/reply-mode.rb | 1 + lib/sup/modes/resume-mode.rb | 1 + lib/sup/modes/scroll-mode.rb | 1 + lib/sup/modes/search-results-mode.rb | 1 + lib/sup/modes/text-mode.rb | 1 + lib/sup/modes/thread-index-mode.rb | 1 + lib/sup/modes/thread-view-mode.rb | 1 + lib/sup/person.rb | 1 + lib/sup/poll.rb | 1 + lib/sup/rfc2047.rb | 1 + lib/sup/sent.rb | 1 + lib/sup/source.rb | 1 + lib/sup/tagger.rb | 1 + lib/sup/textfield.rb | 1 + lib/sup/thread.rb | 1 + lib/sup/undo.rb | 1 + lib/sup/update.rb | 1 + lib/sup/util.rb | 1 + lib/sup/xapian_index.rb | 1 + 67 files changed, 67 insertions(+), 0 deletions(-) diff --git a/bin/sup b/bin/sup index 493f48f..f05acc3 100755 --- a/bin/sup +++ b/bin/sup @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'rubygems' diff --git a/bin/sup-add b/bin/sup-add index c53378d..de4f65f 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'uri' require 'rubygems' diff --git a/bin/sup-config b/bin/sup-config index b37e0b2..da8777b 100755 --- a/bin/sup-config +++ b/bin/sup-config @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'rubygems' require 'highline/import' diff --git a/bin/sup-dump b/bin/sup-dump index 7b33be5..78e388a 100755 --- a/bin/sup-dump +++ b/bin/sup-dump @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'rubygems' require 'trollop' diff --git a/bin/sup-recover-sources b/bin/sup-recover-sources index 43fa5f6..d4a9170 100755 --- a/bin/sup-recover-sources +++ b/bin/sup-recover-sources @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'optparse' diff --git a/bin/sup-sync b/bin/sup-sync index 5e89dac..184d740 100755 --- a/bin/sup-sync +++ b/bin/sup-sync @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'uri' require 'rubygems' diff --git a/bin/sup-sync-back b/bin/sup-sync-back index 6298c97..ffc863f 100755 --- a/bin/sup-sync-back +++ b/bin/sup-sync-back @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'rubygems' require 'uri' diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels index 9bb97b2..3b7bcc4 100755 --- a/bin/sup-tweak-labels +++ b/bin/sup-tweak-labels @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 require 'rubygems' require 'trollop' diff --git a/lib/sup.rb b/lib/sup.rb index 144f5e3..e158249 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'rubygems' require 'yaml' require 'zlib' diff --git a/lib/sup/account.rb b/lib/sup/account.rb index bf8a8a0..fc655b9 100644 --- a/lib/sup/account.rb +++ b/lib/sup/account.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class Account < Person diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 06923bd..cb045fc 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'etc' require 'thread' diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index c4a4024..acaf996 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Curses COLOR_DEFAULT = -1 end diff --git a/lib/sup/contact.rb b/lib/sup/contact.rb index c489aaf..25bf84a 100644 --- a/lib/sup/contact.rb +++ b/lib/sup/contact.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ContactManager diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb index fb2661a..072a30c 100644 --- a/lib/sup/crypto.rb +++ b/lib/sup/crypto.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class CryptoManager diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb index 5ea2935..740ec6b 100644 --- a/lib/sup/draft.rb +++ b/lib/sup/draft.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class DraftManager diff --git a/lib/sup/ferret_index.rb b/lib/sup/ferret_index.rb index 4a2cc76..05bc5b2 100644 --- a/lib/sup/ferret_index.rb +++ b/lib/sup/ferret_index.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'ferret' module Redwood diff --git a/lib/sup/hook.rb b/lib/sup/hook.rb index 3bf9823..b42b223 100644 --- a/lib/sup/hook.rb +++ b/lib/sup/hook.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class HookManager diff --git a/lib/sup/horizontal-selector.rb b/lib/sup/horizontal-selector.rb index aef16d4..608703f 100644 --- a/lib/sup/horizontal-selector.rb +++ b/lib/sup/horizontal-selector.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class HorizontalSelector diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index bdb9e15..5160e5c 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'uri' require 'net/imap' require 'stringio' diff --git a/lib/sup/index.rb b/lib/sup/index.rb index 87d8d52..829e6a5 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 ## Index interface, subclassed by Ferret indexer. require 'fileutils' diff --git a/lib/sup/interactive-lock.rb b/lib/sup/interactive-lock.rb index 92a5ead..5150c89 100644 --- a/lib/sup/interactive-lock.rb +++ b/lib/sup/interactive-lock.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'fileutils' module Redwood diff --git a/lib/sup/keymap.rb b/lib/sup/keymap.rb index cb039e4..74e1599 100644 --- a/lib/sup/keymap.rb +++ b/lib/sup/keymap.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class Keymap diff --git a/lib/sup/label.rb b/lib/sup/label.rb index 67474c2..f035dd8 100644 --- a/lib/sup/label.rb +++ b/lib/sup/label.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class LabelManager diff --git a/lib/sup/logger.rb b/lib/sup/logger.rb index ccaeae0..7912ce2 100644 --- a/lib/sup/logger.rb +++ b/lib/sup/logger.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require "sup" require 'stringio' require 'thread' diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index c2bd27a..b3935d3 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'rmail' require 'uri' diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb index 7af40dd..8973f06 100644 --- a/lib/sup/mbox.rb +++ b/lib/sup/mbox.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require "sup/mbox/loader" require "sup/mbox/ssh-file" require "sup/mbox/ssh-loader" diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb index 54d227d..031a744 100644 --- a/lib/sup/mbox/loader.rb +++ b/lib/sup/mbox/loader.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'rmail' require 'uri' require 'set' diff --git a/lib/sup/mbox/ssh-file.rb b/lib/sup/mbox/ssh-file.rb index 4ae4bba..6f1c5ee 100644 --- a/lib/sup/mbox/ssh-file.rb +++ b/lib/sup/mbox/ssh-file.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'net/ssh' module Redwood diff --git a/lib/sup/mbox/ssh-loader.rb b/lib/sup/mbox/ssh-loader.rb index e422a48..75875d5 100644 --- a/lib/sup/mbox/ssh-loader.rb +++ b/lib/sup/mbox/ssh-loader.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'net/ssh' module Redwood diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb index 581b707..8f0be32 100644 --- a/lib/sup/message-chunks.rb +++ b/lib/sup/message-chunks.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'tempfile' ## Here we define all the "chunks" that a message is parsed diff --git a/lib/sup/message.rb b/lib/sup/message.rb index f3ac874..03fd831 100644 --- a/lib/sup/message.rb +++ b/lib/sup/message.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'time' module Redwood diff --git a/lib/sup/mode.rb b/lib/sup/mode.rb index c8ad0cc..899a9fb 100644 --- a/lib/sup/mode.rb +++ b/lib/sup/mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'open3' module Redwood diff --git a/lib/sup/modes/buffer-list-mode.rb b/lib/sup/modes/buffer-list-mode.rb index 1554cae..175b37a 100644 --- a/lib/sup/modes/buffer-list-mode.rb +++ b/lib/sup/modes/buffer-list-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class BufferListMode < LineCursorMode diff --git a/lib/sup/modes/completion-mode.rb b/lib/sup/modes/completion-mode.rb index 3cb2fad..62aeab0 100644 --- a/lib/sup/modes/completion-mode.rb +++ b/lib/sup/modes/completion-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class CompletionMode < ScrollMode diff --git a/lib/sup/modes/compose-mode.rb b/lib/sup/modes/compose-mode.rb index f0d1e23..90f6f18 100644 --- a/lib/sup/modes/compose-mode.rb +++ b/lib/sup/modes/compose-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ComposeMode < EditMessageMode diff --git a/lib/sup/modes/console-mode.rb b/lib/sup/modes/console-mode.rb index f0c626e..c4e51fe 100644 --- a/lib/sup/modes/console-mode.rb +++ b/lib/sup/modes/console-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'pp' module Redwood diff --git a/lib/sup/modes/contact-list-mode.rb b/lib/sup/modes/contact-list-mode.rb index 49804ad..63d1e2f 100644 --- a/lib/sup/modes/contact-list-mode.rb +++ b/lib/sup/modes/contact-list-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood module CanAliasContacts diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb index 8849271..618b3ef 100644 --- a/lib/sup/modes/edit-message-mode.rb +++ b/lib/sup/modes/edit-message-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'tempfile' require 'socket' # just for gethostname! require 'pathname' diff --git a/lib/sup/modes/file-browser-mode.rb b/lib/sup/modes/file-browser-mode.rb index b92468d..976a8e8 100644 --- a/lib/sup/modes/file-browser-mode.rb +++ b/lib/sup/modes/file-browser-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'pathname' module Redwood diff --git a/lib/sup/modes/forward-mode.rb b/lib/sup/modes/forward-mode.rb index 9428b4b..f5903f3 100644 --- a/lib/sup/modes/forward-mode.rb +++ b/lib/sup/modes/forward-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ForwardMode < EditMessageMode diff --git a/lib/sup/modes/help-mode.rb b/lib/sup/modes/help-mode.rb index b98f131..6e3274e 100644 --- a/lib/sup/modes/help-mode.rb +++ b/lib/sup/modes/help-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class HelpMode < TextMode diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb index 6c2244a..177c098 100644 --- a/lib/sup/modes/inbox-mode.rb +++ b/lib/sup/modes/inbox-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'sup' module Redwood diff --git a/lib/sup/modes/label-list-mode.rb b/lib/sup/modes/label-list-mode.rb index f0084a9..50a4744 100644 --- a/lib/sup/modes/label-list-mode.rb +++ b/lib/sup/modes/label-list-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class LabelListMode < LineCursorMode diff --git a/lib/sup/modes/label-search-results-mode.rb b/lib/sup/modes/label-search-results-mode.rb index bca51d4..d45b764 100644 --- a/lib/sup/modes/label-search-results-mode.rb +++ b/lib/sup/modes/label-search-results-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class LabelSearchResultsMode < ThreadIndexMode diff --git a/lib/sup/modes/line-cursor-mode.rb b/lib/sup/modes/line-cursor-mode.rb index 1bd4ed1..0108592 100644 --- a/lib/sup/modes/line-cursor-mode.rb +++ b/lib/sup/modes/line-cursor-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood ## extends ScrollMode to have a line-based cursor. diff --git a/lib/sup/modes/log-mode.rb b/lib/sup/modes/log-mode.rb index de320ce..0489a32 100644 --- a/lib/sup/modes/log-mode.rb +++ b/lib/sup/modes/log-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'stringio' module Redwood diff --git a/lib/sup/modes/person-search-results-mode.rb b/lib/sup/modes/person-search-results-mode.rb index fc09126..656f394 100644 --- a/lib/sup/modes/person-search-results-mode.rb +++ b/lib/sup/modes/person-search-results-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class PersonSearchResultsMode < ThreadIndexMode diff --git a/lib/sup/modes/poll-mode.rb b/lib/sup/modes/poll-mode.rb index cf61343..2cb8d47 100644 --- a/lib/sup/modes/poll-mode.rb +++ b/lib/sup/modes/poll-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class PollMode < LogMode diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb index 3d39a8a..b4f8bde 100644 --- a/lib/sup/modes/reply-mode.rb +++ b/lib/sup/modes/reply-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ReplyMode < EditMessageMode diff --git a/lib/sup/modes/resume-mode.rb b/lib/sup/modes/resume-mode.rb index e527542..4e4346f 100644 --- a/lib/sup/modes/resume-mode.rb +++ b/lib/sup/modes/resume-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ResumeMode < EditMessageMode diff --git a/lib/sup/modes/scroll-mode.rb b/lib/sup/modes/scroll-mode.rb index c131425..7b1aefd 100644 --- a/lib/sup/modes/scroll-mode.rb +++ b/lib/sup/modes/scroll-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ScrollMode < Mode diff --git a/lib/sup/modes/search-results-mode.rb b/lib/sup/modes/search-results-mode.rb index 121e817..59e83af 100644 --- a/lib/sup/modes/search-results-mode.rb +++ b/lib/sup/modes/search-results-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class SearchResultsMode < ThreadIndexMode diff --git a/lib/sup/modes/text-mode.rb b/lib/sup/modes/text-mode.rb index 7c9e7d8..251b994 100644 --- a/lib/sup/modes/text-mode.rb +++ b/lib/sup/modes/text-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class TextMode < ScrollMode diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index ccda50b..617cf67 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'set' module Redwood diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 8b5642e..ca6108f 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class ThreadViewMode < LineCursorMode diff --git a/lib/sup/person.rb b/lib/sup/person.rb index 4b1c80b..5256cc4 100644 --- a/lib/sup/person.rb +++ b/lib/sup/person.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class Person diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 4f30505..ac60373 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'thread' module Redwood diff --git a/lib/sup/rfc2047.rb b/lib/sup/rfc2047.rb index f31faa1..8fe645d 100644 --- a/lib/sup/rfc2047.rb +++ b/lib/sup/rfc2047.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 ## from: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/101949 # $Id: rfc2047.rb,v 1.4 2003/04/18 20:55:56 sam Exp $ diff --git a/lib/sup/sent.rb b/lib/sup/sent.rb index 87ca6c6..8c48259 100644 --- a/lib/sup/sent.rb +++ b/lib/sup/sent.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class SentManager diff --git a/lib/sup/source.rb b/lib/sup/source.rb index 6fe7bfb..134cda9 100644 --- a/lib/sup/source.rb +++ b/lib/sup/source.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require "sup/rfc2047" module Redwood diff --git a/lib/sup/tagger.rb b/lib/sup/tagger.rb index d62f340..0a04b0c 100644 --- a/lib/sup/tagger.rb +++ b/lib/sup/tagger.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood class Tagger diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb index 9afeb34..8072f83 100644 --- a/lib/sup/textfield.rb +++ b/lib/sup/textfield.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood ## a fully-functional text field supporting completions, expansions, diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb index 2300305..17d709d 100644 --- a/lib/sup/thread.rb +++ b/lib/sup/thread.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 ## Herein lies all the code responsible for threading messages. It's ## basically an online version of the JWZ threading algorithm: ## http://www.jwz.org/doc/threading.html diff --git a/lib/sup/undo.rb b/lib/sup/undo.rb index 9ccf84a..2ca7d02 100644 --- a/lib/sup/undo.rb +++ b/lib/sup/undo.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood ## Implements a single undo list for the Sup instance diff --git a/lib/sup/update.rb b/lib/sup/update.rb index d386801..b689b51 100644 --- a/lib/sup/update.rb +++ b/lib/sup/update.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module Redwood ## Classic listener/broadcaster paradigm. Handles communication between various diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 25af762..5bd93b3 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'thread' require 'lockfile' require 'mime/types' diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index 955ec8f..2919ce6 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 require 'xapian' require 'set' -- 1.6.3.3 From eg@gaute.vetsj.com Sun Jan 3 11:18:29 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Sun, 03 Jan 2010 17:18:29 +0100 Subject: [sup-devel] [PATCH] utf-8 script encoding In-Reply-To: <1262534836-29113-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262533823-sup-5348@dolk> <1262534836-29113-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262535218-sup-9718@dolk> Excerpts from Rich Lane's message of 2010-01-03 17:07:16 +0100: > --- Does this patch help? No. Tab completion fails, and sending fails, I can add names with UTF-8 chars to the recipient list, but it fails with the last attached exception. This is the same behaviour as earlier. - gaute -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hyperbolist@gmail.com Sun Jan 3 12:09:50 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Sun, 03 Jan 2010 12:09:50 -0500 Subject: [sup-devel] [PATCH] [issue4] kill buffers in buffer-list-mode with "X" Message-ID: <1262538511-sup-5390@changeling.local> --- lib/sup/modes/buffer-list-mode.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/buffer-list-mode.rb b/lib/sup/modes/buffer-list-mode.rb index 1554cae..40f2e76 100644 --- a/lib/sup/modes/buffer-list-mode.rb +++ b/lib/sup/modes/buffer-list-mode.rb @@ -4,6 +4,7 @@ class BufferListMode < LineCursorMode register_keymap do |k| k.add :jump_to_buffer, "Jump to selected buffer", :enter k.add :reload, "Reload buffer list", "@" + k.add :kill_selected_buffer, "Kill selected buffer", "X" end def initialize @@ -40,6 +41,10 @@ protected def jump_to_buffer BufferManager.raise_to_front @bufs[curpos][1] end + + def kill_selected_buffer + reload if BufferManager.kill_buffer_safely @bufs[curpos][1] + end end end -- 1.6.5.7 From pi+sup@pihost.us Sun Jan 3 14:38:52 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Sun, 03 Jan 2010 12:38:52 -0700 Subject: [sup-devel] [sup-talk] Ferret to Xapian conversion In-Reply-To: <1262531773-sup-5192@masanjin.net> References: <1262460996-sup-1383@home.mrtheplague.net> <1262467343-sup-9565@masanjin.net> <1262471675-sup-1708@masanjin.net> <1262531773-sup-5192@masanjin.net> Message-ID: <1262546960-sup-6875@home.mrtheplague.net> Excerpts from William Morgan's message of Sun Jan 03 08:18:53 -0700 2010: > If you run this script, please report your experience, since I'd like to > include it in the 0.10 release coming soon. Here is a patch to make it complain about not having Xapian *before* starting the state dump, so it doesn't get to step 3 and suddenly find out that it can't load Xapian. Speaking of not having the Xapian gem, when I tried "gem install xapian-full", it looked like it worked, but didn't actually install a gem on my system. Here's the build log: http://pastebin.com/f2d25a13c I tried the regular 'xapian' gem, but the version available in Debian unstable is newer than the gem bindings, so that one outright refuses to compile. Help! diff --git a/bin/sup-convert-ferret-index b/bin/sup-convert-ferret-index index 96a97aa..e78ac4b 100755 --- a/bin/sup-convert-ferret-index +++ b/bin/sup-convert-ferret-index @@ -42,6 +42,12 @@ def run cmd puts end +begin + require 'xapian' +rescue LoadError + Trollop::die "you don't have the xapian gem installed, so this script won't do much for you. `gem install xapian' first." +end + Redwood::start index = Redwood::Index.init Trollop::die "you appear to already have a Xapian index--delete #{File.join(Redwood::BASE_DIR, "xapian")} if you really want to do this" unless Redwood::Index.is_a_deprecated_ferret_index? From rlane@club.cc.cmu.edu Sun Jan 3 15:18:35 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 03 Jan 2010 15:18:35 -0500 Subject: [sup-devel] [sup-talk] Ferret to Xapian conversion In-Reply-To: <1262546960-sup-6875@home.mrtheplague.net> References: <1262460996-sup-1383@home.mrtheplague.net> <1262467343-sup-9565@masanjin.net> <1262471675-sup-1708@masanjin.net> <1262531773-sup-5192@masanjin.net> <1262546960-sup-6875@home.mrtheplague.net> Message-ID: <1262549410-sup-7918@zyrg.net> Excerpts from Anthony Martinez's message of 2010-01-03 14:38:52 -0500: > Speaking of not having the Xapian gem, when I tried "gem install xapian-full", > it looked like it worked, but didn't actually install a gem on my system. Here's > the build log: http://pastebin.com/f2d25a13c > > I tried the regular 'xapian' gem, but the version available in Debian unstable > is newer than the gem bindings, so that one outright refuses to compile. I noticed that gem thinks the xapian compile failed, but it actually succeeded and since it was in-place the installed gem worked fine. I've pushed the ncursesw source to my github so please tinker and send me a patch. I'm traveling for the next day so I won't be able to fix it soon myself. From wmorgan-sup@masanjin.net Sun Jan 3 17:00:28 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 14:00:28 -0800 Subject: [sup-devel] [issue39] Exception running Sup while following the Instructions to fix UTF-8 In-Reply-To: <1262290995.91.0.416495320944.issue39@masanjin.net> References: <1262290995.91.0.416495320944.issue39@masanjin.net> <1262290995.91.0.416495320944.issue39@masanjin.net> Message-ID: <1262555973-sup-6555@masanjin.net> Reformatted excerpts from anonymous's message of 2009-12-31: > --- RuntimeError from thread: main > no Redwood::SentManager instance defined in method call to i_am_the_instance! > ./lib/sup/util.rb:512:in `method_missing' > /usr/lib/ruby/1.8/sup/sent.rb:10:in `initialize' > ./lib/sup/util.rb:524:in `new' > ./lib/sup/util.rb:524:in `init' > ./lib/sup.rb:124:in `start' > bin/sup:143 Soemthing is screwey with your setup---you're loading most files from ./lib, but sent.rb is being loaded from an old version of an installed gem. Are you missing ./lib/sent.rb? If not, does this still happen if you uninstall the Sup gem? -- William From wmorgan-sup@masanjin.net Sun Jan 3 17:07:16 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 14:07:16 -0800 Subject: [sup-devel] [sup-talk] Ferret to Xapian conversion In-Reply-To: <1262546960-sup-6875@home.mrtheplague.net> References: <1262460996-sup-1383@home.mrtheplague.net> <1262467343-sup-9565@masanjin.net> <1262471675-sup-1708@masanjin.net> <1262531773-sup-5192@masanjin.net> <1262546960-sup-6875@home.mrtheplague.net> Message-ID: <1262556388-sup-4595@masanjin.net> Reformatted excerpts from Anthony Martinez's message of 2010-01-03: > Here is a patch to make it complain about not having Xapian *before* starting > the state dump, so it doesn't get to step 3 and suddenly find out that it can't > load Xapian. Added to ferret-deprecation with minor editing, and remerged into next. Thanks! -- William From wmorgan-sup@masanjin.net Sun Jan 3 17:11:49 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 03 Jan 2010 14:11:49 -0800 Subject: [sup-devel] [PATCH] [issue4] kill buffers in buffer-list-mode with "X" In-Reply-To: <1262538511-sup-5390@changeling.local> References: <1262538511-sup-5390@changeling.local> Message-ID: <1262556673-sup-781@masanjin.net> Applied directly to master. It's still Christmas! Thanks! -- William From pi+sup@pihost.us Sun Jan 3 17:47:39 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Sun, 03 Jan 2010 15:47:39 -0700 Subject: [sup-devel] [sup-talk] Ferret to Xapian conversion In-Reply-To: <1262549410-sup-7918@zyrg.net> References: <1262460996-sup-1383@home.mrtheplague.net> <1262467343-sup-9565@masanjin.net> <1262471675-sup-1708@masanjin.net> <1262531773-sup-5192@masanjin.net> <1262546960-sup-6875@home.mrtheplague.net> <1262549410-sup-7918@zyrg.net> Message-ID: <1262558818-sup-5188@home.mrtheplague.net> Excerpts from Rich Lane's message of Sun Jan 03 13:18:35 -0700 2010: > Excerpts from Anthony Martinez's message of 2010-01-03 14:38:52 -0500: > > Speaking of not having the Xapian gem, when I tried "gem install xapian-full", > > it looked like it worked, but didn't actually install a gem on my system. Here's > > the build log: http://pastebin.com/f2d25a13c > > I noticed that gem thinks the xapian compile failed, but it actually > succeeded and since it was in-place the installed gem worked fine. I don't know enough about packaging Gems to help out, unfortunately. The way I'm proceeding for now is to add "-I /var/lib/gems/1.8/gems/xapian-full-1.1.3/lib/" to my Ruby command line (and in the case of the conversion script, to the RUBY_INVOCATION environment). Life is ridiculous. :) It appears to have worked, though, as I'm now writing this from a Xapian-indexed sup! From pi+sup@pihost.us Mon Jan 4 01:06:36 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Sun, 3 Jan 2010 23:06:36 -0700 Subject: [sup-devel] [PATCH 3/3] make the undo hooks also save the threads In-Reply-To: <1262585196-25964-2-git-send-email-pi+sup@pihost.us> References: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> <1262585196-25964-2-git-send-email-pi+sup@pihost.us> Message-ID: <1262585196-25964-3-git-send-email-pi+sup@pihost.us> Since there is no explicit sync any longer, any action that has an Index.save_thread must also repeat the save when the action is undone. Failure to do this will result in an exception upon quit when the index notices that there are still dirty messages. --- lib/sup/modes/inbox-mode.rb | 4 ++++ lib/sup/modes/thread-index-mode.rb | 18 ++++++++++++------ lib/sup/modes/thread-view-mode.rb | 4 ++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb index 852ddb7..1b8eaed 100644 --- a/lib/sup/modes/inbox-mode.rb +++ b/lib/sup/modes/inbox-mode.rb @@ -37,6 +37,7 @@ class InboxMode < ThreadIndexMode UndoManager.register "archiving thread" do thread.apply_label :inbox add_or_unhide thread.first + Index.save_thread thread end cursor_thread.remove_label :inbox @@ -50,6 +51,7 @@ class InboxMode < ThreadIndexMode threads.map do |t| t.apply_label :inbox add_or_unhide t.first + Index.save_thread t end regen_text end @@ -71,6 +73,7 @@ class InboxMode < ThreadIndexMode thread.apply_label :inbox thread.apply_label :unread if was_unread add_or_unhide thread.first + Index.save_thread thread end cursor_thread.remove_label :unread @@ -94,6 +97,7 @@ class InboxMode < ThreadIndexMode threads.zip(old_labels).each do |t, l| t.labels = l add_or_unhide t.first + Index.save_thread t end regen_text end diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a5bd344..28cb858 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -265,7 +265,7 @@ EOS def toggle_starred t = cursor_thread or return undo = actually_toggle_starred t - UndoManager.register "toggling thread starred status", undo + UndoManager.register "toggling thread starred status", undo, lambda { Index.save_thread t } update_text_for_line curpos cursor_down Index.save_thread t @@ -273,7 +273,8 @@ EOS def multi_toggle_starred threads UndoManager.register "toggling #{threads.size.pluralize 'thread'} starred status", - threads.map { |t| actually_toggle_starred t } + threads.map { |t| actually_toggle_starred t }, + lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -351,14 +352,16 @@ EOS def toggle_archived t = cursor_thread or return undo = actually_toggle_archived t - UndoManager.register "deleting/undeleting thread #{t.first.id}", undo, lambda { update_text_for_line curpos } + UndoManager.register "deleting/undeleting thread #{t.first.id}", undo, lambda { update_text_for_line curpos }, + lambda { Index.save_thread t } update_text_for_line curpos Index.save_thread t end def multi_toggle_archived threads undos = threads.map { |t| actually_toggle_archived t } - UndoManager.register "deleting/undeleting #{threads.size.pluralize 'thread'}", undos, lambda { regen_text } + UndoManager.register "deleting/undeleting #{threads.size.pluralize 'thread'}", undos, lambda { regen_text }, + lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -425,7 +428,7 @@ EOS undos = threads.map { |t| actually_toggle_spammed t } threads.each { |t| HookManager.run("mark-as-spam", :thread => t) } UndoManager.register "marking/unmarking #{threads.size.pluralize 'thread'} as spam", - undos, lambda { regen_text } + undos, lambda { regen_text }, lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -439,7 +442,7 @@ EOS def multi_toggle_deleted threads undos = threads.map { |t| actually_toggle_deleted t } UndoManager.register "deleting/undeleting #{threads.size.pluralize 'thread'}", - undos, lambda { regen_text } + undos, lambda { regen_text }, lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -455,6 +458,7 @@ EOS threads.each do |t| t.remove_label :killed add_or_unhide t.first + Index.save_thread t end regen_text end @@ -530,6 +534,7 @@ EOS thread.labels = old_labels update_text_for_line pos UpdateManager.relay self, :labeled, thread.first + Index.save_thread thread end UpdateManager.relay self, :labeled, thread.first @@ -567,6 +572,7 @@ EOS threads.zip(old_labels).map do |t, old_labels| t.labels = old_labels UpdateManager.relay self, :labeled, t.first + Index.save_thread t end regen_text end diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 7c0b869..b08c819 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -279,6 +279,7 @@ EOS Index.save_thread @thread UndoManager.register "labeling thread" do @thread.labels = old_labels + Index.save_thread @thread UpdateManager.relay self, :labeled, @thread.first end end @@ -527,6 +528,7 @@ EOS Index.save_thread @thread UndoManager.register "archiving 1 thread" do @thread.apply_label :inbox + Index.save_thread @thread UpdateManager.relay self, :unarchived, @thread.first end end @@ -539,6 +541,7 @@ EOS Index.save_thread @thread UndoManager.register "marking 1 thread as spam" do @thread.remove_label :spam + Index.save_thread @thread UpdateManager.relay self, :unspammed, @thread.first end end @@ -551,6 +554,7 @@ EOS Index.save_thread @thread UndoManager.register "deleting 1 thread" do @thread.remove_label :deleted + Index.save_thread @thread UpdateManager.relay self, :undeleted, @thread.first end end -- 1.6.5 From pi+sup@pihost.us Mon Jan 4 01:06:34 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Sun, 3 Jan 2010 23:06:34 -0700 Subject: [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new Message-ID: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> --- lib/sup/modes/thread-index-mode.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index eaed0cb..a5bd344 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -405,7 +405,7 @@ EOS jump_to_line n unless n >= topline && n < botline set_cursor_pos n else - BufferManager.flash "No new messages" + BufferManager.flash "No new messages." end end -- 1.6.5 From pi+sup@pihost.us Mon Jan 4 01:06:35 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Sun, 3 Jan 2010 23:06:35 -0700 Subject: [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state In-Reply-To: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> References: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> Message-ID: <1262585196-25964-2-git-send-email-pi+sup@pihost.us> --- lib/sup/modes/inbox-mode.rb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb index ad3a864..852ddb7 100644 --- a/lib/sup/modes/inbox-mode.rb +++ b/lib/sup/modes/inbox-mode.rb @@ -66,9 +66,10 @@ class InboxMode < ThreadIndexMode return unless cursor_thread thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread + was_unread = thread.labels.member? :unread UndoManager.register "reading and archiving thread" do thread.apply_label :inbox - thread.apply_label :unread + thread.apply_label :unread if was_unread add_or_unhide thread.first end -- 1.6.5 From hyperbolist@gmail.com Mon Jan 4 01:20:34 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Mon, 04 Jan 2010 01:20:34 -0500 Subject: [sup-devel] [PATCH] [issue14] poll updates accumulate while idle Message-ID: <1262585888-sup-7490@changeling.local> If you were to leave sup running for a long time, this patch would enable you to get a glance summary of new mail activity since sup was last touched, by letting the poll update message accumulate its tally while idle. On keystrokes, BufferManager sends an :unidle update if the last keystroke occurred more than :idle_threshold seconds ago. PollManager listens for :unidle updates to clear PollTally, which will otherwise accumulate. * :idle_threshold defaults to 60 seconds if not defined in config.yaml * presently no :idle update is sent when becoming idle * after-poll behavior is unaffected --- lib/sup.rb | 3 ++- lib/sup/buffer.rb | 5 +++++ lib/sup/poll.rb | 23 +++++++++++++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/sup.rb b/lib/sup.rb index 840b3fc..a6de0ab 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -229,7 +229,8 @@ else :confirm_top_posting => true, :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", - :sent_source => "sup://sent" + :sent_source => "sup://sent", + :idle_threshold => 60 } begin FileUtils.mkdir_p Redwood::BASE_DIR diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index c826ab9..c34917d 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -212,6 +212,7 @@ EOS @in_x = ENV["TERM"] =~ /(xterm|rxvt|screen)/ @sigwinch_happened = false @sigwinch_mutex = Mutex.new + @idle_since = Time.now end def sigwinch_happened!; @sigwinch_mutex.synchronize { @sigwinch_happened = true } end @@ -269,6 +270,8 @@ EOS @focus_buf.mode.cancel_search! @focus_buf.mark_dirty end + UpdateManager.relay self, :unidle, Time.at(@idle_since) if idle? + @idle_since = Time.now @focus_buf.mode.handle_input c end end @@ -797,5 +800,7 @@ private end @users end + + def idle?; Time.now.to_i - @idle_since.to_i >= ($config[:idle_threshold] || 60); end end end diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 4f30505..fb684df 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -37,6 +37,8 @@ EOS @polling = false @poll_sources = nil @mode = nil + PollTally.init + UpdateManager.register self end def poll_with_sources @@ -45,8 +47,9 @@ EOS BufferManager.flash "Polling for new messages..." num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll - if num > 0 - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" + PollTally.add :num => num, :num_inbox => numi, :loaded_labels => loaded_labels + if PollTally.num > 0 + BufferManager.flash "Loaded #{PollTally.num.pluralize 'new message'}, #{PollTally.num_inbox} to inbox. Labels: #{PollTally.loaded_labels.map{|l| l.to_s}.join(', ')}" else BufferManager.flash "No new messages." end @@ -183,6 +186,22 @@ EOS Index.add_message m UpdateManager.relay self, :added, m end + + def handle_unidle_update sender, idle_since; PollTally.clear; end +end + +class PollTally + include Singleton + attr_reader :num, :num_inbox, :loaded_labels + + def initialize; @num = 0; @num_inbox = 0; @loaded_labels = Set.new; end + def clear; @num = 0; @num_inbox = 0; @loaded_labels.clear; end + + def add opts={} + @num += opts[:num]||0 + @num_inbox += opts[:num_inbox]||0 + @loaded_labels = Set.new(opts[:loaded_labels] || []) + @loaded_labels + end end end -- 1.6.5.7 From hyperbolist@gmail.com Mon Jan 4 06:47:46 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Mon, 04 Jan 2010 06:47:46 -0500 Subject: [sup-devel] [PATCH] [issue14] poll updates accumulate while idle In-Reply-To: <1262585888-sup-7490@changeling.local> References: <1262585888-sup-7490@changeling.local> Message-ID: <1262605439-sup-7146@changeling.local> Excerpts from Eric Sherman's message of Mon Jan 04 01:20:34 -0500 2010: > If you were to leave sup running for a long time, this patch would > enable you to get a glance summary of new mail activity since sup was > last touched, by letting the poll update message accumulate its tally > while idle. > > On keystrokes, BufferManager sends an :unidle update if the last > keystroke occurred more than :idle_threshold seconds ago. PollManager > listens for :unidle updates to clear PollTally, which will otherwise > accumulate. > > * :idle_threshold defaults to 60 seconds if not defined in config.yaml > * presently no :idle update is sent when becoming idle > * after-poll behavior is unaffected > --- > lib/sup.rb | 3 ++- > lib/sup/buffer.rb | 5 +++++ > lib/sup/poll.rb | 23 +++++++++++++++++++++-- > 3 files changed, 28 insertions(+), 3 deletions(-) > > diff --git a/lib/sup.rb b/lib/sup.rb > index 840b3fc..a6de0ab 100644 > --- a/lib/sup.rb > +++ b/lib/sup.rb > @@ -229,7 +229,8 @@ else > :confirm_top_posting => true, > :discard_snippets_from_encrypted_messages => false, > :default_attachment_save_dir => "", > - :sent_source => "sup://sent" > + :sent_source => "sup://sent", > + :idle_threshold => 60 > } > begin > FileUtils.mkdir_p Redwood::BASE_DIR > diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb > index c826ab9..c34917d 100644 > --- a/lib/sup/buffer.rb > +++ b/lib/sup/buffer.rb > @@ -212,6 +212,7 @@ EOS > @in_x = ENV["TERM"] =~ /(xterm|rxvt|screen)/ > @sigwinch_happened = false > @sigwinch_mutex = Mutex.new > + @idle_since = Time.now > end > > def sigwinch_happened!; @sigwinch_mutex.synchronize { @sigwinch_happened = true } end > @@ -269,6 +270,8 @@ EOS > @focus_buf.mode.cancel_search! > @focus_buf.mark_dirty > end > + UpdateManager.relay self, :unidle, Time.at(@idle_since) if idle? > + @idle_since = Time.now > @focus_buf.mode.handle_input c > end > end > @@ -797,5 +800,7 @@ private > end > @users > end > + > + def idle?; Time.now.to_i - @idle_since.to_i >= ($config[:idle_threshold] || 60); end > end > end > diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb > index 4f30505..fb684df 100644 > --- a/lib/sup/poll.rb > +++ b/lib/sup/poll.rb > @@ -37,6 +37,8 @@ EOS > @polling = false > @poll_sources = nil > @mode = nil > + PollTally.init > + UpdateManager.register self > end > > def poll_with_sources > @@ -45,8 +47,9 @@ EOS > > BufferManager.flash "Polling for new messages..." > num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll > - if num > 0 > - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" > + PollTally.add :num => num, :num_inbox => numi, :loaded_labels => loaded_labels > + if PollTally.num > 0 > + BufferManager.flash "Loaded #{PollTally.num.pluralize 'new message'}, #{PollTally.num_inbox} to inbox. Labels: #{PollTally.loaded_labels.map{|l| l.to_s}.join(', ')}" > else > BufferManager.flash "No new messages." > end > @@ -183,6 +186,22 @@ EOS > Index.add_message m > UpdateManager.relay self, :added, m > end > + > + def handle_unidle_update sender, idle_since; PollTally.clear; end > +end > + > +class PollTally > + include Singleton > + attr_reader :num, :num_inbox, :loaded_labels > + > + def initialize; @num = 0; @num_inbox = 0; @loaded_labels = Set.new; end > + def clear; @num = 0; @num_inbox = 0; @loaded_labels.clear; end > + > + def add opts={} > + @num += opts[:num]||0 > + @num_inbox += opts[:num_inbox]||0 > + @loaded_labels = Set.new(opts[:loaded_labels] || []) + @loaded_labels > + end > end > > end Oops, please disregard this patch. If one never goes idle, one can never go unidle, and so the PollTally will never clear. I will resubmit a revised patch which clears the PollTally on polling unless idle. From hyperbolist@gmail.com Mon Jan 4 07:14:33 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Mon, 04 Jan 2010 07:14:33 -0500 Subject: [sup-devel] [PATCHv2] [issue14] poll updates accumulate while idle Message-ID: <1262607214-sup-4535@changeling.local> If you were to leave sup running for a long time, this patch would enable you to get a glance summary of new mail activity since sup was last touched, by letting the poll update message accumulate its tally while idle. On keystrokes, BufferManager sends an :unidle update if the last keystroke occurred more than :idle_threshold seconds ago. PollManager listens for :unidle updates to clear PollTally. It is also cleared on each poll unless idle. * :idle_threshold defaults to 60 seconds if not defined in config.yaml * presently no :idle update is sent when becoming idle * but we can check for idleness with BufferManager.idle? * after-poll behavior is unaffected --- lib/sup.rb | 3 ++- lib/sup/buffer.rb | 5 +++++ lib/sup/poll.rb | 24 ++++++++++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/sup.rb b/lib/sup.rb index 840b3fc..a6de0ab 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -229,7 +229,8 @@ else :confirm_top_posting => true, :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", - :sent_source => "sup://sent" + :sent_source => "sup://sent", + :idle_threshold => 60 } begin FileUtils.mkdir_p Redwood::BASE_DIR diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index c826ab9..8bf666b 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -212,6 +212,7 @@ EOS @in_x = ENV["TERM"] =~ /(xterm|rxvt|screen)/ @sigwinch_happened = false @sigwinch_mutex = Mutex.new + @idle_since = Time.now end def sigwinch_happened!; @sigwinch_mutex.synchronize { @sigwinch_happened = true } end @@ -269,6 +270,8 @@ EOS @focus_buf.mode.cancel_search! @focus_buf.mark_dirty end + UpdateManager.relay self, :unidle, Time.at(@idle_since) if idle? + @idle_since = Time.now @focus_buf.mode.handle_input c end end @@ -761,6 +764,8 @@ EOS @shelled = false end + def idle?; Time.now.to_i - @idle_since.to_i >= ($config[:idle_threshold] || 60); end + private def default_status_bar buf diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 4f30505..48228ca 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -37,6 +37,8 @@ EOS @polling = false @poll_sources = nil @mode = nil + PollTally.init + UpdateManager.register self end def poll_with_sources @@ -45,8 +47,10 @@ EOS BufferManager.flash "Polling for new messages..." num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll - if num > 0 - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" + PollTally.clear unless BufferManager.idle? + PollTally.add :num => num, :num_inbox => numi, :loaded_labels => loaded_labels + if PollTally.num > 0 + BufferManager.flash "Loaded #{PollTally.num.pluralize 'new message'}, #{PollTally.num_inbox} to inbox. Labels: #{PollTally.loaded_labels.map{|l| l.to_s}.join(', ')}" else BufferManager.flash "No new messages." end @@ -183,6 +187,22 @@ EOS Index.add_message m UpdateManager.relay self, :added, m end + + def handle_unidle_update sender, idle_since; PollTally.clear; end +end + +class PollTally + include Singleton + attr_reader :num, :num_inbox, :loaded_labels + + def initialize; @num = 0; @num_inbox = 0; @loaded_labels = Set.new; end + def clear; @num = 0; @num_inbox = 0; @loaded_labels.clear; end + + def add opts={} + @num += opts[:num]||0 + @num_inbox += opts[:num_inbox]||0 + @loaded_labels = Set.new(opts[:loaded_labels] || []) + @loaded_labels + end end end -- 1.6.5.7 From hyperbolist@gmail.com Mon Jan 4 10:23:55 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Mon, 04 Jan 2010 10:23:55 -0500 Subject: [sup-devel] [PATCH] [issue7] configurable poll interval Message-ID: <1262618580-sup-7433@changeling.local> This patch does not add configurable per-source poll intervals, but it does add a single :poll_interval which still defaults to 300 seconds if not defined in config.yaml. --- lib/sup.rb | 3 ++- lib/sup/poll.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/sup.rb b/lib/sup.rb index 840b3fc..b83bbe7 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -229,7 +229,8 @@ else :confirm_top_posting => true, :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", - :sent_source => "sup://sent" + :sent_source => "sup://sent", + :poll_interval => 300 } begin FileUtils.mkdir_p Redwood::BASE_DIR diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 4f30505..f3e1224 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -28,7 +28,7 @@ num_inbox_total_unread: the total number of unread messages in the inbox only those messages appearing in the inbox EOS - DELAY = 300 + DELAY = $config[:poll_interval] || 300 def initialize @mutex = Mutex.new -- 1.6.5.7 From sup-bugs@masanjin.net Mon Jan 4 13:11:23 2010 From: sup-bugs@masanjin.net (Ben Walton) Date: Mon, 04 Jan 2010 18:11:23 +0000 Subject: [sup-devel] [issue43] fails to start after running current next In-Reply-To: <1262628683.67.0.115853254107.issue43@masanjin.net> Message-ID: <1262628683.67.0.115853254107.issue43@masanjin.net> New submission from Ben Walton : Sup failed to start after updating to next (sha1: a1669), which is where the ruby-1.9-encoding branch was merged. It seems that my ruby doesn't like the :BINARY suffix on the file open mode introduced by commit a6bb5. Removing :BINARY from the mode parameter works for me. Eg: wr:BINARY -> wb, ab:BINARY -> ab, etc. -Ben ---------- messages: 108 nosy: bwalton priority: bug ruby_version: 1.8.5 status: unread sup_version: next/a1669 title: fails to start after running current next _________________________________________ Sup issue tracker _________________________________________ From rlane@club.cc.cmu.edu Mon Jan 4 14:19:40 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 4 Jan 2010 11:19:40 -0800 Subject: [sup-devel] [PATCH] add console commands to get/set loglevel Message-ID: <1262632780-3661-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/logger.rb | 3 ++- lib/sup/modes/console-mode.rb | 4 ++++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/lib/sup/logger.rb b/lib/sup/logger.rb index ccaeae0..ab97e47 100644 --- a/lib/sup/logger.rb +++ b/lib/sup/logger.rb @@ -14,13 +14,14 @@ class Logger def initialize level=nil level ||= ENV["SUP_LOG_LEVEL"] || "info" - @level = LEVELS.index(level) or raise ArgumentError, "invalid log level #{level.inspect}: should be one of #{LEVELS * ', '}" + self.level = level @mutex = Mutex.new @buf = StringIO.new @sinks = [] end def level; LEVELS[@level] end + def level=(level); @level = LEVELS.index(level) || raise(ArgumentError, "invalid log level #{level.inspect}: should be one of #{LEVELS * ', '}"); end def add_sink s, copy_current=true @mutex.synchronize do diff --git a/lib/sup/modes/console-mode.rb b/lib/sup/modes/console-mode.rb index e9bf47c..8ea8f38 100644 --- a/lib/sup/modes/console-mode.rb +++ b/lib/sup/modes/console-mode.rb @@ -21,6 +21,10 @@ class Console def xapian; Index.instance.instance_variable_get :@xapian; end def ferret; Index.instance.instance_variable_get :@index; end + + def loglevel; Redwood::Logger.level; end + def set_loglevel(level); Redwood::Logger.level = level; end + def special_methods; methods - Object.methods end ## files that won't cause problems when reloaded -- 1.6.3.3 From rlane@club.cc.cmu.edu Mon Jan 4 14:34:31 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 4 Jan 2010 11:34:31 -0800 Subject: [sup-devel] [PATCH] implement String#each on Ruby 1.9 for lockfile Message-ID: <1262633671-5690-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/util.rb | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 206c18a..2d3a2ad 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -290,6 +290,12 @@ class String end end + unless method_defined? :each + def each &b + each_line &b + end + end + ## takes a list of words, and returns an array of symbols. typically used in ## Sup for translating Ferret's representation of a list of labels (a string) ## to an array of label symbols. -- 1.6.3.3 From rlane@club.cc.cmu.edu Mon Jan 4 14:35:17 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 4 Jan 2010 11:35:17 -0800 Subject: [sup-devel] [PATCH] implement const_missing for Index Message-ID: <1262633717-5803-1-git-send-email-rlane@club.cc.cmu.edu> Otherwise, constant references to LockError and ParseError will fail. --- This should be added to the ruby-1.9-encoding branch. lib/sup/index.rb | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/sup/index.rb b/lib/sup/index.rb index f02c96b..8a4b8f2 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -234,6 +234,7 @@ class Index def self.instance; @obj end def self.method_missing m, *a, &b; @obj.send(m, *a, &b) end + def self.const_missing x; @obj.class.const_get(x) end end end -- 1.6.3.3 From wmorgan-sup@masanjin.net Mon Jan 4 14:43:58 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 04 Jan 2010 11:43:58 -0800 Subject: [sup-devel] [PATCH] implement const_missing for Index In-Reply-To: <1262633717-5803-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262633717-5803-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262634229-sup-3258@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-04: > This should be added to the ruby-1.9-encoding branch. Not to ferret-deprecation? -- William From rlane@club.cc.cmu.edu Mon Jan 4 14:45:42 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 4 Jan 2010 11:45:42 -0800 Subject: [sup-devel] [PATCH] only open mail files in binary mode on Ruby 1.9 Message-ID: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/maildir.rb | 4 ++-- lib/sup/mbox/loader.rb | 4 ++-- lib/sup/util.rb | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index 0852576..b2c5847 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -59,7 +59,7 @@ class Maildir < Source File.stat(tmp_path) rescue Errno::ENOENT #this is what we want. begin - File.open(tmp_path, 'wb:BINARY') do |f| + File.open_binary(tmp_path, 'w') do |f| yield f #provide a writable interface for the caller f.fsync end @@ -207,7 +207,7 @@ private def with_file_for id fn = @ids_to_fns[id] or raise OutOfSyncSourceError, "No such id: #{id.inspect}." begin - File.open(fn, 'rb:BINARY') { |f| yield f } + File.open_binary(fn, 'r') { |f| yield f } rescue SystemCallError, IOError => e raise FatalSourceError, "Problem reading file for id #{id.inspect}: #{fn.inspect}: #{e.message}." end diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb index ec28d3b..557c13b 100644 --- a/lib/sup/mbox/loader.rb +++ b/lib/sup/mbox/loader.rb @@ -22,7 +22,7 @@ class Loader < Source raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox" raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" if uri.host raise ArgumentError, "mbox URI must have a path component" unless uri.path - @f = File.open uri.path, 'rb:BINARY' + @f = File.open_binary uri.path, 'r' @path = uri.path else @f = uri_or_fp @@ -114,7 +114,7 @@ class Loader < Source def store_message date, from_email, &block need_blank = File.exists?(@filename) && !File.zero?(@filename) - File.open(@filename, "ab:BINARY") do |f| + File.open_binary(@filename, "a") do |f| f.puts if need_blank f.puts "From #{from_email} #{date.rfc2822}" yield f diff --git a/lib/sup/util.rb b/lib/sup/util.rb index c27e527..e8f3289 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -691,3 +691,10 @@ class Iconv end end end + +class File + def self.open_binary filename, mode + mode += 'b:BINARY' if String.method_defined? :encoding + open filename, mode + end +end -- 1.6.3.3 From rlane@club.cc.cmu.edu Mon Jan 4 14:48:13 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 04 Jan 2010 14:48:13 -0500 Subject: [sup-devel] [PATCH] implement const_missing for Index In-Reply-To: <1262634229-sup-3258@masanjin.net> References: <1262633717-5803-1-git-send-email-rlane@club.cc.cmu.edu> <1262634229-sup-3258@masanjin.net> Message-ID: <1262634455-sup-4406@zyrg.net> Excerpts from William Morgan's message of 2010-01-04 14:43:58 -0500: > Reformatted excerpts from Rich Lane's message of 2010-01-04: > > This should be added to the ruby-1.9-encoding branch. > > Not to ferret-deprecation? Oh, right, sorry. Airports are messing with my brain. From pi+sup@pihost.us Tue Jan 5 12:20:24 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Tue, 5 Jan 2010 10:20:24 -0700 Subject: [sup-devel] [PATCH] fix up options for sup-sync-back, tweak-labels Message-ID: <1262712024-25264-1-git-send-email-pi+sup@pihost.us> These two violate the convention of the other scripts inside bin/ by using a local variable for their Trollop results. --- bin/sup-sync-back | 2 +- bin/sup-tweak-labels | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/sup-sync-back b/bin/sup-sync-back index 19e6230..40c1e1c 100755 --- a/bin/sup-sync-back +++ b/bin/sup-sync-back @@ -66,7 +66,7 @@ EOS end Redwood::start -index = Redwood::Index.init $opts[:index] +index = Redwood::Index.init opts[:index] index.lock_interactively or exit deleted_fp, spam_fp = nil diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels index f603502..bf36a32 100755 --- a/bin/sup-tweak-labels +++ b/bin/sup-tweak-labels @@ -61,7 +61,7 @@ remove_labels = opts[:remove].to_set_of_symbols "," Trollop::die "nothing to do: no labels to add or remove" if add_labels.empty? && remove_labels.empty? Redwood::start -index = Redwood::Index.init $opts[:index] +index = Redwood::Index.init opts[:index] index.lock_interactively or exit begin index.load -- 1.6.5 From wmorgan-sup@masanjin.net Tue Jan 5 16:01:30 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:01:30 -0800 Subject: [sup-devel] [PATCH] xapian: translate from/to query term prefixes to search over both name and email fields In-Reply-To: <1262407046-2029-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262407046-2029-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262725281-sup-9273@masanjin.net> Branch xapain-name-email, merged into next. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:02:56 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:02:56 -0800 Subject: [sup-devel] [PATCH 3/3] add keybinding 'Oc' to reload colors In-Reply-To: <1262532260-18353-3-git-send-email-rlane@club.cc.cmu.edu> References: <1262532260-18353-1-git-send-email-rlane@club.cc.cmu.edu> <1262532260-18353-2-git-send-email-rlane@club.cc.cmu.edu> <1262532260-18353-3-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262725368-sup-9219@masanjin.net> Branch colors, merged into next. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:04:24 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:04:24 -0800 Subject: [sup-devel] [PATCH] add a mouse-enabled colorpicker to contrib In-Reply-To: <1262532808-19401-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262532808-19401-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262725450-sup-277@masanjin.net> I've also thrown this on the colors branch. Looks fun! -- William From ezyang@MIT.EDU Tue Jan 5 16:06:10 2010 From: ezyang@MIT.EDU (Edward Z. Yang) Date: Tue, 05 Jan 2010 16:06:10 -0500 Subject: [sup-devel] [PATCH] xapian: translate from/to query term prefixes to search over both name and email fields In-Reply-To: <1262407046-2029-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262407046-2029-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262725553-sup-8271@ezyang> At last! Good patch. Cheers, Edward From wmorgan-sup@masanjin.net Tue Jan 5 16:25:18 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:25:18 -0800 Subject: [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new In-Reply-To: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> References: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> Message-ID: <1262726709-sup-1303@masanjin.net> Applied directly to master. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:25:29 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:25:29 -0800 Subject: [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state In-Reply-To: <1262585196-25964-2-git-send-email-pi+sup@pihost.us> References: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> <1262585196-25964-2-git-send-email-pi+sup@pihost.us> Message-ID: <1262726721-sup-9317@masanjin.net> Applied directly to master. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:26:42 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:26:42 -0800 Subject: [sup-devel] [PATCH 3/3] make the undo hooks also save the threads In-Reply-To: <1262585196-25964-3-git-send-email-pi+sup@pihost.us> References: <1262585196-25964-1-git-send-email-pi+sup@pihost.us> <1262585196-25964-2-git-send-email-pi+sup@pihost.us> <1262585196-25964-3-git-send-email-pi+sup@pihost.us> Message-ID: <1262726732-sup-3562@masanjin.net> Sorry to be a pain. Can you resend this patch against the insta-save branch? (It looks like I don't have the necessary blobs for a 3-way merge, so I suspect you generated this against an unpublished commit?) -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:30:58 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:30:58 -0800 Subject: [sup-devel] [PATCH] [issue7] configurable poll interval In-Reply-To: <1262618580-sup-7433@changeling.local> References: <1262618580-sup-7433@changeling.local> Message-ID: <1262727050-sup-1624@masanjin.net> Applied to master. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:33:44 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:33:44 -0800 Subject: [sup-devel] [PATCH] add console commands to get/set loglevel In-Reply-To: <1262632780-3661-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262632780-3661-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262727217-sup-9167@masanjin.net> Applied to master. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:34:10 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:34:10 -0800 Subject: [sup-devel] [PATCH] implement String#each on Ruby 1.9 for lockfile In-Reply-To: <1262633671-5690-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262633671-5690-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262727237-sup-9108@masanjin.net> So lame. Applied to master. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:50:18 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:50:18 -0800 Subject: [sup-devel] [PATCH] implement const_missing for Index In-Reply-To: <1262633717-5803-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262633717-5803-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262728206-sup-3668@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-04: > Otherwise, constant references to LockError and ParseError will fail. Applied to ferret-deprecation and remerged into next. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 16:58:35 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 13:58:35 -0800 Subject: [sup-devel] [PATCH] fix up options for sup-sync-back, tweak-labels In-Reply-To: <1262712024-25264-1-git-send-email-pi+sup@pihost.us> References: <1262712024-25264-1-git-send-email-pi+sup@pihost.us> Message-ID: <1262728682-sup-9444@masanjin.net> Reformatted excerpts from Anthony Martinez's message of 2010-01-05: > These two violate the convention of the other scripts inside bin/ by > using a local variable for their Trollop results. I actually prefer the non-global-variable version, so maybe should say the other scripts violate the convention. :) Branch ferret-deprecation, remerged into next. Thanks! -- William From wmorgan-sup@masanjin.net Tue Jan 5 17:05:21 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 14:05:21 -0800 Subject: [sup-devel] [PATCH] only open mail files in binary mode on Ruby 1.9 In-Reply-To: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1262729069-sup-2235@masanjin.net> Applied to ruby-1.9-encodings. I added another commit to make it pass through any block, otherwise it was silently failing on my 1.8.7 setup. Hope it still works for 1.9. :) Thanks! -- William From pi+sup@pihost.us Tue Jan 5 17:45:38 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Tue, 5 Jan 2010 15:45:38 -0700 Subject: [sup-devel] [PATCH-insta-save] make the undo hooks also save the threads In-Reply-To: <1262726732-sup-3562@masanjin.net> References: <1262726732-sup-3562@masanjin.net> Message-ID: <1262731539-29227-1-git-send-email-pi+sup@pihost.us> As requested, a patch against insta-save. Hopefully this works out better. I generated this by rebasing my local next onto origin/next, then checked out a local insta-save and cherry-picked next. There shouldn't be any dependences on unpublished commits, though, git says my next is only head by this one patch. From pi+sup@pihost.us Tue Jan 5 17:45:39 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Tue, 5 Jan 2010 15:45:39 -0700 Subject: [sup-devel] [PATCH] make the undo hooks also save the threads In-Reply-To: <1262731539-29227-1-git-send-email-pi+sup@pihost.us> References: <1262726732-sup-3562@masanjin.net> <1262731539-29227-1-git-send-email-pi+sup@pihost.us> Message-ID: <1262731539-29227-2-git-send-email-pi+sup@pihost.us> Since there is no explicit sync any longer, any action that has an Index.save_thread must also repeat the save when the action is undone. Failure to do this will result in an exception upon quit when the index notices that there are still dirty messages. --- lib/sup/modes/inbox-mode.rb | 4 ++++ lib/sup/modes/thread-index-mode.rb | 18 ++++++++++++------ lib/sup/modes/thread-view-mode.rb | 4 ++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb index 9220925..e2452e5 100644 --- a/lib/sup/modes/inbox-mode.rb +++ b/lib/sup/modes/inbox-mode.rb @@ -29,6 +29,7 @@ class InboxMode < ThreadIndexMode UndoManager.register "archiving thread" do thread.apply_label :inbox add_or_unhide thread.first + Index.save_thread thread end cursor_thread.remove_label :inbox @@ -42,6 +43,7 @@ class InboxMode < ThreadIndexMode threads.map do |t| t.apply_label :inbox add_or_unhide t.first + Index.save_thread t end regen_text end @@ -62,6 +64,7 @@ class InboxMode < ThreadIndexMode thread.apply_label :inbox thread.apply_label :unread add_or_unhide thread.first + Index.save_thread thread end cursor_thread.remove_label :unread @@ -85,6 +88,7 @@ class InboxMode < ThreadIndexMode threads.zip(old_labels).each do |t, l| t.labels = l add_or_unhide t.first + Index.save_thread t end regen_text end diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index bbc9044..7808190 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -265,7 +265,7 @@ EOS def toggle_starred t = cursor_thread or return undo = actually_toggle_starred t - UndoManager.register "toggling thread starred status", undo + UndoManager.register "toggling thread starred status", undo, lambda { Index.save_thread t } update_text_for_line curpos cursor_down Index.save_thread t @@ -273,7 +273,8 @@ EOS def multi_toggle_starred threads UndoManager.register "toggling #{threads.size.pluralize 'thread'} starred status", - threads.map { |t| actually_toggle_starred t } + threads.map { |t| actually_toggle_starred t }, + lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -351,14 +352,16 @@ EOS def toggle_archived t = cursor_thread or return undo = actually_toggle_archived t - UndoManager.register "deleting/undeleting thread #{t.first.id}", undo, lambda { update_text_for_line curpos } + UndoManager.register "deleting/undeleting thread #{t.first.id}", undo, lambda { update_text_for_line curpos }, + lambda { Index.save_thread t } update_text_for_line curpos Index.save_thread t end def multi_toggle_archived threads undos = threads.map { |t| actually_toggle_archived t } - UndoManager.register "deleting/undeleting #{threads.size.pluralize 'thread'}", undos, lambda { regen_text } + UndoManager.register "deleting/undeleting #{threads.size.pluralize 'thread'}", undos, lambda { regen_text }, + lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -425,7 +428,7 @@ EOS def multi_toggle_spam threads undos = threads.map { |t| actually_toggle_spammed t } UndoManager.register "marking/unmarking #{threads.size.pluralize 'thread'} as spam", - undos, lambda { regen_text } + undos, lambda { regen_text }, lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -439,7 +442,7 @@ EOS def multi_toggle_deleted threads undos = threads.map { |t| actually_toggle_deleted t } UndoManager.register "deleting/undeleting #{threads.size.pluralize 'thread'}", - undos, lambda { regen_text } + undos, lambda { regen_text }, lambda { threads.each { |t| Index.save_thread t } } regen_text threads.each { |t| Index.save_thread t } end @@ -455,6 +458,7 @@ EOS threads.each do |t| t.remove_label :killed add_or_unhide t.first + Index.save_thread t end regen_text end @@ -530,6 +534,7 @@ EOS thread.labels = old_labels update_text_for_line pos UpdateManager.relay self, :labeled, thread.first + Index.save_thread thread end UpdateManager.relay self, :labeled, thread.first @@ -567,6 +572,7 @@ EOS threads.zip(old_labels).map do |t, old_labels| t.labels = old_labels UpdateManager.relay self, :labeled, t.first + Index.save_thread t end regen_text end diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 99abb04..ddac113 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -262,6 +262,7 @@ EOS Index.save_thread @thread UndoManager.register "labeling thread" do @thread.labels = old_labels + Index.save_thread @thread UpdateManager.relay self, :labeled, @thread.first end end @@ -484,6 +485,7 @@ EOS Index.save_thread @thread UndoManager.register "archiving 1 thread" do @thread.apply_label :inbox + Index.save_thread @thread UpdateManager.relay self, :unarchived, @thread.first end end @@ -496,6 +498,7 @@ EOS Index.save_thread @thread UndoManager.register "marking 1 thread as spam" do @thread.remove_label :spam + Index.save_thread @thread UpdateManager.relay self, :unspammed, @thread.first end end @@ -508,6 +511,7 @@ EOS Index.save_thread @thread UndoManager.register "deleting 1 thread" do @thread.remove_label :deleted + Index.save_thread @thread UpdateManager.relay self, :undeleted, @thread.first end end -- 1.6.5 From wmorgan-sup@masanjin.net Tue Jan 5 18:47:08 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 05 Jan 2010 15:47:08 -0800 Subject: [sup-devel] [PATCH-insta-save] make the undo hooks also save the threads In-Reply-To: <1262731539-29227-1-git-send-email-pi+sup@pihost.us> References: <1262726732-sup-3562@masanjin.net> <1262731539-29227-1-git-send-email-pi+sup@pihost.us> Message-ID: <1262735108-sup-1634@masanjin.net> Reformatted excerpts from Anthony Martinez's message of 2010-01-05: > As requested, a patch against insta-save. Hopefully this works out better. Applied to insta-save and remerged into next. Thanks! > I generated this by rebasing my local next onto origin/next, then > checked out a local insta-save and cherry-picked next. There shouldn't > be any dependences on unpublished commits, though, git says my next is > only head by this one patch. Ah, the magic of git! Thanks for all your recent patches, btw. Top notch stuff. -- William From wmorgan-sup@masanjin.net Wed Jan 6 11:35:55 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Wed, 06 Jan 2010 08:35:55 -0800 Subject: [sup-devel] [PATCH] only open mail files in binary mode on Ruby 1.9 In-Reply-To: <1262729069-sup-2235@masanjin.net> References: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> <1262729069-sup-2235@masanjin.net> Message-ID: <1262795751-sup-4525@masanjin.net> Reformatted excerpts from William Morgan's message of 2010-01-05: > Applied to ruby-1.9-encodings. I added another commit to make it pass > through any block, otherwise it was silently failing on my 1.8.7 setup. > Hope it still works for 1.9. :) Thanks! The internet claims that using "rb" and "wb" works for both 1.8.5 and 1.9.1, but I haven't tried it. -- William From rlane@club.cc.cmu.edu Wed Jan 6 22:34:18 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Wed, 6 Jan 2010 19:34:18 -0800 Subject: [sup-devel] [PATCH] call index.load in sup-add Message-ID: <1262835258-6130-1-git-send-email-rlane@club.cc.cmu.edu> If it's going to call index.save, it needs to load it first. --- bin/sup-add | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/bin/sup-add b/bin/sup-add index c53378d..a7a3752 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -86,6 +86,7 @@ end $terminal.wrap_at = :auto Redwood::start index = Redwood::Index.init +index.load index.lock_interactively or exit -- 1.6.5.2 From sup-bugs@masanjin.net Thu Jan 7 06:19:50 2010 From: sup-bugs@masanjin.net (Gregor Hoffleit) Date: Thu, 07 Jan 2010 11:19:50 +0000 Subject: [sup-devel] [issue44] Inbox mode: Cursor should stick to current message when new messages are polled in In-Reply-To: <1262863190.45.0.140099138564.issue44@masanjin.net> Message-ID: <1262863190.45.0.140099138564.issue44@masanjin.net> New submission from Gregor Hoffleit : When new messages are polled in during inbox mode, the cursor should move down along with the current message. Currently, when new messages are polled in while in inbox mode, the cursor stays at the same display line, while the old messages are pushed down. Consequently, the cursor ends up on another message. Every once in a while I end up tagging/archiving wrongs threads due to this misbehavior. ---------- messages: 109 nosy: flight priority: bug ruby_version: 1.8.7 status: unread sup_version: next/dd641 title: Inbox mode: Cursor should stick to current message when new messages are polled in _________________________________________ Sup issue tracker _________________________________________ From hyperbolist@gmail.com Tue Jan 12 09:51:02 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Tue, 12 Jan 2010 09:51:02 -0500 Subject: [sup-devel] [PATCHv2] [issue14] poll updates accumulate while idle In-Reply-To: <1262607214-sup-4535@changeling.local> References: <1262607214-sup-4535@changeling.local> Message-ID: <1263307713-sup-7005@changeling.local> Excerpts from Eric Sherman's message of Mon Jan 04 07:14:33 -0500 2010: > If you were to leave sup running for a long time, this patch would > enable you to get a glance summary of new mail activity since sup was > last touched, by letting the poll update message accumulate its tally > while idle. > > On keystrokes, BufferManager sends an :unidle update if the last > keystroke occurred more than :idle_threshold seconds ago. PollManager > listens for :unidle updates to clear PollTally. It is also cleared on > each poll unless idle. > > * :idle_threshold defaults to 60 seconds if not defined in config.yaml > * presently no :idle update is sent when becoming idle > * but we can check for idleness with BufferManager.idle? > * after-poll behavior is unaffected > --- > lib/sup.rb | 3 ++- > lib/sup/buffer.rb | 5 +++++ > lib/sup/poll.rb | 24 ++++++++++++++++++++++-- > 3 files changed, 29 insertions(+), 3 deletions(-) > > diff --git a/lib/sup.rb b/lib/sup.rb > index 840b3fc..a6de0ab 100644 > --- a/lib/sup.rb > +++ b/lib/sup.rb > @@ -229,7 +229,8 @@ else > :confirm_top_posting => true, > :discard_snippets_from_encrypted_messages => false, > :default_attachment_save_dir => "", > - :sent_source => "sup://sent" > + :sent_source => "sup://sent", > + :idle_threshold => 60 > } > begin > FileUtils.mkdir_p Redwood::BASE_DIR > diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb > index c826ab9..8bf666b 100644 > --- a/lib/sup/buffer.rb > +++ b/lib/sup/buffer.rb > @@ -212,6 +212,7 @@ EOS > @in_x = ENV["TERM"] =~ /(xterm|rxvt|screen)/ > @sigwinch_happened = false > @sigwinch_mutex = Mutex.new > + @idle_since = Time.now > end > > def sigwinch_happened!; @sigwinch_mutex.synchronize { @sigwinch_happened = true } end > @@ -269,6 +270,8 @@ EOS > @focus_buf.mode.cancel_search! > @focus_buf.mark_dirty > end > + UpdateManager.relay self, :unidle, Time.at(@idle_since) if idle? > + @idle_since = Time.now > @focus_buf.mode.handle_input c > end > end > @@ -761,6 +764,8 @@ EOS > @shelled = false > end > > + def idle?; Time.now.to_i - @idle_since.to_i >= ($config[:idle_threshold] || 60); end > + > private > > def default_status_bar buf > diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb > index 4f30505..48228ca 100644 > --- a/lib/sup/poll.rb > +++ b/lib/sup/poll.rb > @@ -37,6 +37,8 @@ EOS > @polling = false > @poll_sources = nil > @mode = nil > + PollTally.init > + UpdateManager.register self > end > > def poll_with_sources > @@ -45,8 +47,10 @@ EOS > > BufferManager.flash "Polling for new messages..." > num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll > - if num > 0 > - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" > + PollTally.clear unless BufferManager.idle? > + PollTally.add :num => num, :num_inbox => numi, :loaded_labels => loaded_labels > + if PollTally.num > 0 > + BufferManager.flash "Loaded #{PollTally.num.pluralize 'new message'}, #{PollTally.num_inbox} to inbox. Labels: #{PollTally.loaded_labels.map{|l| l.to_s}.join(', ')}" > else > BufferManager.flash "No new messages." > end > @@ -183,6 +187,22 @@ EOS > Index.add_message m > UpdateManager.relay self, :added, m > end > + > + def handle_unidle_update sender, idle_since; PollTally.clear; end > +end > + > +class PollTally > + include Singleton > + attr_reader :num, :num_inbox, :loaded_labels > + > + def initialize; @num = 0; @num_inbox = 0; @loaded_labels = Set.new; end > + def clear; @num = 0; @num_inbox = 0; @loaded_labels.clear; end > + > + def add opts={} > + @num += opts[:num]||0 > + @num_inbox += opts[:num_inbox]||0 > + @loaded_labels = Set.new(opts[:loaded_labels] || []) + @loaded_labels > + end > end > > end What manner of reimplementation would increase this patch's likelihood for inclusion? Or is my whole approach JustWrong for sup? * @idle_since should probably be renamed to @no_keystrokes_since * PollTally should probably be replaced by a hash Aside from its ugliness I'm happy with the result: running poll totals while idle. An alternative implementation with the above changes follows in reply, but it's probably still too ugly for inclusion. From hyperbolist@gmail.com Tue Jan 12 09:56:21 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Tue, 12 Jan 2010 09:56:21 -0500 Subject: [sup-devel] [PATCHv3] [issue14] poll updates accumulate while idle In-Reply-To: <1263307713-sup-7005@changeling.local> References: <1262607214-sup-4535@changeling.local> <1263307713-sup-7005@changeling.local> Message-ID: <1263308149-sup-5426@changeling.local> If you were to leave sup running for a long time, this patch would enable you to get a glance summary of new mail activity since sup was last touched, by letting the poll update message accumulate its totals while idle. On keystrokes, BufferManager sends an :unidle update if the last keystroke occurred more than :idle_threshold seconds ago. PollManager listens for :unidle updates to clear @running_totals, which is also cleared on each poll unless idle. * :idle_threshold defaults to 60 seconds if not defined in config.yaml * presently no :idle update is sent when becoming idle * but we can check for idleness with BufferManager.idle? * after-poll behavior is unaffected --- lib/sup.rb | 3 ++- lib/sup/buffer.rb | 5 +++++ lib/sup/poll.rb | 13 +++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/sup.rb b/lib/sup.rb index b83bbe7..e228772 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -230,7 +230,8 @@ else :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", :sent_source => "sup://sent", - :poll_interval => 300 + :poll_interval => 300, + :idle_threshold => 60 } begin FileUtils.mkdir_p Redwood::BASE_DIR diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index c826ab9..2f5eaa8 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -212,6 +212,7 @@ EOS @in_x = ENV["TERM"] =~ /(xterm|rxvt|screen)/ @sigwinch_happened = false @sigwinch_mutex = Mutex.new + @no_keystrokes_since = Time.now end def sigwinch_happened!; @sigwinch_mutex.synchronize { @sigwinch_happened = true } end @@ -269,6 +270,8 @@ EOS @focus_buf.mode.cancel_search! @focus_buf.mark_dirty end + UpdateManager.relay self, :unidle, Time.at(@no_keystrokes_since) if idle? + @no_keystrokes_since = Time.now @focus_buf.mode.handle_input c end end @@ -761,6 +764,8 @@ EOS @shelled = false end + def idle?; Time.now.to_i - @no_keystrokes_since.to_i >= ($config[:idle_threshold] || 60); end + private def default_status_bar buf diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index f3e1224..ad51647 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -37,6 +37,8 @@ EOS @polling = false @poll_sources = nil @mode = nil + clear_running_totals + UpdateManager.register self end def poll_with_sources @@ -45,8 +47,12 @@ EOS BufferManager.flash "Polling for new messages..." num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll - if num > 0 - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" + clear_running_totals unless BufferManager.idle? + @running_totals[:num] += num + @running_totals[:numi] += numi + @running_totals[:loaded_labels] += loaded_labels || [] + if @running_totals[:num] > 0 + BufferManager.flash "Loaded #{@running_totals[:num].pluralize 'new message'}, #{@running_totals[:numi]} to inbox. Labels: #{@running_totals[:loaded_labels].map{|l| l.to_s}.join(', ')}" else BufferManager.flash "No new messages." end @@ -183,6 +189,9 @@ EOS Index.add_message m UpdateManager.relay self, :added, m end + + def handle_unidle_update sender, idle_since; clear_running_totals; end + def clear_running_totals; @running_totals = {:num => 0, :numi => 0, :loaded_labels => Set.new}; end end end -- 1.6.6 From hyperbolist@gmail.com Tue Jan 12 15:12:04 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Tue, 12 Jan 2010 15:12:04 -0500 Subject: [sup-devel] [PATCH] [issue44] cursor sticks to thread Message-ID: <1263327054-sup-3431@changeling.local> The cursor will track the thread it is on when that thread is moved up or down on the screen as threads are added or removed from the view. --- lib/sup/modes/thread-index-mode.rb | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a5bd344..9e70ec8 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -219,6 +219,10 @@ EOS end def update + ## remember the thread we are on and where the cursor is before we update + old_cursor_thread = cursor_thread + old_cursor_position = curpos + @mutex.synchronize do ## let's see you do THIS in python @threads = @ts.threads.select { |t| !@hidden_threads[t] }.sort_by { |t| [t.date, t.first.id] }.reverse @@ -226,6 +230,11 @@ EOS @size_widget_width = @size_widgets.max_of { |w| w.display_length } end + ## if the thread moved on screen, move the cursor to its new position + new_cursor_position = @threads.index(old_cursor_thread)||0 + (old_cursor_position..(new_cursor_position-1)).each { |x| cursor_down } + (new_cursor_position..(old_cursor_position-1)).each { |x| cursor_up } + regen_text end -- 1.6.6 From hyperbolist@gmail.com Tue Jan 12 15:36:13 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Tue, 12 Jan 2010 15:36:13 -0500 Subject: [sup-devel] [PATCHv2] [issue44] cursor sticks to thread Message-ID: <1263328554-sup-8440@changeling.local> This is much more concise version, using set_cursor_pos instead of cursor_up and cursor_down. The cursor will track the thread it is on when that thread is moved up or down on the screen as threads are added or removed from the view. --- lib/sup/modes/thread-index-mode.rb | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a5bd344..40f622b 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -219,12 +219,14 @@ EOS end def update + old_cursor_thread = cursor_thread @mutex.synchronize do ## let's see you do THIS in python @threads = @ts.threads.select { |t| !@hidden_threads[t] }.sort_by { |t| [t.date, t.first.id] }.reverse @size_widgets = @threads.map { |t| size_widget_for_thread t } @size_widget_width = @size_widgets.max_of { |w| w.display_length } end + set_cursor_pos @threads.index(old_cursor_thread)||curpos regen_text end -- 1.6.6 From hyperbolist@gmail.com Wed Jan 13 08:56:44 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Wed, 13 Jan 2010 08:56:44 -0500 Subject: [sup-devel] [PATCH] idle and unidle updates Message-ID: <1263390213-sup-2608@changeling.local> After talking it over with Rich Lane who suggested I check for idleness near the unblocking_getch loop, it made sense to separate it out into its own patch. The :idle and :unidle updates are relayed only once, when transitioning from one state to the other. * Is setting 'main' as the relay sender a problem? * Is there anything more meaningful to send as the payload than the time of the last keystroke? --- bin/sup | 16 ++++++++++++++++ lib/sup.rb | 3 ++- 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/bin/sup b/bin/sup index 19b2a87..f4261f4 100755 --- a/bin/sup +++ b/bin/sup @@ -260,6 +260,9 @@ begin SearchResultsMode.spawn_from_query $opts[:search] end + no_keystrokes_since = Time.now + idle = false + until Redwood::exceptions.nonempty? || $die c = begin Ncurses.nonblocking_getch @@ -274,9 +277,22 @@ begin debug "redrawing screen on sigwinch" BufferManager.completely_redraw_screen end + + if !idle and Time.now.to_i - no_keystrokes_since.to_i >= ($config[:idle_threshold] || 60) + UpdateManager.relay self, :idle, Time.at(no_keystrokes_since) + idle = true + end + next end + if idle + UpdateManager.relay self, :unidle, Time.at(no_keystrokes_since) + idle = false + end + + no_keystrokes_since = Time.now + if c == 410 ## this is ncurses's way of telling us it's detected a refresh. ## since we have our own sigwinch handler, we don't do anything. diff --git a/lib/sup.rb b/lib/sup.rb index b83bbe7..e228772 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -230,7 +230,8 @@ else :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", :sent_source => "sup://sent", - :poll_interval => 300 + :poll_interval => 300, + :idle_threshold => 60 } begin FileUtils.mkdir_p Redwood::BASE_DIR -- 1.6.6 From rlane@club.cc.cmu.edu Wed Jan 13 13:13:40 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Wed, 13 Jan 2010 10:13:40 -0800 Subject: [sup-devel] [PATCH] fix ask_for_contacts on Ruby 1.9 Message-ID: <1263406420-27036-1-git-send-email-rlane@club.cc.cmu.edu> From: Rich Lane String doesn't respond to :map anymore. The previous code was also joining with " " instead of ", ", which was broken. --- lib/sup/buffer.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index c826ab9..990dd4a 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -537,7 +537,7 @@ EOS end def ask_for_contacts domain, question, default_contacts=[] - default = default_contacts.map { |s| s.to_s }.join(" ") + default = default_contacts.is_a?(String) ? default_contacts : default_contacts.map { |s| s.to_s }.join(", ") default += " " unless default.empty? recent = Index.load_contacts(AccountManager.user_emails, :num => 10).map { |c| [c.full_address, c.email] } -- 1.6.3.3 From wmorgan-sup@masanjin.net Thu Jan 14 08:55:00 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Thu, 14 Jan 2010 08:55:00 -0500 Subject: [sup-devel] [PATCH] call index.load in sup-add In-Reply-To: <1262835258-6130-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262835258-6130-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263477241-sup-4943@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-06: > If it's going to call index.save, it needs to load it first. Applied to master, thanks! -- William From wmorgan-sup@masanjin.net Thu Jan 14 09:15:57 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Thu, 14 Jan 2010 09:15:57 -0500 Subject: [sup-devel] [PATCHv3] [issue14] poll updates accumulate while idle In-Reply-To: <1263308149-sup-5426@changeling.local> References: <1262607214-sup-4535@changeling.local> <1263307713-sup-7005@changeling.local> <1263308149-sup-5426@changeling.local> Message-ID: <1263478428-sup-8860@masanjin.net> Reformatted excerpts from Eric Sherman's message of 2010-01-12: > If you were to leave sup running for a long time, this patch would > enable you to get a glance summary of new mail activity since sup was > last touched, by letting the poll update message accumulate its totals > while idle. I like this. My only request is that idle_threshold be a hard-coded constant in buffer.rb, since I'm trying to avoid config-bloat. -- William From wmorgan-sup@masanjin.net Thu Jan 14 09:22:45 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Thu, 14 Jan 2010 09:22:45 -0500 Subject: [sup-devel] [PATCH] idle and unidle updates In-Reply-To: <1263390213-sup-2608@changeling.local> References: <1263390213-sup-2608@changeling.local> Message-ID: <1263478703-sup-3527@masanjin.net> Reformatted excerpts from Eric Sherman's message of 2010-01-13: > After talking it over with Rich Lane who suggested I check for idleness > near the unblocking_getch loop, it made sense to separate it out into its > own patch. Yes, I like this even better, with the same caveat as before about the config option. > * Is setting 'main' as the relay sender a problem? I don't think so. > * Is there anything more meaningful to send as the payload than the time of > the last keystroke? Probably not. Not a big deal either way. Are you going to send a second patch that makes use of these events to do the accumulation? -- William From hyperbolist@gmail.com Thu Jan 14 09:21:45 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 14 Jan 2010 09:21:45 -0500 Subject: [sup-devel] [PATCHv3] [issue14] poll updates accumulate while idle In-Reply-To: <1263478428-sup-8860@masanjin.net> References: <1262607214-sup-4535@changeling.local> <1263307713-sup-7005@changeling.local> <1263308149-sup-5426@changeling.local> <1263478428-sup-8860@masanjin.net> Message-ID: <1263478890-sup-9356@changeling.local> Excerpts from William Morgan's message of Thu Jan 14 09:15:57 -0500 2010: > Reformatted excerpts from Eric Sherman's message of 2010-01-12: > > If you were to leave sup running for a long time, this patch would > > enable you to get a glance summary of new mail activity since sup was > > last touched, by letting the poll update message accumulate its totals > > while idle. > > I like this. My only request is that idle_threshold be a hard-coded > constant in buffer.rb, since I'm trying to avoid config-bloat. Ok. I've since separated the idleness out into its own patch submitted yesterday. Is 60 seconds a sensible threshold? From hyperbolist@gmail.com Thu Jan 14 09:31:22 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 14 Jan 2010 09:31:22 -0500 Subject: [sup-devel] [PATCH] idle and unidle updates In-Reply-To: <1263478703-sup-3527@masanjin.net> References: <1263390213-sup-2608@changeling.local> <1263478703-sup-3527@masanjin.net> Message-ID: <1263479269-sup-3220@changeling.local> Excerpts from William Morgan's message of Thu Jan 14 09:22:45 -0500 2010: > Are you going to send a second patch that makes use of these events to > do the accumulation? Yes. I wanted to wait till this was accepted though since I wasn't sure about submitting a patch that depends on another patch. From eg@gaute.vetsj.com Thu Jan 14 09:39:34 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Thu, 14 Jan 2010 15:39:34 +0100 Subject: [sup-devel] feature request: mute thread Message-ID: <1263479817-sup-6114@dolk> Greetings, Future feature request: ability to Mute threads - ala GMail's feature. I don't think this needs much elaboration, but I often end up archiving the same thread 19 times - especially different mailing lists where I would still like the threads to show up in the inbox in the first place. - Gaute -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From bwalton@artsci.utoronto.ca Thu Jan 14 09:55:43 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Thu, 14 Jan 2010 09:55:43 -0500 Subject: [sup-devel] feature request: mute thread In-Reply-To: <1263479817-sup-6114@dolk> References: <1263479817-sup-6114@dolk> Message-ID: <1263480927-sup-7353@ntdws12.chass.utoronto.ca> Excerpts from Gaute Hope's message of Thu Jan 14 09:39:34 -0500 2010: > Future feature request: ability to Mute threads - ala GMail's > feature. Already there. See the & key in index/inbox view. It's called kill, but the effect is what you're after. HTH. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From hyperbolist@gmail.com Thu Jan 14 10:45:54 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 14 Jan 2010 10:45:54 -0500 Subject: [sup-devel] [PATCHv2] idle and unidle updates Message-ID: <1263483819-sup-9886@changeling.local> --- bin/sup | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/bin/sup b/bin/sup index 19b2a87..0d90d00 100755 --- a/bin/sup +++ b/bin/sup @@ -260,6 +260,10 @@ begin SearchResultsMode.spawn_from_query $opts[:search] end + IDLE_THRESHOLD = 60 + no_keystrokes_since = Time.now + idle = false + until Redwood::exceptions.nonempty? || $die c = begin Ncurses.nonblocking_getch @@ -274,9 +278,22 @@ begin debug "redrawing screen on sigwinch" BufferManager.completely_redraw_screen end + + if !idle and Time.now.to_i - no_keystrokes_since.to_i >= IDLE_THRESHOLD + UpdateManager.relay self, :idle, Time.at(no_keystrokes_since) + idle = true + end + next end + if idle + UpdateManager.relay self, :unidle, Time.at(no_keystrokes_since) + idle = false + end + + no_keystrokes_since = Time.now + if c == 410 ## this is ncurses's way of telling us it's detected a refresh. ## since we have our own sigwinch handler, we don't do anything. -- 1.6.6 From hyperbolist@gmail.com Thu Jan 14 10:51:48 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 14 Jan 2010 10:51:48 -0500 Subject: [sup-devel] [PATCHv4] [issue14] poll updates accumulate while idle Message-ID: <1263484192-sup-1782@changeling.local> If you were to leave sup running for a long time, this patch would enable you to get a glance summary of new mail activity since sup was last touched, by letting the poll update message accumulate its tally while idle. This patch depends on [PATCHv2] idle and unidle updates. --- lib/sup/poll.rb | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index f3e1224..e9fba46 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -37,6 +37,9 @@ EOS @polling = false @poll_sources = nil @mode = nil + @should_clear_running_totals = false + clear_running_totals # defines @running_totals + UpdateManager.register self end def poll_with_sources @@ -45,8 +48,12 @@ EOS BufferManager.flash "Polling for new messages..." num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll - if num > 0 - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" + clear_running_totals if @should_clear_running_totals + @running_totals[:num] += num + @running_totals[:numi] += numi + @running_totals[:loaded_labels] += loaded_labels || [] + if @running_totals[:num] > 0 + BufferManager.flash "Loaded #{@running_totals[:num].pluralize 'new message'}, #{@running_totals[:numi]} to inbox. Labels: #{@running_totals[:loaded_labels].map{|l| l.to_s}.join(', ')}" else BufferManager.flash "No new messages." end @@ -183,6 +190,10 @@ EOS Index.add_message m UpdateManager.relay self, :added, m end + + def handle_idle_update sender, idle_since; @should_clear_running_totals = false; end + def handle_unidle_update sender, idle_since; @should_clear_running_totals = true; end + def clear_running_totals; @running_totals = {:num => 0, :numi => 0, :loaded_labels => Set.new}; end end end -- 1.6.6 From eg@gaute.vetsj.com Thu Jan 14 12:40:49 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Thu, 14 Jan 2010 18:40:49 +0100 Subject: [sup-devel] feature request: mute thread In-Reply-To: <1263480927-sup-7353@ntdws12.chass.utoronto.ca> References: <1263479817-sup-6114@dolk> <1263480927-sup-7353@ntdws12.chass.utoronto.ca> Message-ID: <1263490830-sup-8744@dolk> Excerpts from Ben Walton's message of 2010-01-14 15:55:43 +0100: > Excerpts from Gaute Hope's message of Thu Jan 14 09:39:34 -0500 2010: > > > Future feature request: ability to Mute threads - ala GMail's > > feature. > > Already there. See the & key in index/inbox view. It's called kill, > but the effect is what you're after. ah great! didn't know that.. From rlane@club.cc.cmu.edu Fri Jan 15 00:14:29 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Thu, 14 Jan 2010 21:14:29 -0800 Subject: [sup-devel] [PATCH] xapian: add boolean terms with zero wdf Message-ID: <1263532469-30760-1-git-send-email-rlane@club.cc.cmu.edu> Xapian's Flint backend stores the document length in every posting, so if the document length is changed (by adding a label, for example), every posting entry needs to be rewritten. This basically nullifies the performance improvement from the Xapian bug 250 fix. We can prevent this by adding these terms with 0 within-document-frequency so that their addition or removal doesn't change the document length. This is the analog to notmuch commit ccf2e0cc. --- lib/sup/xapian_index.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index c81dca4..99d7c0e 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -590,7 +590,7 @@ class Xapian::Document alias old_add_term add_term def add_term term if term.length <= Redwood::XapianIndex::MAX_TERM_LENGTH - old_add_term term + old_add_term term, 0 else warn "dropping excessively long term #{term}" end -- 1.6.3.3 From eg@gaute.vetsj.com Fri Jan 15 05:23:03 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Fri, 15 Jan 2010 11:23:03 +0100 Subject: [sup-devel] [issue36] label tab completion with utf-8 chars fail In-Reply-To: <1262534029-sup-1213@dolk> References: <1261749755.37.0.845609324711.issue36@masanjin.net> <1262533823-sup-5348@dolk> <1262534029-sup-1213@dolk> Message-ID: <1263550894-sup-165@dolk> Excerpts from Gaute Hope's message of 2010-01-03 16:56:17 +0100: > Apparently I can't even send messages when I enter the UTF-8 email address > manually. This also goes for subjects containing UTF-8 chars, i can add them, or reply to one containing it - but sup fails when trying to send. - gaute From hyperbolist@gmail.com Fri Jan 15 07:59:41 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Fri, 15 Jan 2010 07:59:41 -0500 Subject: [sup-devel] [PATCHv5] [issue14] poll updates accumulate while idle Message-ID: <1263560293-sup-9529@changeling.local> If you were to leave sup running for a long time, this patch would enable you to get a glance summary of new mail activity since sup was last touched, by letting the poll update message accumulate its tally while idle. Oops, forgot to clear_running_totals on :unidle. This patch depends on [PATCHv2] idle and unidle updates. --- lib/sup/poll.rb | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index f3e1224..6b43b00 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -37,6 +37,9 @@ EOS @polling = false @poll_sources = nil @mode = nil + @should_clear_running_totals = false + clear_running_totals # defines @running_totals + UpdateManager.register self end def poll_with_sources @@ -45,8 +48,12 @@ EOS BufferManager.flash "Polling for new messages..." num, numi, from_and_subj, from_and_subj_inbox, loaded_labels = @mode.poll - if num > 0 - BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox. Labels: #{loaded_labels.map{|l| l.to_s}.join(', ')}" + clear_running_totals if @should_clear_running_totals + @running_totals[:num] += num + @running_totals[:numi] += numi + @running_totals[:loaded_labels] += loaded_labels || [] + if @running_totals[:num] > 0 + BufferManager.flash "Loaded #{@running_totals[:num].pluralize 'new message'}, #{@running_totals[:numi]} to inbox. Labels: #{@running_totals[:loaded_labels].map{|l| l.to_s}.join(', ')}" else BufferManager.flash "No new messages." end @@ -183,6 +190,10 @@ EOS Index.add_message m UpdateManager.relay self, :added, m end + + def handle_idle_update sender, idle_since; @should_clear_running_totals = false; end + def handle_unidle_update sender, idle_since; @should_clear_running_totals = true; clear_running_totals; end + def clear_running_totals; @running_totals = {:num => 0, :numi => 0, :loaded_labels => Set.new}; end end end -- 1.6.6 From rlane@club.cc.cmu.edu Sat Jan 16 15:03:04 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 16 Jan 2010 12:03:04 -0800 Subject: [sup-devel] [PATCH 1/4] dont index redundant data Message-ID: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> Use the Xapian QueryParser ability to map a prefix in the query to multiple prefixes in the index. This means we don't need to store duplicate names, email addresses, and subjects. This also adds the stemmed attachment filenames to the default (non-prefixed) search. We're storing a subset of the data previous versions did, so we're able to read them but they can't read us. --- lib/sup/xapian_index.rb | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index c81dca4..c0b2f9f 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -258,9 +258,9 @@ EOS qp.stemming_strategy = Xapian::QueryParser::STEM_SOME qp.default_op = Xapian::Query::OP_AND qp.add_valuerangeprocessor(Xapian::NumberValueRangeProcessor.new(DATE_VALUENO, 'date:', true)) - NORMAL_PREFIX.each { |k,v| qp.add_prefix k, v } - BOOLEAN_PREFIX.each { |k,v| qp.add_boolean_prefix k, v } - xapian_query = qp.parse_query(subs, Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_WILDCARD, PREFIX['body']) + NORMAL_PREFIX.each { |k,vs| vs.each { |v| qp.add_prefix k, v } } + BOOLEAN_PREFIX.each { |k,vs| vs.each { |v| qp.add_boolean_prefix k, v } } + xapian_query = qp.parse_query(subs, Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_WILDCARD) raise ParseError if xapian_query.nil? or xapian_query.empty? query[:qobj] = xapian_query @@ -276,8 +276,9 @@ EOS 'body' => 'B', 'from_name' => 'FN', 'to_name' => 'TN', - 'name' => 'N', + 'name' => %w(FN TN), 'attachment' => 'A', + '' => %w(S B FN TN A), } # Unstemmed @@ -285,7 +286,7 @@ EOS 'type' => 'K', 'from_email' => 'FE', 'to_email' => 'TE', - 'email' => 'E', + 'email' => %w(FE TE), 'date' => 'D', 'label' => 'L', 'source_id' => 'I', @@ -457,10 +458,8 @@ EOS # Person names are indexed with several prefixes person_termer = lambda do |d| lambda do |p| - ["#{d}_name", "name", "body"].each do |x| - doc.index_text p.name, PREFIX[x] - end if p.name - [d, :any].each { |x| doc.add_term mkterm(:email, x, p.email) } + doc.index_text p.name, PREFIX["#{d}_name"] if p.name + doc.add_term mkterm(:email, d, p.email) end end @@ -471,7 +470,6 @@ EOS subject_text = m.indexable_subject body_text = m.indexable_body doc.index_text subject_text, PREFIX['subject'] - doc.index_text subject_text, PREFIX['body'] doc.index_text body_text, PREFIX['body'] m.attachments.each { |a| doc.index_text a, PREFIX['attachment'] } @@ -554,7 +552,6 @@ EOS case args[0] when :from then PREFIX['from_email'] when :to then PREFIX['to_email'] - when :any then PREFIX['email'] else raise "Invalid email term type #{args[0]}" end + args[1].to_s.downcase when :source_id -- 1.6.5.2 From rlane@club.cc.cmu.edu Sat Jan 16 15:03:05 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 16 Jan 2010 12:03:05 -0800 Subject: [sup-devel] [PATCH 2/4] index email addresses as text In-Reply-To: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263672187-5174-2-git-send-email-rlane@club.cc.cmu.edu> This lets you search for an email address (or its component parts, since it's indexed as a phrase) with no prefix. --- lib/sup/xapian_index.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index c0b2f9f..6fa6c55 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -278,7 +278,8 @@ EOS 'to_name' => 'TN', 'name' => %w(FN TN), 'attachment' => 'A', - '' => %w(S B FN TN A), + 'email_text' => 'E', + '' => %w(S B FN TN A E), } # Unstemmed @@ -459,6 +460,7 @@ EOS person_termer = lambda do |d| lambda do |p| doc.index_text p.name, PREFIX["#{d}_name"] if p.name + doc.index_text p.email, PREFIX['email_text'] doc.add_term mkterm(:email, d, p.email) end end -- 1.6.5.2 From rlane@club.cc.cmu.edu Sat Jan 16 15:03:06 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 16 Jan 2010 12:03:06 -0800 Subject: [sup-devel] [PATCH 3/4] id query prefix synonym for msgid In-Reply-To: <1263672187-5174-2-git-send-email-rlane@club.cc.cmu.edu> References: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> <1263672187-5174-2-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263672187-5174-3-git-send-email-rlane@club.cc.cmu.edu> notmuch has created an "id:" convention for referring to emails. We already had "msgid:", but support this syntax too. --- lib/sup/xapian_index.rb | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index 6fa6c55..eefd492 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -293,6 +293,7 @@ EOS 'source_id' => 'I', 'attachment_extension' => 'O', 'msgid' => 'Q', + 'id' => 'Q', 'thread' => 'H', 'ref' => 'R', } -- 1.6.5.2 From rlane@club.cc.cmu.edu Sat Jan 16 15:03:07 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 16 Jan 2010 12:03:07 -0800 Subject: [sup-devel] [PATCH 4/4] trivial index format upgrade In-Reply-To: <1263672187-5174-3-git-send-email-rlane@club.cc.cmu.edu> References: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> <1263672187-5174-2-git-send-email-rlane@club.cc.cmu.edu> <1263672187-5174-3-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263672187-5174-4-git-send-email-rlane@club.cc.cmu.edu> A v2 client can read a v1 index, but a v1 client cannot read a v2 index. Once the v2 client modifies the index the v1 client will be unable to read it. So, make the version check match that. --- lib/sup/xapian_index.rb | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index eefd492..464cee1 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -8,7 +8,7 @@ module Redwood # for searching due to precomputing thread membership. class XapianIndex < BaseIndex STEM_LANGUAGE = "english" - INDEX_VERSION = '1' + INDEX_VERSION = '2' ## dates are converted to integers for xapian, and are used for document ids, ## so we must ensure they're reasonably valid. this typically only affect @@ -35,7 +35,10 @@ EOS @xapian = Xapian::WritableDatabase.new(path, Xapian::DB_OPEN) db_version = @xapian.get_metadata 'version' db_version = '0' if db_version.empty? - if db_version != INDEX_VERSION + if db_version == '1' + info "Upgrading index format 1 to 2" + @xapian.set_metadata 'version', INDEX_VERSION + elsif db_version != INDEX_VERSION fail "This Sup version expects a v#{INDEX_VERSION} index, but you have an existing v#{db_version} index. Please downgrade to your previous version and dump your labels before upgrading to this version (then run sup-sync --restore)." end else -- 1.6.5.2 From tero@tilus.net Sat Jan 16 17:41:09 2010 From: tero@tilus.net (Tero Tilus) Date: Sun, 17 Jan 2010 00:41:09 +0200 Subject: [sup-devel] [PATCH] Message#edit_labels [was: [sup-talk] Ruby question: before-add-message.rb and adding multiple labels at once] In-Reply-To: <1263574849-sup-3477@sam.mediasupervision.de> References: <1263574849-sup-3477@sam.mediasupervision.de> Message-ID: <1263680819-sup-415@tilus.net> Gregor Hoffleit, 2010-01-15 19:01: > Ok. I ended up with > > ([:list,:"sup-devel"].each {|l| message.add_label l}; message.remove_label :inbox) if message.subj =~ /\[sup-devel\]/ > > May I request a new function "message.edit_labels" that groks the syntax > of the 'edit labels' command (cf. multi_edit_labels in thread-index-mode.rb): > > message.edit_labels "list sup-devel -inbox" if message.subj =~ /\[sup-devel\]/ > > Comments? I'll be using that one too. Here's a patch. Message#edit_labels accepts array of strings. I thought it'll be better that way. Otherwise it gets really ugly with spaces in labels. So your usecase would be message.edit_labels %w{list sup-devel -inbox} if message.subj =~ /\[sup-devel\]/ By the way, my pretty general list-labeling code looks like this . And then the patch... >From 9eff953dbda404b149a77969305c5732fa1d694e Mon Sep 17 00:00:00 2001 From: Tero Tilus Date: Sun, 17 Jan 2010 00:23:26 +0200 Subject: [PATCH] Message#edit_labels Signed-off-by: Tero Tilus --- lib/sup/message.rb | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/lib/sup/message.rb b/lib/sup/message.rb index 3e55de5..e047927 100644 --- a/lib/sup/message.rb +++ b/lib/sup/message.rb @@ -206,6 +206,18 @@ class Message @labels.delete l @dirty = true end + ## calling m.edit_labels ['foo', '-index', '+bar'] + ## adds labels foo and bar and removes label index + def edit_labels l_arr + l_arr.each do |signedlabel| + signedlabel, sign, label = signedlabel.match(/^(-|\+)?(.*)$/).to_a + if sign == '-' + remove_label label + else + add_label label + end + end + end def recipients @to + @cc + @bcc -- 1.5.6.5 -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ From wmorgan-sup@masanjin.net Sun Jan 17 10:35:01 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 17 Jan 2010 10:35:01 -0500 Subject: [sup-devel] merged into master: ferret-deprecation Message-ID: <1263742220-sup-2852@masanjin.net> I've merged this branch into master for the 0.10 release. I added: ENV["XAPIAN_FLUSH_THRESHOLD"] = "1000" to the top of xapian_index.rb (which seems to work), because that number is an acceptable compromise to the two people who have had memory issues. I'm thinking about also merging in insta-save before 0.10 goes out the door, probably with the patch that makes '$' flush Xapian. Thoughts? -- William From bwalton@artsci.utoronto.ca Sun Jan 17 11:11:36 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Sun, 17 Jan 2010 11:11:36 -0500 Subject: [sup-devel] merged into master: ferret-deprecation In-Reply-To: <1263742220-sup-2852@masanjin.net> References: <1263742220-sup-2852@masanjin.net> Message-ID: <1263744321-sup-5501@ntdws12.chass.utoronto.ca> Excerpts from William Morgan's message of Sun Jan 17 10:35:01 -0500 2010: > ENV["XAPIAN_FLUSH_THRESHOLD"] = "1000" A decent value, in my use too. > I'm thinking about also merging in insta-save before 0.10 goes out the > door, probably with the patch that makes '$' flush Xapian. Thoughts? Yes please! Thanks -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From rlane@club.cc.cmu.edu Sun Jan 17 13:50:44 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 17 Jan 2010 10:50:44 -0800 Subject: [sup-devel] RFC: Nuke remote sources Message-ID: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> Every few days someone joins the IRC channel complaining of poor performance or bugs with IMAP sources, and we have to tell them to use offlineimap or fetchmail instead. This is embarrassing. There are likely many more users who don't bother to ask on IRC and either unhappily tolerate IMAP or give up on Sup. Even with IMAP you still need to store a huge index on disk, so I can't accept that you'd have enough space for that but not for the actual messages. You still need to download every message to index it. Your mails aren't any more secure from someone stealing your laptop. The same arguments apply to mbox+ssh. The benefit for me is that I won't have to deal with slow, blocking sources when converting the UI to EventMachine. If people agree that this change is a good idea, I assume William will add a deprecation notice to master for 0.10 and merge this patchset to next. From rlane@club.cc.cmu.edu Sun Jan 17 13:50:45 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 17 Jan 2010 10:50:45 -0800 Subject: [sup-devel] [PATCH 1/3] remove mbox+ssh source In-Reply-To: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263754247-20979-2-git-send-email-rlane@club.cc.cmu.edu> --- README.txt | 1 - Rakefile | 1 - bin/sup-add | 8 -- bin/sup-config | 13 --- doc/NewUserGuide.txt | 1 - lib/sup/mbox.rb | 2 - lib/sup/mbox/ssh-file.rb | 254 -------------------------------------------- lib/sup/mbox/ssh-loader.rb | 74 ------------- 8 files changed, 0 insertions(+), 354 deletions(-) delete mode 100644 lib/sup/mbox/ssh-file.rb delete mode 100644 lib/sup/mbox/ssh-loader.rb diff --git a/README.txt b/README.txt index 4204270..7819f0b 100644 --- a/README.txt +++ b/README.txt @@ -100,7 +100,6 @@ Current limitations which will be fixed: - ncurses >= 0.9.1 - rmail >= 0.17 - highline - - net-ssh - trollop >= 1.12 - lockfile - mime-types diff --git a/Rakefile b/Rakefile index 67cd0d2..9cf911b 100644 --- a/Rakefile +++ b/Rakefile @@ -51,7 +51,6 @@ spec = Gem::Specification.new do |s| s.add_dependency "ncurses", ">= 0.9.1" s.add_dependency "rmail", ">= 0.17" s.add_dependency "highline" - s.add_dependency "net-ssh" s.add_dependency "trollop", ">= 1.12" s.add_dependency "lockfile" s.add_dependency "mime-types", "~> 1" diff --git a/bin/sup-add b/bin/sup-add index a7a3752..b92b5ad 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -20,9 +20,6 @@ For mbox files on local disk, use the form: mbox:, or mbox:// -For mbox files on remote machines, use the form: - mbox+ssh:/// - For IMAP folders, use the form (note no username or password!): imap:/// # unsecure, "INBOX" folder imap:/// # unsecure, arbitrary @@ -105,11 +102,6 @@ begin source = case parsed_uri.scheme - when "mbox+ssh" - say "For SSH connections, if you will use public key authentication, you may leave the username and password blank." - say "" - username, password = get_login_info uri, Redwood::SourceManager.sources - Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels when "imap", "imaps" username, password = get_login_info uri, Redwood::SourceManager.sources Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels diff --git a/bin/sup-config b/bin/sup-config index b37e0b2..5541965 100755 --- a/bin/sup-config +++ b/bin/sup-config @@ -44,7 +44,6 @@ def add_source menu.prompt = "What type of mail source is it? " menu.choice("mbox file") { type = :mbox } menu.choice("maildir directory") { type = :maildir } - menu.choice("remote mbox file (accessible via ssh)") { type = :mboxssh } menu.choice("IMAP server (secure)") { type = :imaps } menu.choice("IMAP server (unsecure)") { type = :imap } menu.choice("Get me out of here!") { return } @@ -70,18 +69,6 @@ def add_source $last_fn = fn [Redwood::Maildir.suggest_labels_for(fn), { :scheme => "maildir", :path => fn }] - when :mboxssh - $last_server ||= "localhost" - srv = axe "What machine is the mbox file located on?", $last_server - return if srv.nil? || srv.empty? - $last_server = srv - - fn = axe "What's the path to the mbox file?", $last_fn - return if fn.nil? || fn.empty? - $last_fn = fn - fn = "/#{fn}" # lame - [Redwood::MBox::SSHLoader.suggest_labels_for(fn), - { :scheme => "mbox+ssh", :host => srv, :path => fn }] when :imap, :imaps $last_server ||= "localhost" srv = axe "What is the IMAP server (host, or host:port notation)?", $last_server diff --git a/doc/NewUserGuide.txt b/doc/NewUserGuide.txt index f22d2f1..4b46ae2 100644 --- a/doc/NewUserGuide.txt +++ b/doc/NewUserGuide.txt @@ -208,7 +208,6 @@ Instead of using sup-config to add a new source, you can manually run - maildir://path/to/a/filename, for a maildir directory on disk. - imap://imap.server/folder for an unsecure IMAP folder. - imaps://secure.imap.server/folder for a secure IMAP folder. -- mbox+ssh://remote.machine/path/to/a/filename for a remote mbox file. Before you add the source, you need make three decisions. The first is whether you want Sup to regularly poll this source for new messages. diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb index 7af40dd..57c371c 100644 --- a/lib/sup/mbox.rb +++ b/lib/sup/mbox.rb @@ -1,6 +1,4 @@ require "sup/mbox/loader" -require "sup/mbox/ssh-file" -require "sup/mbox/ssh-loader" module Redwood diff --git a/lib/sup/mbox/ssh-file.rb b/lib/sup/mbox/ssh-file.rb deleted file mode 100644 index 4ae4bba..0000000 --- a/lib/sup/mbox/ssh-file.rb +++ /dev/null @@ -1,254 +0,0 @@ -require 'net/ssh' - -module Redwood -module MBox - -class SSHFileError < StandardError; end - -## this is a file-like interface to a file that actually lives on the -## other end of an ssh connection. it works by using wc, head and tail -## to simulate (buffered) random access. on a fast connection, this -## can have a good bandwidth, but the latency is pretty terrible: -## about 1 second (!) per request. luckily, we're either just reading -## straight through the mbox (an import) or we're reading a few -## messages at a time (viewing messages) so the latency is not a problem. - -## all of the methods here can throw SSHFileErrors, SocketErrors, -## Net::SSH::Exceptions and Errno::ENOENTs. - -## a simple buffer of contiguous data -class Buffer - def initialize - clear! - end - - def clear! - @start = nil - @buf = "" - end - - def empty?; @start.nil?; end - def start; @start; end - def endd; @start + @buf.length; end - - def add data, offset=endd - #MBox::debug "+ adding #{data.length} bytes; size will be #{size + data.length}; limit #{SSHFile::MAX_BUF_SIZE}" - - if start.nil? - @buf = data - @start = offset - return - end - - raise "non-continguous data added to buffer (data #{offset}:#{offset + data.length}, buf range #{start}:#{endd})" if offset + data.length < start || offset > endd - - if offset < start - @buf = data[0 ... (start - offset)] + @buf - @start = offset - else - return if offset + data.length < endd - @buf += data[(endd - offset) .. -1] - end - end - - def [](o) - raise "only ranges supported due to programmer's laziness" unless o.is_a? Range - @buf[Range.new(o.first - @start, o.last - @start, o.exclude_end?)] - end - - def index what, start=0 - x = @buf.index(what, start - @start) - x.nil? ? nil : x + @start - end - - def rindex what, start=0 - x = @buf.rindex(what, start - @start) - x.nil? ? nil : x + @start - end - - def size; empty? ? 0 : @buf.size; end - def to_s; empty? ? "" : "[#{start}, #{endd})"; end # for debugging -end - -## sharing a ssh connection to one machines between sources seems to -## create lots of broken situations: commands returning bizarre (large -## positive integer) return codes despite working; commands -## occasionally not working, etc. i suspect this is because of the -## fragile nature of the ssh syncshell. -## -## at any rate, we now open up one ssh connection per file, which is -## probably silly in the extreme case. - -## the file-like interface to a remote file -class SSHFile - MAX_BUF_SIZE = 1024 * 1024 # bytes - MAX_TRANSFER_SIZE = 1024 * 128 - REASONABLE_TRANSFER_SIZE = 1024 * 32 - SIZE_CHECK_INTERVAL = 60 * 1 # seconds - - ## upon these errors we'll try to rereconnect a few times - RECOVERABLE_ERRORS = [ Errno::EPIPE, Errno::ETIMEDOUT ] - - @@shells = {} - @@shells_mutex = Mutex.new - - def initialize host, fn, ssh_opts={} - @buf = Buffer.new - @host = host - @fn = fn - @ssh_opts = ssh_opts - @file_size = nil - @offset = 0 - @say_id = nil - @shell = nil - @shell_mutex = nil - @buf_mutex = Mutex.new - end - - def to_s; "mbox+ssh://#@host/#@fn"; end ## TODO: remove this EVILness - - def connect - do_remote nil - end - - def eof?; @offset >= size; end - def eof; eof?; end # lame but IO's method is named this and rmail calls that - def seek loc; @offset = loc; end - def tell; @offset; end - def total; size; end - def path; @fn end - - def size - if @file_size.nil? || (Time.now - @last_size_check) > SIZE_CHECK_INTERVAL - @last_size_check = Time.now - @file_size = do_remote("wc -c #@fn").split.first.to_i - end - @file_size - end - - def gets - return nil if eof? - @buf_mutex.synchronize do - make_buf_include @offset - expand_buf_forward while @buf.index("\n", @offset).nil? && @buf.endd < size - returning(@buf[@offset .. (@buf.index("\n", @offset) || -1)]) { |line| @offset += line.length } - end - end - - def read n - return nil if eof? - @buf_mutex.synchronize do - make_buf_include @offset, n - @buf[@offset ... (@offset += n)] - end - end - -private - - ## TODO: share this code with imap - def say s - @say_id = BufferManager.say s, @say_id if BufferManager.instantiated? - info s - end - - def shutup - BufferManager.clear @say_id if BufferManager.instantiated? && @say_id - @say_id = nil - end - - def unsafe_connect - return if @shell - - @key = [@host, @ssh_opts[:username]] - begin - @shell, @shell_mutex = @@shells_mutex.synchronize do - unless @@shells.member? @key - say "Opening SSH connection to #{@host} for #@fn..." - session = Net::SSH.start @host, @ssh_opts - say "Starting SSH shell..." - @@shells[@key] = [session.shell.sync, Mutex.new] - end - @@shells[@key] - end - - say "Checking for #@fn..." - @shell_mutex.synchronize { raise Errno::ENOENT, @fn unless @shell.test("-e #@fn").status == 0 } - ensure - shutup - end - end - - def do_remote cmd, expected_size=0 - retries = 0 - result = nil - - begin - unsafe_connect - if cmd - # MBox::debug "sending command: #{cmd.inspect}" - result = @shell_mutex.synchronize { x = @shell.send_command cmd; sleep 0.25; x } - raise SSHFileError, "Failure during remote command #{cmd.inspect}: #{(result.stderr || result.stdout || "")[0 .. 100]}" unless result.status == 0 - end - ## Net::SSH::Exceptions seem to happen every once in a while for - ## no good reason. - rescue Net::SSH::Exception, *RECOVERABLE_ERRORS - if (retries += 1) <= 3 - @@shells_mutex.synchronize do - @shell = nil - @@shells[@key] = nil - end - retry - end - raise - end - - result.stdout if cmd - end - - def get_bytes offset, size - do_remote "tail -c +#{offset + 1} #@fn | head -c #{size}", size - end - - def expand_buf_forward n=REASONABLE_TRANSFER_SIZE - @buf.add get_bytes(@buf.endd, n) - end - - ## try our best to transfer somewhere between - ## REASONABLE_TRANSFER_SIZE and MAX_TRANSFER_SIZE bytes - def make_buf_include offset, size=0 - good_size = [size, REASONABLE_TRANSFER_SIZE].max - - trans_start, trans_size = - if @buf.empty? - [offset, good_size] - elsif offset < @buf.start - if @buf.start - offset <= good_size - start = [@buf.start - good_size, 0].max - [start, @buf.start - start] - elsif @buf.start - offset < MAX_TRANSFER_SIZE - [offset, @buf.start - offset] - else - MBox::debug "clearing SSH buffer because buf.start #{@buf.start} - offset #{offset} >= #{MAX_TRANSFER_SIZE}" - @buf.clear! - [offset, good_size] - end - else - return if [offset + size, self.size].min <= @buf.endd # whoohoo! - if offset - @buf.endd <= good_size - [@buf.endd, good_size] - elsif offset - @buf.endd < MAX_TRANSFER_SIZE - [@buf.endd, offset - @buf.endd] - else - MBox::debug "clearing SSH buffer because offset #{offset} - buf.end #{@buf.endd} >= #{MAX_TRANSFER_SIZE}" - @buf.clear! - [offset, good_size] - end - end - - @buf.clear! if @buf.size > MAX_BUF_SIZE - @buf.add get_bytes(trans_start, trans_size), trans_start - end -end - -end -end diff --git a/lib/sup/mbox/ssh-loader.rb b/lib/sup/mbox/ssh-loader.rb deleted file mode 100644 index e422a48..0000000 --- a/lib/sup/mbox/ssh-loader.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'net/ssh' - -module Redwood -module MBox - -class SSHLoader < Source - attr_accessor :username, :password - - yaml_properties :uri, :username, :password, :cur_offset, :usual, - :archived, :id, :labels - - def initialize uri, username=nil, password=nil, start_offset=nil, usual=true, archived=false, id=nil, labels=[] - raise ArgumentError, "not an mbox+ssh uri: #{uri.inspect}" unless uri =~ %r!^mbox\+ssh://! - - super uri, start_offset, usual, archived, id - - @parsed_uri = URI(uri) - @username = username - @password = password - @uri = uri - @cur_offset = start_offset - @labels = (labels || []).freeze - - opts = {} - opts[:username] = @username if @username - opts[:password] = @password if @password - - @f = SSHFile.new host, filename, opts - @loader = Loader.new @f, start_offset, usual, archived, id - - ## heuristic: use the filename as a label, unless the file - ## has a path that probably represents an inbox. - end - - def self.suggest_labels_for path; Loader.suggest_labels_for(path) end - - def connect; safely { @f.connect }; end - def host; @parsed_uri.host; end - def filename; @parsed_uri.path[1..-1] end - - def next - safely do - offset, labels = @loader.next - self.cur_offset = @loader.cur_offset # superclass keeps @cur_offset which is used by yaml - [offset, (labels + @labels).uniq] # add our labels - end - end - - def end_offset - safely { @f.size } - end - - def cur_offset= o; @cur_offset = @loader.cur_offset = o; @dirty = true; end - def id; @loader.id; end - def id= o; @id = @loader.id = o; end - # def cur_offset; @loader.cur_offset; end # think we'll be ok without this - def to_s; @parsed_uri.to_s; end - - def safely - begin - yield - rescue Net::SSH::Exception, SocketError, SSHFileError, SystemCallError, IOError => e - m = "error communicating with SSH server #{host} (#{e.class.name}): #{e.message}" - raise FatalSourceError, m - end - end - - [:start_offset, :load_header, :load_message, :raw_header, :raw_message].each do |meth| - define_method(meth) { |*a| safely { @loader.send meth, *a } } - end -end - -end -end -- 1.6.3.3 From rlane@club.cc.cmu.edu Sun Jan 17 13:50:46 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 17 Jan 2010 10:50:46 -0800 Subject: [sup-devel] [PATCH 2/3] remove imap source In-Reply-To: <1263754247-20979-2-git-send-email-rlane@club.cc.cmu.edu> References: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> <1263754247-20979-2-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263754247-20979-3-git-send-email-rlane@club.cc.cmu.edu> --- README.txt | 10 +-- bin/sup-add | 9 -- bin/sup-config | 21 --- bin/sup-recover-sources | 13 +-- doc/FAQ.txt | 8 +- doc/NewUserGuide.txt | 21 +-- lib/sup.rb | 1 - lib/sup/imap.rb | 349 ----------------------------------------------- lib/sup/source.rb | 8 +- lib/sup/xapian_index.rb | 1 + 10 files changed, 16 insertions(+), 425 deletions(-) delete mode 100644 lib/sup/imap.rb diff --git a/README.txt b/README.txt index 7819f0b..dba7298 100644 --- a/README.txt +++ b/README.txt @@ -12,8 +12,7 @@ email as an extension of your long-term memory, Sup is for you. Sup makes it easy to: - Handle massive amounts of email. -- Mix email from different sources: mbox files (even across different - machines), Maildir directories, IMAP folders, and GMail accounts. +- Mix email from different sources: mbox files and Maildir directories. - Instantaneously search over your entire email collection. Search over body text, or use a query language to combine search predicates in any @@ -73,13 +72,6 @@ Current limitations which will be fixed: source (read, move, delete, etc) with another client Sup will punish you with a lengthy reindexing process. -- Support for mbox, Maildir, and IMAP only at this point. No support for - POP or mh. - -- IMAP support is very slow due mostly to Ruby's IMAP library. You may - consider something like offlineimap to mirror your IMAP folders with - local Maildir ones. - - Unix-centrism in MIME attachment handling and in sendmail invocation. == SYNOPSYS: diff --git a/bin/sup-add b/bin/sup-add index b92b5ad..059a4e2 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -20,12 +20,6 @@ For mbox files on local disk, use the form: mbox:, or mbox:// -For IMAP folders, use the form (note no username or password!): - imap:/// # unsecure, "INBOX" folder - imap:/// # unsecure, arbitrary - imaps:/// # secure, "INBOX" folder - imaps:/// # secure, arbitrary folder - For Maildir folders, use the form: maildir:; or maildir:// @@ -102,9 +96,6 @@ begin source = case parsed_uri.scheme - when "imap", "imaps" - username, password = get_login_info uri, Redwood::SourceManager.sources - Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels when "maildir" Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels when "mbox" diff --git a/bin/sup-config b/bin/sup-config index 5541965..059af6d 100755 --- a/bin/sup-config +++ b/bin/sup-config @@ -44,8 +44,6 @@ def add_source menu.prompt = "What type of mail source is it? " menu.choice("mbox file") { type = :mbox } menu.choice("maildir directory") { type = :maildir } - menu.choice("IMAP server (secure)") { type = :imaps } - menu.choice("IMAP server (unsecure)") { type = :imap } menu.choice("Get me out of here!") { return } end @@ -69,25 +67,6 @@ def add_source $last_fn = fn [Redwood::Maildir.suggest_labels_for(fn), { :scheme => "maildir", :path => fn }] - when :imap, :imaps - $last_server ||= "localhost" - srv = axe "What is the IMAP server (host, or host:port notation)?", $last_server - return if srv.nil? || srv.empty? - $last_server = srv - - $last_folder ||= "INBOX" - fn = axe "What's the folder path?", $last_folder - return if fn.nil? || fn.empty? - $last_folder = fn - - fn = "/#{fn}" - if srv =~ /^(\S+):(\d+)$/ - host, port = $1, $2.to_i - else - host, port = srv, nil - end - [Redwood::IMAP.suggest_labels_for(fn), - { :scheme => type.to_s, :host => host, :port => port, :path => fn }] end uri = begin diff --git a/bin/sup-recover-sources b/bin/sup-recover-sources index 43fa5f6..03ac97d 100755 --- a/bin/sup-recover-sources +++ b/bin/sup-recover-sources @@ -58,17 +58,8 @@ ARGV.each do |fn| next if Redwood::SourceManager.source_for fn ## TODO: merge this code with the same snippet in import - source = - case fn - when %r!^imaps?://! - print "Username for #{fn}: " - username = $stdin.gets.chomp - print "Password for #{fn} (warning: cleartext): " - password = $stdin.gets.chomp - Redwood::IMAP.new(fn, username, password, nil, !$opts[:unusual], $opts[:archive]) - else - Redwood::MBox::Loader.new(fn, nil, !$opts[:unusual], $opts[:archive]) - end + ## XXX maildir? + source = Redwood::MBox::Loader.new(fn, nil, !$opts[:unusual], $opts[:archive]) source_ids = Hash.new 0 count = 0 diff --git a/doc/FAQ.txt b/doc/FAQ.txt index 997a357..1a86211 100644 --- a/doc/FAQ.txt +++ b/doc/FAQ.txt @@ -105,13 +105,7 @@ S: The current solution is to directly modify RubyMail. Change line 159 of P: I see this error: /usr/local/lib/ruby/1.8/yaml.rb:133:in `transfer': allocator undefined for Bignum (TypeError) S: You need to upgrade to Ruby 1.8.5. YAML in earlier versions can't - parse BigNums, but Sup relies on that for Maildir and IMAP. - -P: I see this error: - /usr/lib/ruby/1.8/net/imap.rb:204: uninitialized constant Net::IMAP::SSL (NameError) -S: You need to install a package called libssl-ruby or something similar. - Or, don't use imaps:// sources. Ruby's IMAP library otherwise fails in - this completely uninformative manner. + parse BigNums, but Sup relies on that for Maildir. P: When I run Sup remotely and view an HTML attachment, an existing Firefox on the *local* machine is redirected to the attachment diff --git a/doc/NewUserGuide.txt b/doc/NewUserGuide.txt index 4b46ae2..af18aeb 100644 --- a/doc/NewUserGuide.txt +++ b/doc/NewUserGuide.txt @@ -19,14 +19,14 @@ index is where Sup stores all message state (e.g. read or unread, any message labels), and all information necessary for searching and for threading messages. Sup only knows about messages in its index. -We can add messages to the index by telling Sup about the "source" -where the messages reside. Sources are things like IMAP folders, mbox -folders, and maildir directories. Sup doesn't duplicate the actual -message content in the index; it only stores whatever information is -necessary for searching, threading and labelling. So when you search -for messages or view your inbox, Sup talks only to the index (stored -locally on disk). When you view a thread, Sup requests the full -content of all the messages from the source. +We can add messages to the index by telling Sup about the "source" where +the messages reside. Sources are things like mbox folders and maildir +directories. Sup doesn't duplicate the actual message content in the +index; it only stores whatever information is necessary for searching, +threading and labelling. So when you search for messages or view your +inbox, Sup talks only to the index (stored locally on disk). When you +view a thread, Sup requests the full content of all the messages from +the source. The easiest way to set up all your sources is to run `sup-config`. This will interactively walk you through some basic configuration, @@ -206,8 +206,6 @@ Instead of using sup-config to add a new source, you can manually run - mbox://path/to/a/filename, for an mbox file on disk. - maildir://path/to/a/filename, for a maildir directory on disk. -- imap://imap.server/folder for an unsecure IMAP folder. -- imaps://secure.imap.server/folder for a secure IMAP folder. Before you add the source, you need make three decisions. The first is whether you want Sup to regularly poll this source for new messages. @@ -226,9 +224,6 @@ lists that you don't want polluting your inbox. The final decision is whether you want any labels automatically applied to messages from this source. You can use `--labels` to do this. -If Sup requires account information, e.g. for IMAP servers and remote -mbox files, `sup-add` will ask for it. - Now that you've added the source, let's import all the current messages from it, by running sup-sync with the source URI. You can specify `--archive` to automatically archive all messages in this diff --git a/lib/sup.rb b/lib/sup.rb index ddc602e..ef1b49a 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -274,7 +274,6 @@ require "sup/message" require "sup/source" require "sup/mbox" require "sup/maildir" -require "sup/imap" require "sup/person" require "sup/account" require "sup/thread" diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb deleted file mode 100644 index bdb9e15..0000000 --- a/lib/sup/imap.rb +++ /dev/null @@ -1,349 +0,0 @@ -require 'uri' -require 'net/imap' -require 'stringio' -require 'time' -require 'rmail' -require 'cgi' -require 'set' - -## TODO: remove synchronized method protector calls; use a Monitor instead -## (ruby's reentrant mutex) - -## fucking imap fucking sucks. what the FUCK kind of committee of dunces -## designed this shit. -## -## imap talks about 'unique ids' for messages, to be used for -## cross-session identification. great---just what sup needs! except it -## turns out the uids can be invalidated every time the 'uidvalidity' -## value changes on the server, and 'uidvalidity' can change without -## restriction. it can change any time you log in. it can change EVERY -## time you log in. of course the imap spec "strongly recommends" that it -## never change, but there's nothing to stop people from just setting it -## to the current timestamp, and in fact that's EXACTLY what the one imap -## server i have at my disposal does. thus the so-called uids are -## absolutely useless and imap provides no cross-session way of uniquely -## identifying a message. but thanks for the "strong recommendation", -## guys! -## -## so right now i'm using the 'internal date' and the size of each -## message to uniquely identify it, and i scan over the entire mailbox -## each time i open it to map those things to message ids. that can be -## slow for large mailboxes, and we'll just have to hope that there are -## no collisions. ho ho! a perfectly reasonable solution! -## -## and here's another thing. check out RFC2060 2.2.2 paragraph 5: -## -## A client MUST be prepared to accept any server response at all -## times. This includes server data that was not requested. -## -## yeah. that totally makes a lot of sense. and once again, the idiocy of -## the spec actually happens in practice. you'll request flags for one -## message, and get it interspersed with a random bunch of flags for some -## other messages, including a different set of flags for the same -## message! totally ok by the imap spec. totally retarded by any other -## metric. -## -## fuck you, imap committee. you managed to design something nearly as -## shitty as mbox but goddamn THIRTY YEARS LATER. -module Redwood - -class IMAP < Source - include SerializeLabelsNicely - SCAN_INTERVAL = 60 # seconds - - ## upon these errors we'll try to rereconnect a few times - RECOVERABLE_ERRORS = [ Errno::EPIPE, Errno::ETIMEDOUT, OpenSSL::SSL::SSLError ] - - attr_accessor :username, :password - yaml_properties :uri, :username, :password, :cur_offset, :usual, - :archived, :id, :labels - - def initialize uri, username, password, last_idate=nil, usual=true, archived=false, id=nil, labels=[] - raise ArgumentError, "username and password must be specified" unless username && password - raise ArgumentError, "not an imap uri" unless uri =~ %r!imaps?://! - - super uri, last_idate, usual, archived, id - - @parsed_uri = URI(uri) - @username = username - @password = password - @imap = nil - @imap_state = {} - @ids = [] - @last_scan = nil - @labels = Set.new((labels || []) - LabelManager::RESERVED_LABELS) - @say_id = nil - @mutex = Mutex.new - end - - def self.suggest_labels_for path - path =~ /([^\/]*inbox[^\/]*)/i ? [$1.downcase.intern] : [] - end - - def host; @parsed_uri.host; end - def port; @parsed_uri.port || (ssl? ? 993 : 143); end - def mailbox - x = @parsed_uri.path[1..-1] - (x.nil? || x.empty?) ? 'INBOX' : CGI.unescape(x) - end - def ssl?; @parsed_uri.scheme == 'imaps' end - - def check; end # do nothing because anything we do will be too slow, - # and we'll catch the errors later. - - ## is this necessary? TODO: remove maybe - def == o; o.is_a?(IMAP) && o.uri == self.uri && o.username == self.username; end - - def load_header id - parse_raw_email_header StringIO.new(raw_header(id)) - end - - def load_message id - RMail::Parser.read raw_message(id) - end - - def each_raw_message_line id - StringIO.new(raw_message(id)).each { |l| yield l } - end - - def raw_header id - unsynchronized_scan_mailbox - header, flags = get_imap_fields id, 'RFC822.HEADER' - header.gsub(/\r\n/, "\n") - end - synchronized :raw_header - - def store_message date, from_email, &block - message = StringIO.new - yield message - message.string.gsub! /\n/, "\r\n" - - safely { @imap.append mailbox, message.string, [:Seen], Time.now } - end - - def raw_message id - unsynchronized_scan_mailbox - get_imap_fields(id, 'RFC822').first.gsub(/\r\n/, "\n") - end - synchronized :raw_message - - def mark_as_deleted ids - ids = [ids].flatten # accept single arguments - unsynchronized_scan_mailbox - imap_ids = ids.map { |i| @imap_state[i] && @imap_state[i][:id] }.compact - return if imap_ids.empty? - @imap.store imap_ids, "+FLAGS", [:Deleted] - end - synchronized :mark_as_deleted - - def expunge - @imap.expunge - unsynchronized_scan_mailbox true - true - end - synchronized :expunge - - def connect - return if @imap - safely { } # do nothing! - end - synchronized :connect - - def scan_mailbox force=false - return if !force && @last_scan && (Time.now - @last_scan) < SCAN_INTERVAL - last_id = safely do - @imap.examine mailbox - @imap.responses["EXISTS"].last - end - @last_scan = Time.now - - @ids = [] if force - return if last_id == @ids.length - - range = (@ids.length + 1) .. last_id - debug "fetching IMAP headers #{range}" - fetch(range, ['RFC822.SIZE', 'INTERNALDATE', 'FLAGS']).each do |v| - id = make_id v - @ids << id - @imap_state[id] = { :id => v.seqno, :flags => v.attr["FLAGS"] } - end - debug "done fetching IMAP headers" - end - synchronized :scan_mailbox - - def each - return unless start_offset - - ids = - @mutex.synchronize do - unsynchronized_scan_mailbox - @ids - end - - start = ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}." - - start.upto(ids.length - 1) do |i| - id = ids[i] - state = @mutex.synchronize { @imap_state[id] } or next - self.cur_offset = id - labels = { :Flagged => :starred, - :Deleted => :deleted - }.inject(@labels) do |cur, (imap, sup)| - cur + (state[:flags].include?(imap) ? [sup] : []) - end - - labels += [:unread] unless state[:flags].include?(:Seen) - - yield id, labels - end - end - - def start_offset - unsynchronized_scan_mailbox - @ids.first - end - synchronized :start_offset - - def end_offset - unsynchronized_scan_mailbox - @ids.last + 1 - end - synchronized :end_offset - - def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end - -private - - def fetch ids, fields - results = safely { @imap.fetch ids, fields } - good_results = - if ids.respond_to? :member? - results.find_all { |r| ids.member?(r.seqno) && fields.all? { |f| r.attr.member?(f) } } - else - results.find_all { |r| ids == r.seqno && fields.all? { |f| r.attr.member?(f) } } - end - - if good_results.empty? - raise FatalSourceError, "no IMAP response for #{ids} containing all fields #{fields.join(', ')} (got #{results.size} results)" - elsif good_results.size < results.size - warn "Your IMAP server sucks. It sent #{results.size} results for a request for #{good_results.size} messages. What are you using, Binc?" - end - - good_results - end - - def unsafe_connect - say "Connecting to IMAP server #{host}:#{port}..." - - ## apparently imap.rb does a lot of threaded stuff internally and if - ## an exception occurs, it will catch it and re-raise it on the - ## calling thread. but i can't seem to catch that exception, so i've - ## resorted to initializing it in its own thread. surely there's a - ## better way. - exception = nil - ::Thread.new do - begin - #raise Net::IMAP::ByeResponseError, "simulated imap failure" - @imap = Net::IMAP.new host, port, ssl? - say "Logging in..." - - ## although RFC1730 claims that "If an AUTHENTICATE command fails - ## with a NO response, the client may try another", in practice - ## it seems like they can also send a BAD response. - begin - raise Net::IMAP::NoResponseError unless @imap.capability().member? "AUTH=CRAM-MD5" - @imap.authenticate 'CRAM-MD5', @username, @password - rescue Net::IMAP::BadResponseError, Net::IMAP::NoResponseError => e - debug "CRAM-MD5 authentication failed: #{e.class}. Trying LOGIN auth..." - begin - raise Net::IMAP::NoResponseError unless @imap.capability().member? "AUTH=LOGIN" - @imap.authenticate 'LOGIN', @username, @password - rescue Net::IMAP::BadResponseError, Net::IMAP::NoResponseError => e - debug "LOGIN authentication failed: #{e.class}. Trying plain-text LOGIN..." - @imap.login @username, @password - end - end - say "Successfully connected to #{@parsed_uri}." - rescue Exception => e - exception = e - ensure - shutup - end - end.join - - raise exception if exception - end - - def say s - @say_id = BufferManager.say s, @say_id if BufferManager.instantiated? - info s - end - - def shutup - BufferManager.clear @say_id if BufferManager.instantiated? - @say_id = nil - end - - def make_id imap_stuff - # use 7 digits for the size. why 7? seems nice. - %w(RFC822.SIZE INTERNALDATE).each do |w| - raise FatalSourceError, "requested data not in IMAP response: #{w}" unless imap_stuff.attr[w] - end - - msize, mdate = imap_stuff.attr['RFC822.SIZE'] % 10000000, Time.parse(imap_stuff.attr["INTERNALDATE"]) - sprintf("%d%07d", mdate.to_i, msize).to_i - end - - def get_imap_fields id, *fields - raise OutOfSyncSourceError, "Unknown message id #{id}" unless @imap_state[id] - - imap_id = @imap_state[id][:id] - result = fetch(imap_id, (fields + ['RFC822.SIZE', 'INTERNALDATE']).uniq).first - got_id = make_id result - - ## I've turned off the following sanity check because Microsoft - ## Exchange fails it. Exchange actually reports two different - ## INTERNALDATEs for the exact same message when queried at different - ## points in time. - ## - ## RFC2060 defines the semantics of INTERNALDATE for messages that - ## arrive via SMTP for via various IMAP commands, but states that - ## "All other cases are implementation defined.". Great, thanks guys, - ## yet another useless field. - ## - ## Of course no OTHER imap server I've encountered returns DIFFERENT - ## values for the SAME message. But it's Microsoft; what do you - ## expect? If their programmers were any good they'd be working at - ## Google. - - # raise OutOfSyncSourceError, "IMAP message mismatch: requested #{id}, got #{got_id}." unless got_id == id - - fields.map { |f| result.attr[f] or raise FatalSourceError, "empty response from IMAP server: #{f}" } - end - - ## execute a block, connected if unconnected, re-connected up to 3 - ## times if a recoverable error occurs, and properly dying if an - ## unrecoverable error occurs. - def safely - retries = 0 - begin - begin - unsafe_connect unless @imap - yield - rescue *RECOVERABLE_ERRORS => e - if (retries += 1) <= 3 - @imap = nil - warn "got #{e.class.name}: #{e.message.inspect}" - sleep 2 - retry - end - raise - end - rescue SocketError, Net::IMAP::Error, SystemCallError, IOError, OpenSSL::SSL::SSLError => e - raise FatalSourceError, "While communicating with IMAP server (type #{e.class.name}): #{e.message.inspect}" - end - end - -end - -end diff --git a/lib/sup/source.rb b/lib/sup/source.rb index 6fe7bfb..02d99c7 100644 --- a/lib/sup/source.rb +++ b/lib/sup/source.rb @@ -28,8 +28,7 @@ class Source ## (in the absence of some other client going in and fucking ## everything up). For example, for mboxes I use the file offset of ## the start of the message. If a source does NOT have that - ## capability, e.g. IMAP, then you have to do a little more work to - ## simulate it. + ## capability then you have to do a little more work to simulate it. ## ## To write a new source, subclass this class, and implement: ## @@ -51,13 +50,12 @@ class Source ## OutOfSyncSourceErrors should be used for problems that a call to ## sup-sync will fix (namely someone's been playing with the source ## from another client); FatalSourceErrors can be used for anything - ## else (e.g. the imap server is down or the maildir is missing.) + ## else (e.g. the maildir is missing.) ## ## Finally, be sure the source is thread-safe, since it WILL be ## pummelled from multiple threads at once. ## - ## Examples for you to look at: mbox/loader.rb, imap.rb, and - ## maildir.rb. + ## Examples for you to look at: mbox/loader.rb and maildir.rb. ## let's begin! ## diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index c81dca4..e0c6ecf 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -1,5 +1,6 @@ require 'xapian' require 'set' +require 'monitor' module Redwood -- 1.6.3.3 From rlane@club.cc.cmu.edu Sun Jan 17 13:50:47 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 17 Jan 2010 10:50:47 -0800 Subject: [sup-devel] [PATCH 3/3] simplify sup-add In-Reply-To: <1263754247-20979-3-git-send-email-rlane@club.cc.cmu.edu> References: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> <1263754247-20979-2-git-send-email-rlane@club.cc.cmu.edu> <1263754247-20979-3-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263754247-20979-4-git-send-email-rlane@club.cc.cmu.edu> --- bin/sup-add | 40 ---------------------------------------- 1 files changed, 0 insertions(+), 40 deletions(-) diff --git a/bin/sup-add b/bin/sup-add index 059a4e2..e354ea8 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -30,50 +30,10 @@ EOS opt :unusual, "Do not automatically poll these sources for new messages." opt :labels, "A comma-separated set of labels to apply to all messages from this source", :type => String opt :force_new, "Create a new account for this source, even if one already exists." - opt :force_account, "Reuse previously defined account user at hostname.", :type => String end Trollop::die "require one or more sources" if ARGV.empty? -## for sources that require login information, prompt the user for -## that. also provide a list of previously-defined login info to -## choose from, if any. -def get_login_info uri, sources - uri = URI(uri) - accounts = sources.map do |s| - next unless s.respond_to?(:username) - suri = URI(s.uri) - [suri.host, s.username, s.password] - end.compact.uniq.sort_by { |h, u, p| h == uri.host ? 0 : 1 } - - username, password = nil, nil - unless accounts.empty? || $opts[:force_new] - if $opts[:force_account] - host, username, password = accounts.find { |h, u, p| $opts[:force_account] == "#{u}@#{h}" } - unless username && password - say "No previous account #{$opts[:force_account].inspect} found." - end - else - say "Would you like to use the same account as for a previous source for #{uri}?" - choose do |menu| - accounts.each do |host, olduser, oldpw| - menu.choice("Use the account info for #{olduser}@#{host}") { username, password = olduser, oldpw } - end - menu.choice("Use a new account") { } - menu.prompt = "Account selection? " - end - end - end - - unless username && password - username = ask("Username for #{uri.host}: "); - password = ask("Password for #{uri.host}: ") { |q| q.echo = false } - puts # why? - end - - [username, password] -end - $terminal.wrap_at = :auto Redwood::start index = Redwood::Index.init -- 1.6.3.3 From wmorgan-sup@masanjin.net Sun Jan 17 15:39:58 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 17 Jan 2010 15:39:58 -0500 Subject: [sup-devel] RFC: Nuke remote sources In-Reply-To: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1263760710-sup-5382@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-17: > Every few days someone joins the IRC channel complaining of poor > performance or bugs with IMAP sources, and we have to tell them to use > offlineimap or fetchmail instead. I think this is a great idea. I'm sick of the same thing happening on the mailing list. I actually currently use a plain IMAP source successfully, but it's just a matter of time before it will start bogging down. > If people agree that this change is a good idea, I assume William will > add a deprecation notice to master for 0.10 and merge this patchset to > next. Yeah, another thing to add to 0.10... sigh. -- William From sup-bugs@masanjin.net Sun Jan 17 17:02:54 2010 From: sup-bugs@masanjin.net (Eric Sherman) Date: Sun, 17 Jan 2010 22:02:54 +0000 Subject: [sup-devel] [issue45] BufferManager.ask truncates responses to (terminal width - question length) In-Reply-To: <1263765774.58.0.0728242048264.issue45@masanjin.net> Message-ID: <1263765774.58.0.0728242048264.issue45@masanjin.net> New submission from Eric Sherman : BufferManager.ask truncates responses to (terminal width - question length). The easiest way to test if this happens in your environment: * open a search \ * hold down aaaaaaaaaabbbbbbbbbbbcccccccccccc and so on until you've wrapped across the terminal width a few times * refine search | * (you may need to left-arrow a little to see anything) * the string you are refining should be truncated where your cursor first went beyond the terminal width in the original search This does not happen for everyone. git next ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10] ncursesw (1.2.4.1) ---------- messages: 110 nosy: hyperbolist priority: bug ruby_version: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10] status: unread sup_version: git next title: BufferManager.ask truncates responses to (terminal width - question length) _________________________________________ Sup issue tracker _________________________________________ From wmorgan-sup@masanjin.net Sun Jan 17 18:12:50 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 17 Jan 2010 18:12:50 -0500 Subject: [sup-devel] [PATCH] only open mail files in binary mode on Ruby 1.9 In-Reply-To: <1262795751-sup-4525@masanjin.net> References: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> <1262729069-sup-2235@masanjin.net> <1262795751-sup-4525@masanjin.net> Message-ID: <1263769911-sup-6744@masanjin.net> Reformatted excerpts from William Morgan's message of 2010-01-06: > The internet claims that using "rb" and "wb" works for both 1.8.5 and > 1.9.1, but I haven't tried it. I've done this in ruby-1.9-encodings and remerged into next. Those of you tracking next with 1.9, please let me know if you experience any weird encoding errors. (And those with 1.8, as well, I suppose.) -- William From eg@gaute.vetsj.com Mon Jan 18 03:38:03 2010 From: eg@gaute.vetsj.com (Gaute Hope) Date: Mon, 18 Jan 2010 09:38:03 +0100 Subject: [sup-devel] [PATCH] only open mail files in binary mode on Ruby 1.9 In-Reply-To: <1263769911-sup-6744@masanjin.net> References: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> <1262729069-sup-2235@masanjin.net> <1262795751-sup-4525@masanjin.net> <1263769911-sup-6744@masanjin.net> Message-ID: <1263803813-sup-7395@dolk> Excerpts from William Morgan's message of 2010-01-18 00:12:50 +0100: > Reformatted excerpts from William Morgan's message of 2010-01-06: > > The internet claims that using "rb" and "wb" works for both 1.8.5 and > > 1.9.1, but I haven't tried it. > > I've done this in ruby-1.9-encodings and remerged into next. > > Those of you tracking next with 1.9, please let me know if you > experience any weird encoding errors. > > (And those with 1.8, as well, I suppose.) See issue 36, its a bit big: problems with subjects, tab completion, and recipients. - gaute From wmorgan-sup@masanjin.net Mon Jan 18 08:05:45 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 18 Jan 2010 08:05:45 -0500 Subject: [sup-devel] [PATCH] only open mail files in binary mode on Ruby 1.9 In-Reply-To: <1263803813-sup-7395@dolk> References: <1262634342-7029-1-git-send-email-rlane@club.cc.cmu.edu> <1262729069-sup-2235@masanjin.net> <1262795751-sup-4525@masanjin.net> <1263769911-sup-6744@masanjin.net> <1263803813-sup-7395@dolk> Message-ID: <1263819893-sup-815@masanjin.net> Reformatted excerpts from Gaute Hope's message of 2010-01-18: > See issue 36, its a bit big: problems with subjects, tab completion, > and recipients. This is an unrelated issue, though I agree it's important and should be addressed. Rich sent out a patch a while ago that added the special encoding pragma to a bunch of source files. That might fix this, as might putting a "u" at the end of every Regexp in the source. :( -- William From wmorgan-sup@masanjin.net Mon Jan 18 08:07:40 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 18 Jan 2010 08:07:40 -0500 Subject: [sup-devel] merged into master: ferret-deprecation In-Reply-To: <1263744321-sup-5501@ntdws12.chass.utoronto.ca> References: <1263742220-sup-2852@masanjin.net> <1263744321-sup-5501@ntdws12.chass.utoronto.ca> Message-ID: <1263820045-sup-5119@masanjin.net> Reformatted excerpts from Ben Walton's message of 2010-01-17: > Yes please! It's in. -- William From tero@tilus.net Mon Jan 18 08:39:39 2010 From: tero@tilus.net (Tero Tilus) Date: Mon, 18 Jan 2010 15:39:39 +0200 Subject: [sup-devel] merged into master: ferret-deprecation In-Reply-To: <1263742220-sup-2852@masanjin.net> References: <1263742220-sup-2852@masanjin.net> Message-ID: <1263821943-sup-1630@tilus.net> William Morgan, 2010-01-17 17:35: > I'm thinking about also merging in insta-save before 0.10 goes out > the door, probably with the patch that makes '$' flush > Xapian. Thoughts? If you do it, please include '$'-patch. -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ From wmorgan-sup@masanjin.net Mon Jan 18 12:06:28 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 18 Jan 2010 12:06:28 -0500 Subject: [sup-devel] RFC: Nuke remote sources In-Reply-To: <1263760710-sup-5382@masanjin.net> References: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> <1263760710-sup-5382@masanjin.net> Message-ID: <1263834319-sup-3032@masanjin.net> Reformatted excerpts from William Morgan's message of 2010-01-17: > Yeah, another thing to add to 0.10... sigh. On second thought, I'm going to wait to 0.12 to remove this, and add the deprecation notice on 0.11. The poor guy with a ferret index and multiple IMAP sources should have a fighting chance. I'm also going to try and spend less time between releases... -- William From hyperbolist@gmail.com Mon Jan 18 18:44:37 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Mon, 18 Jan 2010 18:44:37 -0500 Subject: [sup-devel] [PATCH] Saved Search Support Message-ID: <1263858172-sup-547@changeling.local> Start an index search with a \ backslash and press enter to get a list of searches that were previously saved from search-results-mode with % percent or added from search-list-mode directly. Saved searches may be used in other searches by enclosing their names in {} curly braces. Search names may contain letters, numbers, underscores and dashes. New Key Bindings global \ open search-list-mode search-list-mode X Delete selected search r Rename selected search e Edit selected search a Add new search search-results-mode % Save search New Hooks search-list-filter search-list-format Search String Expansion Include saved searches in other searches by enclosing their names in {} curly braces. The name and enclosing braces are replaced by the actual search string. When expanded, they are enclosed within parens to preserve logic. low_traffic: has:foo OR has:bar a_slow_week: {low_traffic} AND after:(7 days ago) {a_slow_week} expands to "(has:foo OR has:bar) AND after:(7 days ago)" and may be used in a global search, a refinement or another saved search. If a string enclosed in {} curly braces does not match a saved search name it is ignored. There is no nesting limit and searches are always expanded completely before they are turned into proper queries for the index. Shrinking Search Strings Search strings are kept as short as possible when displayed or saved. So a search string of "has:foo OR has:bar OR has:baz" added with the above searches would be saved as "{low_traffic} OR has:baz". This may or may not always be desirable, but it generally makes things easier. Editing, Renaming, Deleting Editing a search string that has been included in other searches will have no effect on those other searches' search strings, but they will expand with its new contents. Renaming a search that has been included in other searches will cause each occurrence in those other searches to be renamed as well. Deleting a search that has been included in other searches will cause it to expand into those other searches to prevent breaking them. Save File Format Searches are read from ~/.sup/searches.txt on startup and saved at exit. The format is "name: search_string". Here's a silly example: core: {me} AND NOT {crap} AND NOT {weak} crap: is:leadlogger OR is:alert OR is:rzp me: to:me OR from:me recently: after:(14 days ago) top: {core} AND {recently} weak: is:feed OR is:list OR is:ham FLAG_PURE_NOT I also added FLAG_PURE_NOT to the xapian parse_query requests to allow a query in the form of "NOT ", which is of questionable usefulness but at least sup won't bomb when this happens. --- bin/sup | 11 ++- lib/sup.rb | 5 + lib/sup/modes/search-list-mode.rb | 164 ++++++++++++++++++++++++++++++++++ lib/sup/modes/search-results-mode.rb | 14 +++- lib/sup/search.rb | 87 ++++++++++++++++++ lib/sup/xapian_index.rb | 2 +- 6 files changed, 276 insertions(+), 7 deletions(-) create mode 100644 lib/sup/modes/search-list-mode.rb create mode 100644 lib/sup/search.rb diff --git a/bin/sup b/bin/sup index 19b2a87..b865b6d 100755 --- a/bin/sup +++ b/bin/sup @@ -317,9 +317,14 @@ begin b, new = bm.spawn_unless_exists("Contact List") { ContactListMode.new } b.mode.load_in_background if new when :search - query = BufferManager.ask :search, "search all messages: " - next unless query && query !~ /^\s*$/ - SearchResultsMode.spawn_from_query query + query = BufferManager.ask :search, "Search all messages (enter for saved searches): " + unless query.nil? + if query.empty? + bm.spawn_unless_exists("Saved searches") { SearchListMode.new } + else + SearchResultsMode.spawn_from_query query + end + end when :search_unread SearchResultsMode.spawn_from_query "is:unread" when :list_labels diff --git a/lib/sup.rb b/lib/sup.rb index b83bbe7..b8a0977 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -50,6 +50,7 @@ module Redwood LOCK_FN = File.join(BASE_DIR, "lock") SUICIDE_FN = File.join(BASE_DIR, "please-kill-yourself") HOOK_DIR = File.join(BASE_DIR, "hooks") + SEARCH_FN = File.join(BASE_DIR, "searches.txt") YAML_DOMAIN = "masanjin.net" YAML_DATE = "2006-10-01" @@ -131,12 +132,14 @@ module Redwood Redwood::CryptoManager.init Redwood::UndoManager.init Redwood::SourceManager.init + Redwood::SearchManager.init Redwood::SEARCH_FN end def finish Redwood::LabelManager.save if Redwood::LabelManager.instantiated? Redwood::ContactManager.save if Redwood::ContactManager.instantiated? Redwood::BufferManager.deinstantiate! if Redwood::BufferManager.instantiated? + Redwood::SearchManager.save if Redwood::SearchManager.instantiated? end ## not really a good place for this, so I'll just dump it here. @@ -311,6 +314,8 @@ require "sup/modes/file-browser-mode" require "sup/modes/completion-mode" require "sup/modes/console-mode" require "sup/sent" +require "sup/search" +require "sup/modes/search-list-mode" $:.each do |base| d = File.join base, "sup/share/modes/" diff --git a/lib/sup/modes/search-list-mode.rb b/lib/sup/modes/search-list-mode.rb new file mode 100644 index 0000000..09d081c --- /dev/null +++ b/lib/sup/modes/search-list-mode.rb @@ -0,0 +1,164 @@ +module Redwood + +class SearchListMode < LineCursorMode + register_keymap do |k| + k.add :select_search, "Open search results", :enter + k.add :reload, "Discard saved search list and reload", '@' + k.add :jump_to_next_new, "Jump to next new thread", :tab + k.add :toggle_show_unread_only, "Toggle between showing all saved searches and those with unread mail", 'u' + k.add :delete_selected_search, "Delete selected search", "X" + k.add :rename_selected_search, "Rename selected search", "r" + k.add :edit_selected_search, "Edit selected search", "e" + k.add :add_new_search, "Add new search", "a" + end + + HookManager.register "search-list-filter", < 0 } || (0 ... curpos).find { |i| @searches[i][1] > 0 } + if n + ## jump there if necessary + jump_to_line n unless n >= topline && n < botline + set_cursor_pos n + else + BufferManager.flash "No saved searches with unread messages." + end + end + + def focus + reload # make sure unread message counts are up-to-date + end + + def handle_added_update sender, m + reload + end + +protected + + def toggle_show_unread_only + @unread_only = !@unread_only + reload + end + + def reload + regen_text + buffer.mark_dirty if buffer + end + + def regen_text + @text = [] + searches = SearchManager.all_searches + + counted = searches.map do |name| + search_string = SearchManager.search_string_for name + query = Index.parse_query(SearchManager.expand(search_string)) + total = Index.num_results_for :qobj => query[:qobj] + unread = Index.num_results_for :qobj => query[:qobj], :label => :unread + [name, search_string, total, unread] + end + + if HookManager.enabled? "search-list-filter" + counts = HookManager.run "search-list-filter", :counted => counted + else + counts = counted.sort_by { |n, s, t, u| n.downcase } + end + + n_width = counts.max_of { |n, s, t, u| n.length } + tmax = counts.max_of { |n, s, t, u| t } + umax = counts.max_of { |n, s, t, u| u } + s_width = counts.max_of { |n, s, t, u| s.length } + + if @unread_only + counts.delete_if { | n, s, t, u | u == 0 } + end + + @searches = [] + counts.map do |name, search_string, total, unread| + fmt = HookManager.run "search-list-format", :n_width => n_width, :tmax => tmax, :umax => umax, :s_width => s_width + if !fmt + fmt = "%#{n_width + 1}s %5d %s, %5d unread: %s" + end + @text << [[(unread == 0 ? :labellist_old_color : :labellist_new_color), + sprintf(fmt, name, total, total == 1 ? " message" : "messages", unread, search_string)]] + @searches << [name, unread] + end.compact + + BufferManager.flash "No saved searches with unread messages!" if counts.empty? && @unread_only + end + + def select_search + name, num_unread = @searches[curpos] + return unless name + SearchResultsMode.spawn_from_query SearchManager.search_string_for(name) + end + + def delete_selected_search + name, num_unread = @searches[curpos] + return unless name + reload if SearchManager.delete name + end + + def rename_selected_search + old_name, num_unread = @searches[curpos] + return unless old_name + new_name = BufferManager.ask :save_search, "Rename this saved search: ", old_name + return unless new_name && new_name !~ /^\s*$/ && new_name != old_name + reload if SearchManager.rename old_name, new_name + set_cursor_pos @searches.index([new_name, num_unread])||curpos + end + + def edit_selected_search + name, num_unread = @searches[curpos] + return unless name + old_search_string = SearchManager.search_string_for name + new_search_string = BufferManager.ask :search, "Edit this saved search: ", (old_search_string + " ") + return unless new_search_string && new_search_string !~ /^\s*$/ && new_search_string != old_search_string + reload if SearchManager.edit name, new_search_string + set_cursor_pos @searches.index([name, num_unread])||curpos + end + + def add_new_search + search_string = BufferManager.ask :search, "New search: " + return unless search_string && search_string !~ /^\s*$/ + name = BufferManager.ask :save_search, "Name for new search: " + return unless name && name !~ /^\s*$/ && !(SearchManager.all_searches.include? name) + reload if SearchManager.add name, search_string + set_cursor_pos @searches.index(@searches.assoc(name))||curpos + end +end + +end diff --git a/lib/sup/modes/search-results-mode.rb b/lib/sup/modes/search-results-mode.rb index 121e817..2237295 100644 --- a/lib/sup/modes/search-results-mode.rb +++ b/lib/sup/modes/search-results-mode.rb @@ -8,14 +8,21 @@ class SearchResultsMode < ThreadIndexMode register_keymap do |k| k.add :refine_search, "Refine search", '|' + k.add :save_search, "Save search", '%' end def refine_search - text = BufferManager.ask :search, "refine query: ", (@query[:text] + " ") + text = BufferManager.ask :search, "refine query: ", (SearchManager.shrink(@query[:text]) + " ") return unless text && text !~ /^\s*$/ SearchResultsMode.spawn_from_query text end + def save_search + name = BufferManager.ask :save_search, "Name this search: " + return unless name && name !~ /^\s*$/ + BufferManager.flash "Saved search." if SearchManager.add name, @query[:text] + end + ## a proper is_relevant? method requires some way of asking ferret ## if an in-memory object satisfies a query. i'm not sure how to do ## that yet. in the worst case i can make an in-memory index, add @@ -24,9 +31,10 @@ class SearchResultsMode < ThreadIndexMode def self.spawn_from_query text begin - query = Index.parse_query(text) + query = Index.parse_query(SearchManager.expand(text)) return unless query - short_text = text.length < 20 ? text : text[0 ... 20] + "..." + shrunk = SearchManager.shrink text + short_text = shrunk.length < 20 ? shrunk : shrunk[0 ... 20] + "..." mode = SearchResultsMode.new query BufferManager.spawn "search: \"#{short_text}\"", mode mode.load_threads :num => mode.buffer.content_height diff --git a/lib/sup/search.rb b/lib/sup/search.rb new file mode 100644 index 0000000..e2a1a35 --- /dev/null +++ b/lib/sup/search.rb @@ -0,0 +1,87 @@ +module Redwood + +class SearchManager + include Singleton + + def initialize fn + @fn = fn + @searches = {} + if File.exists? fn + IO.foreach(fn) do |l| + l =~ /^([^:]*): (.*)$/ or raise "can't parse #{fn} line #{l.inspect}" + @searches[$1] = $2 + end + end + @modified = false + @expanded = {} + expand_all + end + + def all_searches; return @searches.keys.sort; end + def search_string_for name; return @searches[name]; end + + def add name, search_string + name.strip! + search_string.strip! + unless name !~ /^[\w-]+$/ or @searches[name] == search_string + @searches[name] = shrink search_string + expand_all + shrink_all + @modified = true + end + end + + def rename old, new + new.strip! + return unless new =~ /^[\w-]+$/ and @searches.has_key? old + search_string = @searches[old] + delete old + add new, search_string + end + + def edit name, search_string + return unless @searches.has_key? name + ## we want to delete the old one, but not expand it into searches when doing so + @expanded.delete name + @searches.delete name + add name, search_string + end + + def delete name + return unless @searches.has_key? name + expand_into_searches name + @expanded.delete name + @searches.delete name + @modified = true + end + + def expand search_string + s = search_string.dup + ## stop trying to expand if there are no expansion candidates left, if the none of the remaining candidates represent a search name, or if the string has grown abnormally large due to what would have been infinite recursion + until (m = /\{([\w-]+)\}/.match(s)).nil? or m.captures.collect { |n| @expanded.keys.index n }.compact.size == 0 or s.size >= 2048 + m.captures.each { |n| s.gsub! "{#{n}}", "(#{@expanded[n]})" if @expanded.has_key? n } + end + return s + end + + def shrink search_string + s = search_string.dup + @expanded.each { |k, v| s.gsub! /\(?#{Regexp.escape v}\)?/, "{#{k}}" unless k == @expanded.index(s) } + @searches.each { |k, v| s.gsub! /\(?#{Regexp.escape v}\)?/, "{#{k}}" unless k == @searches.index(s) } + return s + end + + def save + return unless @modified + File.open(@fn, "w") { |f| @searches.sort.each { |(n, s)| f.puts "#{n}: #{s}" } } + @modified = false + end + +private + + def expand_into_searches name; @searches.values.each { |v| v.gsub! "{#{name}}", "(#{@searches[name]})" }; end + def expand_all; @expanded.replace(@searches).each { |k, v| @expanded[k] = expand v }; end + def shrink_all; @searches.each { |k, v| @searches[k] = shrink v }; end +end + +end diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index 0db5010..1bbde5d 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -263,7 +263,7 @@ EOS qp.add_valuerangeprocessor(Xapian::NumberValueRangeProcessor.new(DATE_VALUENO, 'date:', true)) NORMAL_PREFIX.each { |k,v| qp.add_prefix k, v } BOOLEAN_PREFIX.each { |k,v| qp.add_boolean_prefix k, v } - xapian_query = qp.parse_query(subs, Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_WILDCARD, PREFIX['body']) + xapian_query = qp.parse_query(subs, Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_WILDCARD|Xapian::QueryParser::FLAG_PURE_NOT, PREFIX['body']) debug "parsed xapian query: #{xapian_query.description}" -- 1.6.6 From rlane@club.cc.cmu.edu Tue Jan 19 13:00:32 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Tue, 19 Jan 2010 13:00:32 -0500 Subject: [sup-devel] [PATCH] Saved Search Support In-Reply-To: <1263858172-sup-547@changeling.local> References: <1263858172-sup-547@changeling.local> Message-ID: <1263920054-sup-9400@zyrg.net> Excerpts from Eric Sherman's message of 2010-01-18 18:44:37 -0500: > Start an index search with a \ backslash and press enter to get a list > of searches that were previously saved from search-results-mode with % > percent or added from search-list-mode directly. Saved searches may be > used in other searches by enclosing their names in {} curly braces. > Search names may contain letters, numbers, underscores and dashes. This is a nice feature. A few comments: I'd like it better if shrinking went away and the only time we expanded was right before giving it to parse_query. I'd rather not have the expand-on-delete or rename-tracking behaviors. These changes would simplify the code quite a bit. I think attempting to expand a nonexistent saved search should result in something false ("type:false", maybe), send a warning to the log, and perhaps flash an error message. On Ruby 1.9.1 I get: lib/sup/search.rb:69: warning: Hash#index is deprecated; use Hash#key SearchListMode#regen_text: looks like a mixup of each and map SearchListMode#add_new_search: Should flash an error message on name collisions, or allow overwriting. SearchListMode#rename_selected_search, SearchListMode#save_search: Name collision handling should be consistent with add_new_search. SearchManager: I'd replace the duplicated name checking regexes with a method. SearchManager#rename: I think the strip should be done by the caller. From sup-bugs@masanjin.net Tue Jan 19 13:35:36 2010 From: sup-bugs@masanjin.net (anonymous) Date: Tue, 19 Jan 2010 18:35:36 +0000 Subject: [sup-devel] [issue46] "stack level too deep" within xapian code In-Reply-To: <1263926136.68.0.119961985085.issue46@masanjin.net> Message-ID: <1263926136.68.0.119961985085.issue46@masanjin.net> New submission from anonymous: In the most recent next, after writing a message: --- SystemStackError from thread: main stack level too deep ./lib/sup/xapian_index.rb:600:in `old_add_term' ./lib/sup/xapian_index.rb:600:in `old_add_term' ./lib/sup/xapian_index.rb:600:in `add_term' ./lib/sup/xapian_index.rb:470:in `index_message_static' ./lib/sup/xapian_index.rb:470:in `each' ./lib/sup/xapian_index.rb:470:in `index_message_static' ./lib/sup/xapian_index.rb:474:in `[]' ./lib/sup/xapian_index.rb:474:in `index_message_static' ./lib/sup/xapian_index.rb:442:in `sync_message' ./lib/sup/xapian_index.rb:96:in `add_message' ./lib/sup/index.rb:236:in `send' ./lib/sup/index.rb:236:in `method_missing' ./lib/sup/poll.rb:183:in `add_new_message' ./lib/sup/util.rb:553:in `send' ./lib/sup/util.rb:553:in `method_missing' ./lib/sup/sent.rb:33:in `write_sent_message' ./lib/sup/poll.rb:169:in `each_message_from' ./lib/sup/imap.rb:197:in `each' ./lib/sup/imap.rb:185:in `upto' ./lib/sup/imap.rb:185:in `each' ./lib/sup/util.rb:593:in `send' ./lib/sup/util.rb:593:in `__pass' ./lib/sup/util.rb:580:in `method_missing' ./lib/sup/poll.rb:157:in `each_message_from' ./lib/sup/util.rb:553:in `send' ./lib/sup/util.rb:553:in `method_missing' ./lib/sup/sent.rb:30:in `write_sent_message' ./lib/sup/util.rb:553:in `send' ./lib/sup/util.rb:553:in `method_missing' ./lib/sup/modes/edit-message-mode.rb:325:in `send_message' ./lib/sup/mode.rb:51:in `send' ./lib/sup/mode.rb:51:in `handle_input' ./lib/sup/buffer.rb:272:in `handle_input' bin/sup:276 ---------- messages: 111 nosy: anonymous priority: bug ruby_version: 1.8.7 status: unread sup_version: git next title: "stack level too deep" within xapian code _________________________________________ Sup issue tracker _________________________________________ From rlane@club.cc.cmu.edu Tue Jan 19 16:48:25 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Tue, 19 Jan 2010 16:48:25 -0500 Subject: [sup-devel] [PATCH] asciify untrusted strings before displaying in TextMode Message-ID: <1263937705-10875-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/modes/file-browser-mode.rb | 2 +- lib/sup/modes/text-mode.rb | 2 +- lib/sup/modes/thread-view-mode.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sup/modes/file-browser-mode.rb b/lib/sup/modes/file-browser-mode.rb index b92468d..72e12db 100644 --- a/lib/sup/modes/file-browser-mode.rb +++ b/lib/sup/modes/file-browser-mode.rb @@ -47,7 +47,7 @@ protected return unless f && f.file? begin - BufferManager.spawn f.to_s, TextMode.new(f.read) + BufferManager.spawn f.to_s, TextMode.new(f.read.ascii) rescue SystemCallError => e BufferManager.flash e.message end diff --git a/lib/sup/modes/text-mode.rb b/lib/sup/modes/text-mode.rb index 7c9e7d8..e772ff5 100644 --- a/lib/sup/modes/text-mode.rb +++ b/lib/sup/modes/text-mode.rb @@ -29,7 +29,7 @@ class TextMode < ScrollMode end if output - BufferManager.spawn "Output of '#{command}'", TextMode.new(output) + BufferManager.spawn "Output of '#{command}'", TextMode.new(output.ascii) else BufferManager.flash "'#{command}' done!" end diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index b08c819..0e935a4 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -613,7 +613,7 @@ EOS end if output - BufferManager.spawn "Output of '#{command}'", TextMode.new(output) + BufferManager.spawn "Output of '#{command}'", TextMode.new(output.ascii) else BufferManager.flash "'#{command}' done!" end @@ -815,7 +815,7 @@ private BufferManager.erase_flash BufferManager.completely_redraw_screen unless success - BufferManager.spawn "Attachment: #{chunk.filename}", TextMode.new(chunk.to_s, chunk.filename) + BufferManager.spawn "Attachment: #{chunk.filename}", TextMode.new(chunk.to_s.ascii, chunk.filename) BufferManager.flash "Couldn't execute view command, viewing as text." end end -- 1.5.6.5 From hyperbolist@gmail.com Tue Jan 19 22:46:35 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Tue, 19 Jan 2010 22:46:35 -0500 Subject: [sup-devel] [PATCH] Saved Search Support In-Reply-To: <1263920054-sup-9400@zyrg.net> References: <1263858172-sup-547@changeling.local> <1263920054-sup-9400@zyrg.net> Message-ID: <1263959057-sup-3237@changeling.local> Excerpts from Rich Lane's message of Tue Jan 19 13:00:32 -0500 2010: > I'd like it better if shrinking went away and the only time we expanded > was right before giving it to parse_query. I'd rather not have the > expand-on-delete or rename-tracking behaviors. I'm not sure why I thought any of that was such a great idea. > I think attempting to expand a nonexistent saved search should result in > something false ("type:false", maybe), send a warning to the log, and > perhaps flash an error message. SearchManager#expand now returns false, logs a warning and flashes an error message when expansion fails. > On Ruby 1.9.1 I get: > lib/sup/search.rb:69: warning: Hash#index is deprecated; use Hash#key Removed. > SearchListMode#regen_text: looks like a mixup of each and map Fixed. > SearchListMode#add_new_search: > Should flash an error message on name collisions, or allow overwriting. > > SearchListMode#rename_selected_search, SearchListMode#save_search: > Name collision handling should be consistent with add_new_search. An error message is flashed. > SearchManager: > I'd replace the duplicated name checking regexes with a method. Replaced. > SearchManager#rename: > I think the strip should be done by the caller. Done. From hyperbolist@gmail.com Tue Jan 19 22:48:50 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Tue, 19 Jan 2010 22:48:50 -0500 Subject: [sup-devel] [PATCHv2] Saved Search Support In-Reply-To: <1263920054-sup-9400@zyrg.net> References: <1263858172-sup-547@changeling.local> <1263920054-sup-9400@zyrg.net> Message-ID: <1263959248-sup-4163@changeling.local> Start an index search with a \ backslash and press enter to get a list of searches that were previously saved from search-results-mode with % percent or added from search-list-mode directly. Saved searches may be used in other searches by enclosing their names in {} curly braces. Search names may contain letters, numbers, underscores and dashes. New Key Bindings global \ open search-list-mode search-list-mode X Delete selected search r Rename selected search e Edit selected search a Add new search search-results-mode % Save search New Hooks search-list-filter search-list-format Search String Expansion Include saved searches in other searches by enclosing their names in {} curly braces. The name and enclosing braces are replaced by the actual search string and enclosing () parens. low_traffic: has:foo OR has:bar a_slow_week: {low_traffic} AND after:(7 days ago) {a_slow_week} expands to "(has:foo OR has:bar) AND after:(7 days ago)" and may be used in a global search, a refinement or another saved search. A search including the undefined {baz} will fail. To search for a literal string enclosed in curly braces, escape the curly braces with \ backslash: "\{baz\}". There is no nesting limit and searches are always expanded completely before they are turned into proper queries for the index. Save File Format Searches are read from ~/.sup/searches.txt on startup and saved at exit. The format is "name: search_string". Here's a silly example: core: {me} AND NOT {crap} AND NOT {weak} crap: is:leadlogger OR is:alert OR is:rzp me: to:me OR from:me recent: after:(14 days ago) top: {core} AND {recent} weak: is:feed OR is:list OR is:ham --- bin/sup | 11 ++- lib/sup.rb | 5 + lib/sup/modes/search-list-mode.rb | 188 ++++++++++++++++++++++++++++++++++ lib/sup/modes/search-results-mode.rb | 23 ++++- lib/sup/search.rb | 72 +++++++++++++ 5 files changed, 294 insertions(+), 5 deletions(-) create mode 100644 lib/sup/modes/search-list-mode.rb create mode 100644 lib/sup/search.rb diff --git a/bin/sup b/bin/sup index 8bf640b..fb19795 100755 --- a/bin/sup +++ b/bin/sup @@ -303,9 +303,14 @@ begin b, new = bm.spawn_unless_exists("Contact List") { ContactListMode.new } b.mode.load_in_background if new when :search - query = BufferManager.ask :search, "search all messages: " - next unless query && query !~ /^\s*$/ - SearchResultsMode.spawn_from_query query + query = BufferManager.ask :search, "Search all messages (enter for saved searches): " + unless query.nil? + if query.empty? + bm.spawn_unless_exists("Saved searches") { SearchListMode.new } + else + SearchResultsMode.spawn_from_query query + end + end when :search_unread SearchResultsMode.spawn_from_query "is:unread" when :list_labels diff --git a/lib/sup.rb b/lib/sup.rb index e03a35d..b9dc749 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -50,6 +50,7 @@ module Redwood LOCK_FN = File.join(BASE_DIR, "lock") SUICIDE_FN = File.join(BASE_DIR, "please-kill-yourself") HOOK_DIR = File.join(BASE_DIR, "hooks") + SEARCH_FN = File.join(BASE_DIR, "searches.txt") YAML_DOMAIN = "masanjin.net" YAML_DATE = "2006-10-01" @@ -131,12 +132,14 @@ module Redwood Redwood::CryptoManager.init Redwood::UndoManager.init Redwood::SourceManager.init + Redwood::SearchManager.init Redwood::SEARCH_FN end def finish Redwood::LabelManager.save if Redwood::LabelManager.instantiated? Redwood::ContactManager.save if Redwood::ContactManager.instantiated? Redwood::BufferManager.deinstantiate! if Redwood::BufferManager.instantiated? + Redwood::SearchManager.save if Redwood::SearchManager.instantiated? end ## not really a good place for this, so I'll just dump it here. @@ -341,6 +344,8 @@ require "sup/modes/file-browser-mode" require "sup/modes/completion-mode" require "sup/modes/console-mode" require "sup/sent" +require "sup/search" +require "sup/modes/search-list-mode" $:.each do |base| d = File.join base, "sup/share/modes/" diff --git a/lib/sup/modes/search-list-mode.rb b/lib/sup/modes/search-list-mode.rb new file mode 100644 index 0000000..076c3d9 --- /dev/null +++ b/lib/sup/modes/search-list-mode.rb @@ -0,0 +1,188 @@ +module Redwood + +class SearchListMode < LineCursorMode + register_keymap do |k| + k.add :select_search, "Open search results", :enter + k.add :reload, "Discard saved search list and reload", '@' + k.add :jump_to_next_new, "Jump to next new thread", :tab + k.add :toggle_show_unread_only, "Toggle between showing all saved searches and those with unread mail", 'u' + k.add :delete_selected_search, "Delete selected search", "X" + k.add :rename_selected_search, "Rename selected search", "r" + k.add :edit_selected_search, "Edit selected search", "e" + k.add :add_new_search, "Add new search", "a" + end + + HookManager.register "search-list-filter", < 0 } || (0 ... curpos).find { |i| @searches[i][1] > 0 } + if n + ## jump there if necessary + jump_to_line n unless n >= topline && n < botline + set_cursor_pos n + else + BufferManager.flash "No saved searches with unread messages." + end + end + + def focus + reload # make sure unread message counts are up-to-date + end + + def handle_added_update sender, m + reload + end + +protected + + def toggle_show_unread_only + @unread_only = !@unread_only + reload + end + + def reload + regen_text + buffer.mark_dirty if buffer + end + + def regen_text + @text = [] + searches = SearchManager.all_searches + + counted = searches.map do |name| + search_string = SearchManager.search_string_for name + expanded_search_string= SearchManager.expand search_string + if expanded_search_string + query = Index.parse_query expanded_search_string + total = Index.num_results_for :qobj => query[:qobj] + unread = Index.num_results_for :qobj => query[:qobj], :label => :unread + else + total = 0 + unread = 0 + end + [name, search_string, total, unread] + end + + if HookManager.enabled? "search-list-filter" + counts = HookManager.run "search-list-filter", :counted => counted + else + counts = counted.sort_by { |n, s, t, u| n.downcase } + end + + n_width = counts.max_of { |n, s, t, u| n.length } + tmax = counts.max_of { |n, s, t, u| t } + umax = counts.max_of { |n, s, t, u| u } + s_width = counts.max_of { |n, s, t, u| s.length } + + if @unread_only + counts.delete_if { | n, s, t, u | u == 0 } + end + + @searches = [] + counts.each do |name, search_string, total, unread| + fmt = HookManager.run "search-list-format", :n_width => n_width, :tmax => tmax, :umax => umax, :s_width => s_width + if !fmt + fmt = "%#{n_width + 1}s %5d %s, %5d unread: %s" + end + @text << [[(unread == 0 ? :labellist_old_color : :labellist_new_color), + sprintf(fmt, name, total, total == 1 ? " message" : "messages", unread, search_string)]] + @searches << [name, unread] + end + + BufferManager.flash "No saved searches with unread messages!" if counts.empty? && @unread_only + end + + def select_search + name, num_unread = @searches[curpos] + return unless name + SearchResultsMode.spawn_from_query SearchManager.search_string_for(name) + end + + def delete_selected_search + name, num_unread = @searches[curpos] + return unless name + reload if SearchManager.delete name + end + + def rename_selected_search + old_name, num_unread = @searches[curpos] + return unless old_name + new_name = BufferManager.ask :save_search, "Rename this saved search: ", old_name + return unless new_name && new_name !~ /^\s*$/ && new_name != old_name + new_name.strip! + unless SearchManager.valid_name? new_name + BufferManager.flash "Not renamed: " + SearchManager.name_format_hint + return + end + if SearchManager.all_searches.include? new_name + BufferManager.flash "Not renamed: \"#{new_name}\" already exists" + return + end + reload if SearchManager.rename old_name, new_name + set_cursor_pos @searches.index([new_name, num_unread])||curpos + end + + def edit_selected_search + name, num_unread = @searches[curpos] + return unless name + old_search_string = SearchManager.search_string_for name + new_search_string = BufferManager.ask :search, "Edit this saved search: ", (old_search_string + " ") + return unless new_search_string && new_search_string !~ /^\s*$/ && new_search_string != old_search_string + reload if SearchManager.edit name, new_search_string.strip + set_cursor_pos @searches.index([name, num_unread])||curpos + end + + def add_new_search + search_string = BufferManager.ask :search, "New search: " + return unless search_string && search_string !~ /^\s*$/ + name = BufferManager.ask :save_search, "Name this search: " + return unless name && name !~ /^\s*$/ + name.strip! + unless SearchManager.valid_name? name + BufferManager.flash "Not saved: " + SearchManager.name_format_hint + return + end + if SearchManager.all_searches.include? name + BufferManager.flash "Not saved: \"#{name}\" already exists" + return + end + reload if SearchManager.add name, search_string.strip + set_cursor_pos @searches.index(@searches.assoc(name))||curpos + end +end + +end diff --git a/lib/sup/modes/search-results-mode.rb b/lib/sup/modes/search-results-mode.rb index 121e817..14d42b5 100644 --- a/lib/sup/modes/search-results-mode.rb +++ b/lib/sup/modes/search-results-mode.rb @@ -8,14 +8,30 @@ class SearchResultsMode < ThreadIndexMode register_keymap do |k| k.add :refine_search, "Refine search", '|' + k.add :save_search, "Save search", '%' end def refine_search - text = BufferManager.ask :search, "refine query: ", (@query[:text] + " ") + text = BufferManager.ask :search, "refine query: ", (@query[:unexpanded_text] + " ") return unless text && text !~ /^\s*$/ SearchResultsMode.spawn_from_query text end + def save_search + name = BufferManager.ask :save_search, "Name this search: " + return unless name && name !~ /^\s*$/ + name.strip! + unless SearchManager.valid_name? name + BufferManager.flash "Not saved: " + SearchManager.name_format_hint + return + end + if SearchManager.all_searches.include? name + BufferManager.flash "Not saved: \"#{name}\" already exists" + return + end + BufferManager.flash "Search saved as \"#{name}\"" if SearchManager.add name, @query[:unexpanded_text].strip + end + ## a proper is_relevant? method requires some way of asking ferret ## if an in-memory object satisfies a query. i'm not sure how to do ## that yet. in the worst case i can make an in-memory index, add @@ -24,8 +40,11 @@ class SearchResultsMode < ThreadIndexMode def self.spawn_from_query text begin - query = Index.parse_query(text) + expanded_text = SearchManager.expand text + return unless expanded_text + query = Index.parse_query expanded_text return unless query + query[:unexpanded_text] = text short_text = text.length < 20 ? text : text[0 ... 20] + "..." mode = SearchResultsMode.new query BufferManager.spawn "search: \"#{short_text}\"", mode diff --git a/lib/sup/search.rb b/lib/sup/search.rb new file mode 100644 index 0000000..799ca89 --- /dev/null +++ b/lib/sup/search.rb @@ -0,0 +1,72 @@ +module Redwood + +class SearchManager + include Singleton + + def initialize fn + @fn = fn + @searches = {} + if File.exists? fn + IO.foreach(fn) do |l| + l =~ /^([^:]*): (.*)$/ or raise "can't parse #{fn} line #{l.inspect}" + @searches[$1] = $2 + end + end + @modified = false + end + + def all_searches; return @searches.keys.sort; end + def search_string_for name; return @searches[name]; end + def valid_name? name; name =~ /^[\w-]+$/; end + def name_format_hint; "letters, numbers, underscores and dashes only"; end + + def add name, search_string + return unless valid_name? name + @searches[name] = search_string + @modified = true + end + + def rename old, new + return unless @searches.has_key? old + search_string = @searches[old] + delete old if add new, search_string + end + + def edit name, search_string + return unless @searches.has_key? name + @searches[name] = search_string + @modified = true + end + + def delete name + return unless @searches.has_key? name + @searches.delete name + @modified = true + end + + def expand search_string + expanded = search_string.dup + until (matches = expanded.scan(/\{([\w-]+)\}/).flatten).empty? + if !(unknown = matches - @searches.keys).empty? + error_message = "Unknown \"#{unknown.join('", "')}\" when expanding \"#{search_string}\"" + elsif expanded.size >= 2048 + error_message = "Check for infinite recursion in \"#{search_string}\"" + end + if error_message + warn error_message + BufferManager.flash error_message + return false + end + matches.each { |n| expanded.gsub! "{#{n}}", "(#{@searches[n]})" if @searches.has_key? n } + end + return expanded + end + + def save + return unless @modified + File.open(@fn, "w") { |f| @searches.sort.each { |(n, s)| f.puts "#{n}: #{s}" } } + @modified = false + end +end + +end -- 1.6.6 From rlane@club.cc.cmu.edu Wed Jan 20 01:14:46 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Wed, 20 Jan 2010 01:14:46 -0500 Subject: [sup-devel] [PATCHv2] Saved Search Support In-Reply-To: <1263959248-sup-4163@changeling.local> References: <1263858172-sup-547@changeling.local> <1263920054-sup-9400@zyrg.net> <1263959248-sup-4163@changeling.local> Message-ID: <1263960767-sup-4706@zyrg.net> Excerpts from Eric Sherman's message of 2010-01-19 22:48:50 -0500: > There is no nesting limit and searches are always expanded completely > before they are turned into proper queries for the index. What do you think about doing the expansion in Index.parse_query, right after the custom-search hook? That would save you from keeping track of the unexpanded text. Otherwise this patch looks good to me. From aluink@gmail.com Tue Jan 19 15:04:02 2010 From: aluink@gmail.com (Eric Polino) Date: Tue, 19 Jan 2010 15:04:02 -0500 Subject: [sup-devel] Problems Syncing Message-ID: <1263931111-sup-1739@europa> I'm trying to sync my local repository to my AllMail folder in GMail. All works fine until it reaches a given point. I'm guessing there's some message somewhere that's causing a problem, but I have no idea what to do about it, nor how to find this message. Here's what happens when I run sup-sync. I'm not sure what other information you'll need to help you find this problem, so let me know what you need and I'll do my best to get it to you. I did find a place that was saying that getting the lastest version of sup from the git repository could fix this problem...it didn't. TIA! $ sup -v sup v0.9.1 $ cat ~/.sup/sources.yaml --- - !masanjin.net,2006-10-01/Redwood/IMAP uri: imaps://imap.gmail.com/INBOX username: me password: secret cur_offset: 12635776080006406 usual: true archived: false id: 1 labels: - inbox - !masanjin.net,2006-10-01/Redwood/IMAP uri: imaps://imap.gmail.com/%5BGmail%5D%2FAll+Mail username: me password: secret cur_offset: 11622394250003302 usual: true archived: false id: 2 labels: [] - !masanjin.net,2006-10-01/Redwood/DraftLoader cur_offset: 0 - !masanjin.net,2006-10-01/Redwood/SentLoader cur_offset: 10325 $ cat ~/.sup/config.yaml --- :thread_by_subject: false :confirm_no_attachments: true :edit_signature: false :editor: /usr/bin/vim -f -c 'setlocal spell spelllang=en_us' -c 'set filetype=mail' :confirm_top_posting: true :accounts: :default: :signature: /home/aluink/.signature :email: me at gmail.com :name: Eric Polino :alternates: [] :sendmail: msmtp --account=gmail -t :ask_for_to: true :sent_source: sup://sent :discard_snippets_from_encrypted_messages: false :ask_for_cc: true :default_attachment_save_dir: "" :ask_for_bcc: false :ask_for_subject: true ## read 6085m (about 28%) @ 2.3m/s. 0:43:49 elapsed, about 1:52:15 remaining ## read 6112m (about 28%) @ 2.3m/s. 0:44:04 elapsed, about 1:52:32 remaining ## read 6150m (about 28%) @ 2.3m/s. 0:44:20 elapsed, about 1:52:38 remaining ## read 6188m (about 28%) @ 2.3m/s. 0:44:35 elapsed, about 1:52:45 remaining ## read 6202m (about 28%) @ 2.3m/s. 0:44:53 elapsed, about 1:53:19 remaining ## read 6244m (about 28%) @ 2.3m/s. 0:45:09 elapsed, about 1:53:23 remaining ## read 6284m (about 29%) @ 2.3m/s. 0:45:24 elapsed, about 1:53:28 remaining ## read 6323m (about 29%) @ 2.3m/s. 0:45:39 elapsed, about 1:53:33 remaining ## read 6362m (about 29%) @ 2.3m/s. 0:45:54 elapsed, about 1:53:38 remaining [Tue Jan 19 14:03:31 -0500 2010] WARNING: problem getting messages from imaps://imap.gmail.com/%5BGmail%5D%2FAll+Mail: While communicating with IMAP server (type Net::IMAP::NoResponseError): "Some messages could not be FETCHed (Failure)" /home/aluink/.gem/ruby/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:421:in `[]': :(null) isn't a valid argument for IndexReader.get_document(index) (ArgumentError) from /home/aluink/.gem/ruby/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:421:in `[]' from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' from /home/aluink/.gem/ruby/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:413:in `[]' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/ferret_index.rb:257:in `build_message' from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/ferret_index.rb:256:in `build_message' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/bin/sup-sync:149 from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/poll.rb:154:in `each_message_from' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/imap.rb:197:in `each' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/imap.rb:185:in `upto' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/imap.rb:185:in `each' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/util.rb:560:in `send' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/util.rb:560:in `__pass' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/util.rb:547:in `method_missing' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/poll.rb:142:in `each_message_from' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/util.rb:520:in `send' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/lib/sup/util.rb:520:in `method_missing' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/bin/sup-sync:146 from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/bin/sup-sync:141:in `each' from /home/aluink/.gem/ruby/1.8/gems/sup-0.9.1/bin/sup-sync:141 from /home/aluink/.gem/ruby/1.8/bin/sup-sync:19:in `load' from /home/aluink/.gem/ruby/1.8/bin/sup-sync:19 From hyperbolist@gmail.com Wed Jan 20 09:25:57 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Wed, 20 Jan 2010 09:25:57 -0500 Subject: [sup-devel] [PATCHv2] Saved Search Support In-Reply-To: <1263960767-sup-4706@zyrg.net> References: <1263858172-sup-547@changeling.local> <1263920054-sup-9400@zyrg.net> <1263959248-sup-4163@changeling.local> <1263960767-sup-4706@zyrg.net> Message-ID: <1263997033-sup-7590@changeling.local> Excerpts from Rich Lane's message of Wed Jan 20 01:14:46 -0500 2010: > What do you think about doing the expansion in Index.parse_query, right > after the custom-search hook? That would save you from keeping track of > the unexpanded text. Otherwise this patch looks good to me. Works for me. I hadn't even considered it, thinking the index is sacred code. Another side-effect of making this change is ParseErrors are now gracefully handled in search-list-mode where before they would have crashed sup because I wasn't thinking. Instead of returning false and flashing like in the previous patch, SearchManager#expand raises an ExpansionError, which parse_query re-raises as a ParseError. From hyperbolist@gmail.com Wed Jan 20 09:28:39 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Wed, 20 Jan 2010 09:28:39 -0500 Subject: [sup-devel] [PATCHv3] Saved Search Support In-Reply-To: <1263960767-sup-4706@zyrg.net> References: <1263858172-sup-547@changeling.local> <1263920054-sup-9400@zyrg.net> <1263959248-sup-4163@changeling.local> <1263960767-sup-4706@zyrg.net> Message-ID: <1263997604-sup-9969@changeling.local> Start an index search with a \ backslash and press enter to get a list of searches that were previously saved from search-results-mode with % percent or added from search-list-mode directly. Saved searches may be used in other searches by enclosing their names in {} curly braces. Search names may contain letters, numbers, underscores and dashes. New Key Bindings global \ open search-list-mode search-list-mode X Delete selected search r Rename selected search e Edit selected search a Add new search search-results-mode % Save search New Hooks search-list-filter search-list-format Search String Expansion Include saved searches in other searches by enclosing their names in {} curly braces. The name and enclosing braces are replaced by the actual search string and enclosing () parens. low_traffic: has:foo OR has:bar a_slow_week: {low_traffic} AND after:(7 days ago) {a_slow_week} expands to "(has:foo OR has:bar) AND after:(7 days ago)" and may be used in a global search, a refinement or another saved search. A search including the undefined {baz} will fail. To search for a literal string enclosed in curly braces, escape the curly braces with \ backslash: "\{baz\}". There is no nesting limit. Save File Format Searches are read from ~/.sup/searches.txt on startup and saved at exit. The format is "name: search_string". Here's a silly example: core: {me} AND NOT {crap} AND NOT {weak} crap: is:leadlogger OR is:alert OR is:rzp me: to:me OR from:me recent: after:(14 days ago) top: {core} AND {recent} weak: is:feed OR is:list OR is:ham --- bin/sup | 11 ++- lib/sup.rb | 5 + lib/sup/modes/search-list-mode.rb | 188 ++++++++++++++++++++++++++++++++++ lib/sup/modes/search-results-mode.rb | 16 +++ lib/sup/search.rb | 73 +++++++++++++ lib/sup/xapian_index.rb | 5 + 6 files changed, 295 insertions(+), 3 deletions(-) create mode 100644 lib/sup/modes/search-list-mode.rb create mode 100644 lib/sup/search.rb diff --git a/bin/sup b/bin/sup index 8bf640b..fb19795 100755 --- a/bin/sup +++ b/bin/sup @@ -303,9 +303,14 @@ begin b, new = bm.spawn_unless_exists("Contact List") { ContactListMode.new } b.mode.load_in_background if new when :search - query = BufferManager.ask :search, "search all messages: " - next unless query && query !~ /^\s*$/ - SearchResultsMode.spawn_from_query query + query = BufferManager.ask :search, "Search all messages (enter for saved searches): " + unless query.nil? + if query.empty? + bm.spawn_unless_exists("Saved searches") { SearchListMode.new } + else + SearchResultsMode.spawn_from_query query + end + end when :search_unread SearchResultsMode.spawn_from_query "is:unread" when :list_labels diff --git a/lib/sup.rb b/lib/sup.rb index e03a35d..b9dc749 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -50,6 +50,7 @@ module Redwood LOCK_FN = File.join(BASE_DIR, "lock") SUICIDE_FN = File.join(BASE_DIR, "please-kill-yourself") HOOK_DIR = File.join(BASE_DIR, "hooks") + SEARCH_FN = File.join(BASE_DIR, "searches.txt") YAML_DOMAIN = "masanjin.net" YAML_DATE = "2006-10-01" @@ -131,12 +132,14 @@ module Redwood Redwood::CryptoManager.init Redwood::UndoManager.init Redwood::SourceManager.init + Redwood::SearchManager.init Redwood::SEARCH_FN end def finish Redwood::LabelManager.save if Redwood::LabelManager.instantiated? Redwood::ContactManager.save if Redwood::ContactManager.instantiated? Redwood::BufferManager.deinstantiate! if Redwood::BufferManager.instantiated? + Redwood::SearchManager.save if Redwood::SearchManager.instantiated? end ## not really a good place for this, so I'll just dump it here. @@ -341,6 +344,8 @@ require "sup/modes/file-browser-mode" require "sup/modes/completion-mode" require "sup/modes/console-mode" require "sup/sent" +require "sup/search" +require "sup/modes/search-list-mode" $:.each do |base| d = File.join base, "sup/share/modes/" diff --git a/lib/sup/modes/search-list-mode.rb b/lib/sup/modes/search-list-mode.rb new file mode 100644 index 0000000..8f73659 --- /dev/null +++ b/lib/sup/modes/search-list-mode.rb @@ -0,0 +1,188 @@ +module Redwood + +class SearchListMode < LineCursorMode + register_keymap do |k| + k.add :select_search, "Open search results", :enter + k.add :reload, "Discard saved search list and reload", '@' + k.add :jump_to_next_new, "Jump to next new thread", :tab + k.add :toggle_show_unread_only, "Toggle between showing all saved searches and those with unread mail", 'u' + k.add :delete_selected_search, "Delete selected search", "X" + k.add :rename_selected_search, "Rename selected search", "r" + k.add :edit_selected_search, "Edit selected search", "e" + k.add :add_new_search, "Add new search", "a" + end + + HookManager.register "search-list-filter", < 0 } || (0 ... curpos).find { |i| @searches[i][1] > 0 } + if n + ## jump there if necessary + jump_to_line n unless n >= topline && n < botline + set_cursor_pos n + else + BufferManager.flash "No saved searches with unread messages." + end + end + + def focus + reload # make sure unread message counts are up-to-date + end + + def handle_added_update sender, m + reload + end + +protected + + def toggle_show_unread_only + @unread_only = !@unread_only + reload + end + + def reload + regen_text + buffer.mark_dirty if buffer + end + + def regen_text + @text = [] + searches = SearchManager.all_searches + + counted = searches.map do |name| + search_string = SearchManager.search_string_for name + begin + query = Index.parse_query search_string + total = Index.num_results_for :qobj => query[:qobj] + unread = Index.num_results_for :qobj => query[:qobj], :label => :unread + rescue Index::ParseError => e + BufferManager.flash "Problem: #{e.message}!" + total = 0 + unread = 0 + end + [name, search_string, total, unread] + end + + if HookManager.enabled? "search-list-filter" + counts = HookManager.run "search-list-filter", :counted => counted + else + counts = counted.sort_by { |n, s, t, u| n.downcase } + end + + n_width = counts.max_of { |n, s, t, u| n.length } + tmax = counts.max_of { |n, s, t, u| t } + umax = counts.max_of { |n, s, t, u| u } + s_width = counts.max_of { |n, s, t, u| s.length } + + if @unread_only + counts.delete_if { | n, s, t, u | u == 0 } + end + + @searches = [] + counts.each do |name, search_string, total, unread| + fmt = HookManager.run "search-list-format", :n_width => n_width, :tmax => tmax, :umax => umax, :s_width => s_width + if !fmt + fmt = "%#{n_width + 1}s %5d %s, %5d unread: %s" + end + @text << [[(unread == 0 ? :labellist_old_color : :labellist_new_color), + sprintf(fmt, name, total, total == 1 ? " message" : "messages", unread, search_string)]] + @searches << [name, unread] + end + + BufferManager.flash "No saved searches with unread messages!" if counts.empty? && @unread_only + end + + def select_search + name, num_unread = @searches[curpos] + return unless name + SearchResultsMode.spawn_from_query SearchManager.search_string_for(name) + end + + def delete_selected_search + name, num_unread = @searches[curpos] + return unless name + reload if SearchManager.delete name + end + + def rename_selected_search + old_name, num_unread = @searches[curpos] + return unless old_name + new_name = BufferManager.ask :save_search, "Rename this saved search: ", old_name + return unless new_name && new_name !~ /^\s*$/ && new_name != old_name + new_name.strip! + unless SearchManager.valid_name? new_name + BufferManager.flash "Not renamed: " + SearchManager.name_format_hint + return + end + if SearchManager.all_searches.include? new_name + BufferManager.flash "Not renamed: \"#{new_name}\" already exists" + return + end + reload if SearchManager.rename old_name, new_name + set_cursor_pos @searches.index([new_name, num_unread])||curpos + end + + def edit_selected_search + name, num_unread = @searches[curpos] + return unless name + old_search_string = SearchManager.search_string_for name + new_search_string = BufferManager.ask :search, "Edit this saved search: ", (old_search_string + " ") + return unless new_search_string && new_search_string !~ /^\s*$/ && new_search_string != old_search_string + reload if SearchManager.edit name, new_search_string.strip + set_cursor_pos @searches.index([name, num_unread])||curpos + end + + def add_new_search + search_string = BufferManager.ask :search, "New search: " + return unless search_string && search_string !~ /^\s*$/ + name = BufferManager.ask :save_search, "Name this search: " + return unless name && name !~ /^\s*$/ + name.strip! + unless SearchManager.valid_name? name + BufferManager.flash "Not saved: " + SearchManager.name_format_hint + return + end + if SearchManager.all_searches.include? name + BufferManager.flash "Not saved: \"#{name}\" already exists" + return + end + reload if SearchManager.add name, search_string.strip + set_cursor_pos @searches.index(@searches.assoc(name))||curpos + end +end + +end diff --git a/lib/sup/modes/search-results-mode.rb b/lib/sup/modes/search-results-mode.rb index 121e817..5b529a8 100644 --- a/lib/sup/modes/search-results-mode.rb +++ b/lib/sup/modes/search-results-mode.rb @@ -8,6 +8,7 @@ class SearchResultsMode < ThreadIndexMode register_keymap do |k| k.add :refine_search, "Refine search", '|' + k.add :save_search, "Save search", '%' end def refine_search @@ -16,6 +17,21 @@ class SearchResultsMode < ThreadIndexMode SearchResultsMode.spawn_from_query text end + def save_search + name = BufferManager.ask :save_search, "Name this search: " + return unless name && name !~ /^\s*$/ + name.strip! + unless SearchManager.valid_name? name + BufferManager.flash "Not saved: " + SearchManager.name_format_hint + return + end + if SearchManager.all_searches.include? name + BufferManager.flash "Not saved: \"#{name}\" already exists" + return + end + BufferManager.flash "Search saved as \"#{name}\"" if SearchManager.add name, @query[:text].strip + end + ## a proper is_relevant? method requires some way of asking ferret ## if an in-memory object satisfies a query. i'm not sure how to do ## that yet. in the worst case i can make an in-memory index, add diff --git a/lib/sup/search.rb b/lib/sup/search.rb new file mode 100644 index 0000000..0c63b06 --- /dev/null +++ b/lib/sup/search.rb @@ -0,0 +1,73 @@ +module Redwood + +class SearchManager + include Singleton + + class ExpansionError < StandardError; end + + def initialize fn + @fn = fn + @searches = {} + if File.exists? fn + IO.foreach(fn) do |l| + l =~ /^([^:]*): (.*)$/ or raise "can't parse #{fn} line #{l.inspect}" + @searches[$1] = $2 + end + end + @modified = false + end + + def all_searches; return @searches.keys.sort; end + def search_string_for name; return @searches[name]; end + def valid_name? name; name =~ /^[\w-]+$/; end + def name_format_hint; "letters, numbers, underscores and dashes only"; end + + def add name, search_string + return unless valid_name? name + @searches[name] = search_string + @modified = true + end + + def rename old, new + return unless @searches.has_key? old + search_string = @searches[old] + delete old if add new, search_string + end + + def edit name, search_string + return unless @searches.has_key? name + @searches[name] = search_string + @modified = true + end + + def delete name + return unless @searches.has_key? name + @searches.delete name + @modified = true + end + + def expand search_string + expanded = search_string.dup + until (matches = expanded.scan(/\{([\w-]+)\}/).flatten).empty? + if !(unknown = matches - @searches.keys).empty? + error_message = "Unknown \"#{unknown.join('", "')}\" when expanding \"#{search_string}\"" + elsif expanded.size >= 2048 + error_message = "Check for infinite recursion in \"#{search_string}\"" + end + if error_message + warn error_message + raise ExpansionError, error_message + end + matches.each { |n| expanded.gsub! "{#{n}}", "(#{@searches[n]})" if @searches.has_key? n } + end + return expanded + end + + def save + return unless @modified + File.open(@fn, "w") { |f| @searches.sort.each { |(n, s)| f.puts "#{n}: #{s}" } } + @modified = false + end +end + +end diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index 8f29faf..37f9b4a 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -162,6 +162,11 @@ EOS query = {} subs = HookManager.run("custom-search", :subs => s) || s + begin + subs = SearchManager.expand subs + rescue SearchManager::ExpansionError => e + raise ParseError, e.message + end subs = subs.gsub(/\b(to|from):(\S+)\b/) do field, value = $1, $2 email_field, name_field = %w(email name).map { |x| "#{field}_#{x}" } -- 1.6.6 From wmorgan-sup@masanjin.net Wed Jan 20 11:28:23 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Wed, 20 Jan 2010 11:28:23 -0500 Subject: [sup-devel] [PATCHv2] [issue44] cursor sticks to thread In-Reply-To: <1263328554-sup-8440@changeling.local> References: <1263328554-sup-8440@changeling.local> Message-ID: <1264004891-sup-9766@masanjin.net> Reformatted excerpts from Eric Sherman's message of 2010-01-12: > This is much more concise version, using set_cursor_pos instead of > cursor_up and cursor_down. Applied directly to master. Thanks! -- William From wmorgan-sup@masanjin.net Wed Jan 20 11:30:37 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Wed, 20 Jan 2010 11:30:37 -0500 Subject: [sup-devel] merged into master: ruby-1.9-encoding, insta-save, xapian-name-email Message-ID: <1264005023-sup-9722@masanjin.net> All merged in, to go out in 0.10. -- William From michael+sup@stapelberg.de Wed Jan 20 17:30:11 2010 From: michael+sup@stapelberg.de (Michael Stapelberg) Date: Wed, 20 Jan 2010 23:30:11 +0100 Subject: [sup-devel] [PATCH] Use multiple body arrays when calling before-edit for each reply type Message-ID: <1264026370-sup-8092@midna.zekjur.net> Hi, I created a hook which modified the body of each new message to look like my usual skeleton for mails (greeting, content, signature). I did not use the signature function for that because I wanted to put in the greeting with the correct recipient. Now I wanted to make this even more comfortable for me by checking if the recipient of my mail is speaking english and thus using the english signature instead of the german one. This was possible to a certain degree, but failed when I wanted to see if any of the CC'ed addresses matched a certain pattern. Attached to this mail you can find a patch which will copy the body object for each type of headers (sender, recipient, all, list) and use the right version of it in each case (like for the headers). I am not completely suure if the patch is 100% correct, so please review it thoroughly. It works for me, though. Best regards, Michael -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Use-multiple-body-arrays-when-calling-before-edit-fo.patch Type: application/octet-stream Size: 1777 bytes Desc: not available URL: From hyperbolist@gmail.com Wed Jan 20 23:15:16 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Wed, 20 Jan 2010 23:15:16 -0500 Subject: [sup-devel] [PATCH] flush index on idle Message-ID: <1264047274-sup-6830@changeling.local> This patch depends on [PATCHv2] idle and unidle updates. --- lib/sup/modes/inbox-mode.rb | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb index 1b8eaed..9e37909 100644 --- a/lib/sup/modes/inbox-mode.rb +++ b/lib/sup/modes/inbox-mode.rb @@ -115,6 +115,10 @@ class InboxMode < ThreadIndexMode regen_text end + def handle_idle_update sender, idle_since + flush_index + end + def status super + " #{Index.size} messages in index" end -- 1.6.6 From hyperbolist@gmail.com Thu Jan 21 10:36:28 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 21 Jan 2010 10:36:28 -0500 Subject: [sup-devel] [PATCH] show (recipients) instead of lone "me" Message-ID: <1264087996-sup-5125@changeling.local> I've changed thread-index-mode to show recipients in () parens instead of "me" in the From field for threads from me with no replies. I've developed the habit of archiving a new thread as soon as I send it, so until I receive a reply it's effectively non-existent. When checking on emails I may want to follow up on with a search like "is:sent AND after:(14 days ago) AND before:(3 days ago)" I would get a pile of lone "me"'s in the From field. I would then open each of them to decide whether or not to follow up based on who it was sent to. So this helps me cut down on the jx loops in that scenario. I'm not sure if this is something that is universally desirable, but here's the patch anyway. --- lib/sup/modes/thread-index-mode.rb | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a6bb2b9..0774aa8 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -793,6 +793,16 @@ protected result << [name, new[a]] end + if result.size == 1 && (author_and_newness = result.assoc("me")) + unless (recipients = t.participants - t.authors).empty? + result = recipients.collect do |r| + break if limit && result.size >= limit + name = (recipients.size == 1) ? r.mediumname : r.shortname + ["(#{name})", author_and_newness[1]] + end + end + end + result end -- 1.6.6 From tero@tilus.net Thu Jan 21 16:34:57 2010 From: tero@tilus.net (Tero Tilus) Date: Thu, 21 Jan 2010 23:34:57 +0200 Subject: [sup-devel] [PATCH] show (recipients) instead of lone "me" In-Reply-To: <1264087996-sup-5125@changeling.local> References: <1264087996-sup-5125@changeling.local> Message-ID: <1264109598-sup-3164@tilus.net> Eric Sherman, 2010-01-21 17:36: > I've changed thread-index-mode to show recipients in () parens > instead of "me" in the From field for threads from me with no > replies. +1 Patched my daily-sup right away. I'd like to see this in mainline. -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ From tero@tilus.net Thu Jan 21 18:51:05 2010 From: tero@tilus.net (Tero Tilus) Date: Fri, 22 Jan 2010 01:51:05 +0200 Subject: [sup-devel] [PATCH] Message#edit_labels [was: Ruby question: before-add-message.rb and adding multiple labels at once] In-Reply-To: <1263680819-sup-415@tilus.net> References: <1263574849-sup-3477@sam.mediasupervision.de> <1263680819-sup-415@tilus.net> Message-ID: <1264117436-sup-4429@tilus.net> Tero Tilus, 2010-01-17 00:41: > Gregor Hoffleit, 2010-01-15 19:01: >> May I request a new function "message.edit_labels" > > I'll be using that one too. Here's a patch. Did this get merged? I got no feedback. -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ From bwalton@artsci.utoronto.ca Thu Jan 21 18:56:18 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Thu, 21 Jan 2010 18:56:18 -0500 Subject: [sup-devel] [PATCH] show (recipients) instead of lone "me" In-Reply-To: <1264109598-sup-3164@tilus.net> References: <1264087996-sup-5125@changeling.local> <1264109598-sup-3164@tilus.net> Message-ID: <1264118145-sup-5806@ntdws12.chass.utoronto.ca> Excerpts from Tero Tilus's message of Thu Jan 21 16:34:57 -0500 2010: > Patched my daily-sup right away. I'd like to see this in mainline. I didn't get a chance today, but I'd also give this a +1. It makes a good deal of sense. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From tero@tilus.net Thu Jan 21 20:32:00 2010 From: tero@tilus.net (Tero Tilus) Date: Fri, 22 Jan 2010 03:32:00 +0200 Subject: [sup-devel] [PATCH] I can haz moar hooks: attachment-mentioned, index-mode-date-widget In-Reply-To: <1261402666-sup-8068@masanjin.net> References: <1261167840-sup-592@orion> <1261179239-sup-9258@tilus.net> <1261246334-sup-1438@masanjin.net> <1261276156-sup-5510@tilus.net> <1261402666-sup-8068@masanjin.net> Message-ID: <1264123657-sup-4929@tilus.net> William Morgan, 2009-12-21 15:38: > Reformatted excerpts from Tero Tilus's message of 2009-12-19: > > The detect-missing-attachment hook is pretty self evident but what you > > had in mind for the dates? Formatter for the thread-index-mode date > > widget maybe? > > Exactly. We already have index-mode-size-widget, so > index-mode-date-widget would be analogous. Here they are, finally... -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-index-mode-date-widget-hook-for-rendering-dates-in-t.patch Type: application/octet-stream Size: 4070 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mentions-attachments-hook-to-detect-missing-attachme.patch Type: application/octet-stream Size: 1269 bytes Desc: not available URL: From rlane@club.cc.cmu.edu Thu Jan 21 23:25:16 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Thu, 21 Jan 2010 20:25:16 -0800 Subject: [sup-devel] [PATCH] copy thread when spawning ThreadViewMode Message-ID: <1264134316-17210-1-git-send-email-rlane@club.cc.cmu.edu> Currently ThreadIndexMode just passes a reference to the selected thread when spawning a ThreadViewMode. This is a problem because as long as the original ThreadIndexMode is alive that thread will be updated with new messages, but ThreadViewMode will not display them. This can lead to the user unknowingly archiving a thread containing unread messages. --- lib/sup/modes/thread-index-mode.rb | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a6bb2b9..ca5e1f3 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -94,6 +94,18 @@ EOS load_threads :num => buffer.content_height end + def copy_thread t + ts = ThreadSet.new nil + t.each_with_index do |(m, *o), i| + next unless m + yield i + m.load_from_source! + ts.add_message m + end + fail unless ts.threads.size == 1 + ts.threads.first + end + ## open up a thread view window def select t=nil, when_done=nil t ||= cursor_thread or return @@ -102,10 +114,8 @@ EOS num = t.size message = "Loading #{num.pluralize 'message body'}..." BufferManager.say(message) do |sid| - t.each_with_index do |(m, *o), i| - next unless m + t = copy_thread t do |i| BufferManager.say "#{message} (#{i}/#{num})", sid if t.size > 1 - m.load_from_source! end end mode = ThreadViewMode.new t, @hidden_labels, self -- 1.6.3.3 From rlane@club.cc.cmu.edu Fri Jan 22 02:46:40 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Thu, 21 Jan 2010 23:46:40 -0800 Subject: [sup-devel] [PATCH] fix textfield truncation Message-ID: <1264146400-2101-1-git-send-email-rlane@club.cc.cmu.edu> Long query strings (for example) are (for some people) silently truncated. Other people have seen large amounts of whitespace inserted at word boundaries. These issues are caused by using a multiline text field. This patch uses a single-line dynamically growable textfield instead. It also disables the field-blanking misfeature. --- lib/sup/textfield.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb index 9afeb34..1c19751 100644 --- a/lib/sup/textfield.rb +++ b/lib/sup/textfield.rb @@ -33,7 +33,9 @@ class TextField @w, @y, @x, @width = window, y, x, width @question = question @completion_block = block - @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 256, 0 + @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 0, 0 + @field.opts_off Ncurses::Form::O_STATIC + @field.opts_off Ncurses::Form::O_BLANK @form = Ncurses::Form.new_form [@field] @value = default || '' Ncurses::Form.post_form @form -- 1.6.3.3 From hyperbolist@gmail.com Fri Jan 22 07:02:55 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Fri, 22 Jan 2010 07:02:55 -0500 Subject: [sup-devel] [PATCH] fix textfield truncation In-Reply-To: <1264146400-2101-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264146400-2101-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264161767-sup-920@changeling.local> This is awesome, thank you! Excerpts from Rich Lane's message of Fri Jan 22 02:46:40 -0500 2010: > Long query strings (for example) are (for some people) silently truncated. > Other people have seen large amounts of whitespace inserted at word boundaries. > These issues are caused by using a multiline text field. This patch uses a > single-line dynamically growable textfield instead. It also disables the > field-blanking misfeature. > --- > lib/sup/textfield.rb | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb > index 9afeb34..1c19751 100644 > --- a/lib/sup/textfield.rb > +++ b/lib/sup/textfield.rb > @@ -33,7 +33,9 @@ class TextField > @w, @y, @x, @width = window, y, x, width > @question = question > @completion_block = block > - @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 256, 0 > + @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 0, 0 > + @field.opts_off Ncurses::Form::O_STATIC > + @field.opts_off Ncurses::Form::O_BLANK > @form = Ncurses::Form.new_form [@field] > @value = default || '' > Ncurses::Form.post_form @form From hyperbolist@gmail.com Fri Jan 22 15:13:01 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Fri, 22 Jan 2010 15:13:01 -0500 Subject: [sup-devel] [PATCHv2] idle and unidle updates In-Reply-To: <1263483819-sup-9886@changeling.local> References: <1263483819-sup-9886@changeling.local> Message-ID: <1264190784-sup-222@changeling.local> This is a problematic place for this logic to go, since it appears as if the idle update does not fire when shelled to the editor, and instead fires immediately upon returning. Which ironically is exactly when you're becoming unidle. I'm thinking of an IdleManager with a single public method #ping that can be called here where no_keystrokes_since is being updated. It has a thread that does the threshold checking and relays the updates. This way it's not in the main thread and doesn't block when shelled. Thoughts? Excerpts from Eric Sherman's message of Thu Jan 14 10:45:54 -0500 2010: > --- > bin/sup | 17 +++++++++++++++++ > 1 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/bin/sup b/bin/sup > index 19b2a87..0d90d00 100755 > --- a/bin/sup > +++ b/bin/sup > @@ -260,6 +260,10 @@ begin > SearchResultsMode.spawn_from_query $opts[:search] > end > > + IDLE_THRESHOLD = 60 > + no_keystrokes_since = Time.now > + idle = false > + > until Redwood::exceptions.nonempty? || $die > c = begin > Ncurses.nonblocking_getch > @@ -274,9 +278,22 @@ begin > debug "redrawing screen on sigwinch" > BufferManager.completely_redraw_screen > end > + > + if !idle and Time.now.to_i - no_keystrokes_since.to_i >= IDLE_THRESHOLD > + UpdateManager.relay self, :idle, Time.at(no_keystrokes_since) > + idle = true > + end > + > next > end > > + if idle > + UpdateManager.relay self, :unidle, Time.at(no_keystrokes_since) > + idle = false > + end > + > + no_keystrokes_since = Time.now > + > if c == 410 > ## this is ncurses's way of telling us it's detected a refresh. > ## since we have our own sigwinch handler, we don't do anything. From rlane@club.cc.cmu.edu Fri Jan 22 18:47:14 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Fri, 22 Jan 2010 18:47:14 -0500 Subject: [sup-devel] [PATCH] configurable color highlights Message-ID: <1264204034-7088-1-git-send-email-rlane@club.cc.cmu.edu> Adds a :highlight key to the color entries in colors.yaml that names another color to be used for highlighting. --- lib/sup/colormap.rb | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index 6f21f9a..aeb3818 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -77,19 +77,26 @@ class Colormap def reset @entries = {} + @highlights = { :none => highlight_sym(:none)} @entries[highlight_sym(:none)] = highlight_for(Curses::COLOR_WHITE, Curses::COLOR_BLACK, []) + [nil] end - def add sym, fg, bg, attr=nil, opts={} + def add sym, fg, bg, attr=nil, highlight=nil raise ArgumentError, "color for #{sym} already defined" if @entries.member? sym raise ArgumentError, "color '#{fg}' unknown" unless (-1...Curses::NUM_COLORS).include? fg raise ArgumentError, "color '#{bg}' unknown" unless (-1...Curses::NUM_COLORS).include? bg attrs = [attr].flatten.compact @entries[sym] = [fg, bg, attrs, nil] - @entries[highlight_sym(sym)] = opts[:highlight] ? @entries[opts[:highlight]] : highlight_for(fg, bg, attrs) + [nil] + + if not highlight + highlight = highlight_sym(sym) + @entries[highlight] = highlight_for(fg, bg, attrs) + [nil] + end + + @highlights[sym] = highlight end def highlight_sym sym @@ -132,7 +139,7 @@ class Colormap end def color_for sym, highlight=false - sym = highlight_sym(sym) if highlight + sym = @highlights[sym] if highlight return Curses::COLOR_BLACK if sym == :none raise ArgumentError, "undefined color #{sym}" unless @entries.member? sym @@ -213,8 +220,11 @@ class Colormap end end + highlight = ucolor[:highlight] || v[:highlight] + highlight_symbol = highlight ? :"#{highlight}_color" : nil + symbol = (k.to_s + "_color").to_sym - add symbol, fg, bg, attrs + add symbol, fg, bg, attrs, highlight_symbol end warn error if error -- 1.5.6.5 From hyperbolist@gmail.com Sat Jan 23 00:42:56 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Sat, 23 Jan 2010 00:42:56 -0500 Subject: [sup-devel] [PATCHv3] idle and unidle updates Message-ID: <1264225074-sup-7366@changeling.local> Now handled outside of the main thread to accommodate shelling out to the editor. [PATCH] flush index on idle and [PATCHv5] [issue14] poll updates accumulate while idle will still work with this patch. --- bin/sup | 4 ++++ lib/sup.rb | 2 ++ lib/sup/idle.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 0 deletions(-) create mode 100644 lib/sup/idle.rb diff --git a/bin/sup b/bin/sup index 8bf640b..a5d48f6 100755 --- a/bin/sup +++ b/bin/sup @@ -239,6 +239,7 @@ begin unless $opts[:no_threads] PollManager.start + IdleManager.start Index.start_lock_update_thread end @@ -263,6 +264,8 @@ begin next end + IdleManager.ping + if c == 410 ## this is ncurses's way of telling us it's detected a refresh. ## since we have our own sigwinch handler, we don't do anything. @@ -366,6 +369,7 @@ rescue Exception => e ensure unless $opts[:no_threads] PollManager.stop if PollManager.instantiated? + IdleManager.stop if IdleManager.instantiated? Index.stop_lock_update_thread end diff --git a/lib/sup.rb b/lib/sup.rb index e03a35d..2fbaa02 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -131,6 +131,7 @@ module Redwood Redwood::CryptoManager.init Redwood::UndoManager.init Redwood::SourceManager.init + Redwood::IdleManager.init end def finish @@ -341,6 +342,7 @@ require "sup/modes/file-browser-mode" require "sup/modes/completion-mode" require "sup/modes/console-mode" require "sup/sent" +require "sup/idle" $:.each do |base| d = File.join base, "sup/share/modes/" diff --git a/lib/sup/idle.rb b/lib/sup/idle.rb new file mode 100644 index 0000000..a3a272f --- /dev/null +++ b/lib/sup/idle.rb @@ -0,0 +1,42 @@ +require 'thread' + +module Redwood + +class IdleManager + include Singleton + + IDLE_THRESHOLD = 60 + + def initialize + @no_activity_since = Time.now + @idle = false + @thread = nil + end + + def ping + if @idle + UpdateManager.relay self, :unidle, Time.at(@no_activity_since) + @idle = false + end + @no_activity_since = Time.now + end + + def start + @thread = Redwood::reporting_thread("checking for idleness") do + while true + sleep 1 + if !@idle and Time.now.to_i - @no_activity_since.to_i >= IDLE_THRESHOLD + UpdateManager.relay self, :idle, Time.at(@no_activity_since) + @idle = true + end + end + end + end + + def stop + @thread.kill if @thread + @thread = nil + end +end + +end -- 1.6.6 From wmorgan-sup@masanjin.net Sat Jan 23 07:41:53 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 07:41:53 -0500 Subject: [sup-devel] [PATCH] fix ask_for_contacts on Ruby 1.9 In-Reply-To: <1263406420-27036-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263406420-27036-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264250463-sup-3881@masanjin.net> Applied to master and will go out in 0.10. Thanks! -- William From wmorgan-sup@masanjin.net Sat Jan 23 07:43:18 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 07:43:18 -0500 Subject: [sup-devel] [PATCH] xapian: add boolean terms with zero wdf In-Reply-To: <1263532469-30760-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263532469-30760-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264250590-sup-8757@masanjin.net> Applied to master and will go out in 0.10. Thanks! -- William From wmorgan-sup@masanjin.net Sat Jan 23 07:44:39 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 07:44:39 -0500 Subject: [sup-devel] [PATCH] utf-8 script encoding In-Reply-To: <1262535218-sup-9718@dolk> References: <1262533823-sup-5348@dolk> <1262534836-29113-1-git-send-email-rlane@club.cc.cmu.edu> <1262535218-sup-9718@dolk> Message-ID: <1264250655-sup-3062@masanjin.net> Reformatted excerpts from Gaute Hope's message of 2010-01-03: > No. Tab completion fails, and sending fails, I can add names with > UTF-8 chars to the recipient list, but it fails with the last attached > exception. This is the same behaviour as earlier. That's weird, I would've expected this to help. What's the alternative, adding "u" to the end of every regexp? -- William From wmorgan-sup@masanjin.net Sat Jan 23 07:49:45 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 07:49:45 -0500 Subject: [sup-devel] [PATCH 1/4] dont index redundant data In-Reply-To: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264250978-sup-9237@masanjin.net> Branch xapian-updates, merged into next. -- William From wmorgan-sup@masanjin.net Sat Jan 23 07:55:58 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 07:55:58 -0500 Subject: [sup-devel] [PATCH] asciify untrusted strings before displaying in TextMode In-Reply-To: <1263937705-10875-1-git-send-email-rlane@club.cc.cmu.edu> References: <1263937705-10875-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264251348-sup-4751@masanjin.net> Applied to master and will go out in 0.10. Thanks! -- William From wmorgan-sup@masanjin.net Sat Jan 23 08:01:33 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 08:01:33 -0500 Subject: [sup-devel] [PATCHv3] Saved Search Support In-Reply-To: <1263997604-sup-9969@changeling.local> References: <1263858172-sup-547@changeling.local> <1263920054-sup-9400@zyrg.net> <1263959248-sup-4163@changeling.local> <1263960767-sup-4706@zyrg.net> <1263997604-sup-9969@changeling.local> Message-ID: <1264251672-sup-7773@masanjin.net> Very nice. Was just longing for this functionality. Branch saved-search, merged into next. Thanks! -- William From wmorgan-sup@masanjin.net Sat Jan 23 08:11:33 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sat, 23 Jan 2010 08:11:33 -0500 Subject: [sup-devel] [PATCH] Message#edit_labels [was: Ruby question: before-add-message.rb and adding multiple labels at once] In-Reply-To: <1264117436-sup-4429@tilus.net> References: <1263574849-sup-3477@sam.mediasupervision.de> <1263680819-sup-415@tilus.net> <1264117436-sup-4429@tilus.net> Message-ID: <1264252198-sup-6507@masanjin.net> Reformatted excerpts from Tero Tilus's message of 2010-01-21: > Did this get merged? I got no feedback. Sorry about that. This is very similar to the code in ThreadViewMode#multi_edit_labels, so I would prefer a solution that shared a codepath. It's also important to call LabelManager.<< for each label, to make sure they appear in label-list-mode. -- William From rlane@club.cc.cmu.edu Sat Jan 23 22:16:00 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 23 Jan 2010 19:16:00 -0800 Subject: [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable Message-ID: <1264302960-17337-1-git-send-email-rlane@club.cc.cmu.edu> If SUP_PROFILE is set, it's used as the filename to dump profiling output which you can use kcachegrind to inspect. --- bin/sup | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/bin/sup b/bin/sup index 7824aca..f7c4af7 100755 --- a/bin/sup +++ b/bin/sup @@ -14,6 +14,11 @@ require 'fileutils' require 'trollop' require "sup"; Redwood::check_library_version_against "git" +if ENV['SUP_PROFILE'] + require 'ruby-prof' + RubyProf.start +end + if no_ncursesw debug "No 'ncursesw' gem detected. Install it for wide character support." end @@ -379,6 +384,11 @@ ensure end Index.unlock + + if (fn = ENV['SUP_PROFILE']) + result = RubyProf.stop + File.open(fn, 'w') { |io| RubyProf::CallTreePrinter.new(result).print(io) } + end end unless Redwood::exceptions.empty? -- 1.6.3.3 From rlane@club.cc.cmu.edu Sat Jan 23 22:17:17 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 23 Jan 2010 19:17:17 -0800 Subject: [sup-devel] [PATCH] dont check thread-index-mode dirtiness on every keypress Message-ID: <1264303037-17440-1-git-send-email-rlane@club.cc.cmu.edu> Now that changes are instantly written to the index it's unnecessary to put the "modified" message in the status line. Removing this cuts the time for a simple action like moving the cursor by 75% or more, depending on the number of messages loaded. --- lib/sup/modes/thread-index-mode.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a6bb2b9..71c8f44 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -651,7 +651,7 @@ EOS if (l = lines) == 0 "line 0 of 0" else - "line #{curpos + 1} of #{l} #{dirty? ? '*modified*' : ''}" + "line #{curpos + 1} of #{l}" end end -- 1.6.3.3 From pi+sup@pihost.us Sat Jan 23 22:22:37 2010 From: pi+sup@pihost.us (Anthony Martinez) Date: Sat, 23 Jan 2010 20:22:37 -0700 Subject: [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable In-Reply-To: <1264302960-17337-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264302960-17337-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264303219-sup-9847@home.mrtheplague.net> Excerpts from Rich Lane's message of Sat Jan 23 20:16:00 -0700 2010: > If SUP_PROFILE is set, it's used as the filename to dump profiling output > which you can use kcachegrind to inspect. Excellent. I could use this to track down why it's taking forever to load a 20,000 line message :) -- If Java had true garbage collection, most programs would delete themselves upon execution. -- Robert Sewell From wmorgan-sup@masanjin.net Sun Jan 24 09:44:50 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 24 Jan 2010 09:44:50 -0500 Subject: [sup-devel] [ANN] Sup 0.10 released Message-ID: <1264344055-sup-3295@masanjin.net> I'm pleased to announce the release of Sup 0.10. This version is frickin' awesome because not only do we have Ruby 1.9 support, the Xapian backend is now the default! The next version will discard Ferret like a used rag. Sup is a console-based email client for people with a lot of email. It supports tagging, very fast full-text search, automatic contact- list management, and more. If you're the type of person who treats email as an extension of your long-term memory, Sup is for you. Get it: gem install sup Learn it: http://sup.rubyforge.org Love it: sup-talk at rubyforge.org Release notes: The Xapian backend is now the default. Convert your old, crash-prone Ferret index to Xapian by running sup-convert-ferret-index. Using a Ferret backend will produce a deprecation notice, and will not be supported in 0.11. Many thanks to Rich Lane for Xapian and Ruby 1.9 work. Excitement in 0.10: * Make Xapian backend the default, and add deprecation notice to Ferret indexes. * Now Ruby 1.9 compatible (Xapian backend only). * Changes are now saved automatically to the index. Pressing "$" now just forces a flush of Xapian indexes, which can minimize quit time. * Fix problem with replying to Google Groups messages. * Allow toggling of line wrap. Useful for long URLs. * Multiple attachments can be added at once by specifying a wildcard. * New command to save all attachments at once. * As always, many bugfixes and tweaks. -- William From sup-bugs@masanjin.net Sun Jan 24 12:07:08 2010 From: sup-bugs@masanjin.net (anonymous) Date: Sun, 24 Jan 2010 17:07:08 +0000 Subject: [sup-devel] [issue47] utf-8 regression: search&inbox views has garbled utf-8 In-Reply-To: <1264352828.18.0.950975059303.issue47@masanjin.net> Message-ID: <1264352828.18.0.950975059303.issue47@masanjin.net> New submission from anonymous: Hi! I upgraded to 0.10 by doing git pull && git checkout origin/release-0.10. After a friendly nag about upgrading to Xapian, sup started nicely. But: In all search-results and in the inbox, any non-ascii utf-8 characters are displayed in a garbled format, for example: "Autos?k" becomes "Autos\xc3\xb8k". Searching for "autos?k" works as expected, and what's even stranger is that after viewing one of these threads, and then going back to the search buffer, it will show the utf-8 correctly for that single thread. Something is not quite right here... ---------- messages: 112 nosy: anonymous priority: bug ruby_version: 1.8.7 status: unread sup_version: 0.10 title: utf-8 regression: search&inbox views has garbled utf-8 _________________________________________ Sup issue tracker _________________________________________ From rlane@club.cc.cmu.edu Sun Jan 24 14:37:00 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 24 Jan 2010 11:37:00 -0800 Subject: [sup-devel] [PATCH] dont restrict colors to those in Colormap::DEFAULT_COLORS In-Reply-To: <1264204034-7088-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264204034-7088-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264361820-4176-1-git-send-email-rlane@club.cc.cmu.edu> This is necessary for user-created highlight colors. A side effect is that invalid color names now default to ugly red/green instead of what was in DEFAULT_COLORS, which seems more useful for debugging colormap problems. Also remove the redundant warnings. --- lib/sup/colormap.rb | 58 ++++++++++++++++++-------------------------------- 1 files changed, 21 insertions(+), 37 deletions(-) diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index aeb3818..7de48db 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -183,51 +183,35 @@ class Colormap Redwood::load_yaml_obj Redwood::COLOR_FN end - error = nil - Colormap::DEFAULT_COLORS.each_pair do |k, v| - fg = Curses.const_get "COLOR_#{v[:fg].upcase}" - bg = Curses.const_get "COLOR_#{v[:bg].upcase}" - attrs = v[:attrs] ? v[:attrs].map { |a| Curses.const_get "A_#{a.upcase}" } : [] - - if user_colors && (ucolor = user_colors[k]) - if(ufg = ucolor[:fg]) - begin - fg = Curses.const_get "COLOR_#{ufg.to_s.upcase}" - rescue NameError - error ||= "Warning: there is no color named \"#{ufg}\", using fallback." - warn "there is no color named \"#{ufg}\"" - end - end + Colormap::DEFAULT_COLORS.merge(user_colors||{}).each_pair do |k, v| + fg = begin + Curses.const_get "COLOR_#{v[:fg].to_s.upcase}" + rescue NameError + warn "there is no color named \"#{v[:fg]}\"" + Curses::COLOR_GREEN + end - if(ubg = ucolor[:bg]) - begin - bg = Curses.const_get "COLOR_#{ubg.to_s.upcase}" - rescue NameError - error ||= "Warning: there is no color named \"#{ubg}\", using fallback." - warn "there is no color named \"#{ubg}\"" - end - end + bg = begin + Curses.const_get "COLOR_#{v[:bg].to_s.upcase}" + rescue NameError + warn "there is no color named \"#{v[:bg]}\"" + Curses::COLOR_RED + end - if(uattrs = ucolor[:attrs]) - attrs = [*uattrs].flatten.map do |a| - begin - Curses.const_get "A_#{a.upcase}" - rescue NameError - error ||= "Warning: there is no attribute named \"#{a}\", using fallback." - warn "there is no attribute named \"#{a}\", using fallback." - end - end + attrs = (v[:attrs]||[]).map do |a| + begin + Curses.const_get "A_#{a.upcase}" + rescue NameError + warn "there is no attribute named \"#{a}\", using fallback." + nil end - end + end.compact - highlight = ucolor[:highlight] || v[:highlight] - highlight_symbol = highlight ? :"#{highlight}_color" : nil + highlight_symbol = v[:highlight] ? :"#{v[:highlight]}_color" : nil symbol = (k.to_s + "_color").to_sym add symbol, fg, bg, attrs, highlight_symbol end - - warn error if error end def self.instance; @@instance; end -- 1.6.3.3 From sup-bugs@masanjin.net Sun Jan 24 17:30:40 2010 From: sup-bugs@masanjin.net (anonymous) Date: Sun, 24 Jan 2010 22:30:40 +0000 Subject: [sup-devel] [issue48] Exception: calling id on nil during startup In-Reply-To: <1264372240.82.0.635804068553.issue48@masanjin.net> Message-ID: <1264372240.82.0.635804068553.issue48@masanjin.net> New submission from anonymous: Appearently, t.first is nil in the given line in thread-index-mode.rb. Interestingly, t.empty? is not true. --- RuntimeError from thread: load threads for thread-index-mode wrong id called on nil /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup.rb:17:in `id' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:226:in `block (2 levels) in update' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:226:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:226:in `sort_by' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:226:in `block in update' :8:in `synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:224:in `update' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:642:in `load_n_threads' (eval):12:in `load_n_threads' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup/modes/thread-index-mode.rb:614:in `block in load_n_threads_background' /usr/local/lib/ruby/gems/1.9.1/gems/sup-0.10.1/lib/sup.rb:77:in `block in reporting_thread' ---------- messages: 114 nosy: anonymous priority: bug ruby_version: 1.9.1 status: unread sup_version: 0.10.1 title: Exception: calling id on nil during startup _________________________________________ Sup issue tracker _________________________________________ From tero@tilus.net Sun Jan 24 21:05:30 2010 From: tero@tilus.net (Tero Tilus) Date: Mon, 25 Jan 2010 04:05:30 +0200 Subject: [sup-devel] [PATCH] Message#edit_labels [was: Ruby question: before-add-message.rb and adding multiple labels at once] In-Reply-To: <1264252198-sup-6507@masanjin.net> References: <1263574849-sup-3477@sam.mediasupervision.de> <1263680819-sup-415@tilus.net> <1264117436-sup-4429@tilus.net> <1264252198-sup-6507@masanjin.net> Message-ID: <1264384775-sup-925@tilus.net> William Morgan, 2010-01-23 15:11: > This is very similar to ThreadViewMode#multi_edit_labels, so I would > prefer a solution that shared a codepath. Similar indeed. Factored out. > It's also important to call LabelManager.<< for each label, to make > sure they appear in label-list-mode. I went a step further with this. Counting on people not having billion-mail threads and gazillions of tags (and thus this potentially having performance implications) I dropped all the LabelManager.<< calls to Message to ensure that every time labels change, LabelManager is informed. Patch v2 attached. -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Message-edit_labels.patch Type: application/octet-stream Size: 7279 bytes Desc: not available URL: From rlane@club.cc.cmu.edu Sun Jan 24 22:09:31 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 24 Jan 2010 19:09:31 -0800 Subject: [sup-devel] [PATCH 1/3] make mode keymap easily accessible to hooks Message-ID: <1264388973-5804-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/mode.rb | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/sup/mode.rb b/lib/sup/mode.rb index c8ad0cc..b9e0698 100644 --- a/lib/sup/mode.rb +++ b/lib/sup/mode.rb @@ -10,6 +10,10 @@ class Mode @@keymaps[self] = keymap end + def self.keymap + @@keymaps[self] || register_keymap + end + def initialize @buffer = nil end -- 1.6.3.3 From rlane@club.cc.cmu.edu Sun Jan 24 22:09:32 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 24 Jan 2010 19:09:32 -0800 Subject: [sup-devel] [PATCH 2/3] add keymap rebinding support In-Reply-To: <1264388973-5804-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264388973-5804-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264388973-5804-2-git-send-email-rlane@club.cc.cmu.edu> Keymap#delete removes an existing keybinding and Keymap#add! deletes existing bindings to the given keys before adding new ones. Keymap#add_multi now allows adding new bindings to an existing submap. --- lib/sup/keymap.rb | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/sup/keymap.rb b/lib/sup/keymap.rb index cb039e4..4cdeeed 100644 --- a/lib/sup/keymap.rb +++ b/lib/sup/keymap.rb @@ -60,10 +60,31 @@ class Keymap end end + def delete k + kc = Keymap.keysym_to_keycode(k) + return unless @map.member? kc + entry = @map.delete kc + keys = entry[2] + keys.delete k + @order.delete entry if keys.empty? + end + + def add! action, help, *keys + keys.each { |k| delete k } + add action, help, *keys + end + def add_multi prompt, key - submap = Keymap.new - add submap, prompt, key - yield submap + kc = Keymap.keysym_to_keycode(key) + if @map.member? kc + action = @map[kc].first + raise "existing action is not a keymap" unless action.is_a?(Keymap) + yield action + else + submap = Keymap.new + add submap, prompt, key + yield submap + end end def action_for kc -- 1.6.3.3 From rlane@club.cc.cmu.edu Sun Jan 24 22:09:33 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 24 Jan 2010 19:09:33 -0800 Subject: [sup-devel] [PATCH 3/3] keybindings hook In-Reply-To: <1264388973-5804-2-git-send-email-rlane@club.cc.cmu.edu> References: <1264388973-5804-1-git-send-email-rlane@club.cc.cmu.edu> <1264388973-5804-2-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264388973-5804-3-git-send-email-rlane@club.cc.cmu.edu> Add a hook specifically for custom keybindings. The advantage of this over the startup hook is that we can assume it's safe to reload this one while Sup is running. The "modes" variable provides a debatably-useful mapping between user-visible mode names and the actual classes, for use with class_eval. --- bin/sup | 9 +++++++++ lib/sup/hook.rb | 1 + lib/sup/keymap.rb | 17 +++++++++++++++++ lib/sup/mode.rb | 4 ++++ 4 files changed, 31 insertions(+), 0 deletions(-) diff --git a/bin/sup b/bin/sup index 7824aca..ad1271f 100755 --- a/bin/sup +++ b/bin/sup @@ -83,8 +83,13 @@ global_keymap = Keymap.new do |k| k.add :recall_draft, "Edit most recent draft message", 'R' k.add :show_inbox, "Show the Inbox buffer", 'I' k.add :show_console, "Show the Console buffer", '~' + k.add_multi "Rerun (k)eybindings hook:", 'O' do |kk| + kk.add :run_keybindings_hook, "Rerun keybindings hook", 'k' + end end +Redwood::Keymap.run_hook global_keymap + ## the following magic enables wide characters when used with a ruby ## ncurses.so that's been compiled against libncursesw. (note the w.) why ## this works, i have no idea. much like pretty much every aspect of @@ -339,6 +344,10 @@ begin when :show_console b, new = bm.spawn_unless_exists("Console", :system => true) { ConsoleMode.new } b.mode.run + when :run_keybindings_hook + HookManager.clear_one 'keybindings' + Keymap.run_hook global_keymap + bm.flash "keybindings hook run" when :nothing, InputSequenceAborted when :redraw bm.completely_redraw_screen diff --git a/lib/sup/hook.rb b/lib/sup/hook.rb index 3bf9823..08738cd 100644 --- a/lib/sup/hook.rb +++ b/lib/sup/hook.rb @@ -113,6 +113,7 @@ EOS def enabled? name; !hook_for(name).nil? end def clear; @hooks.clear; end + def clear_one k; @hooks.delete k; end private diff --git a/lib/sup/keymap.rb b/lib/sup/keymap.rb index 4cdeeed..93060b8 100644 --- a/lib/sup/keymap.rb +++ b/lib/sup/keymap.rb @@ -1,6 +1,14 @@ module Redwood class Keymap + + HookManager.register "keybindings", < modes, + :global_keymap => global_keymap, + } + HookManager.run 'keybindings', locals + end end end diff --git a/lib/sup/mode.rb b/lib/sup/mode.rb index b9e0698..f5aee1c 100644 --- a/lib/sup/mode.rb +++ b/lib/sup/mode.rb @@ -14,6 +14,10 @@ class Mode @@keymaps[self] || register_keymap end + def self.keymaps + @@keymaps + end + def initialize @buffer = nil end -- 1.6.3.3 From sup-bugs@masanjin.net Mon Jan 25 08:41:29 2010 From: sup-bugs@masanjin.net (anonymous) Date: Mon, 25 Jan 2010 13:41:29 +0000 Subject: [sup-devel] [issue49] crash when pressing 'c' to compose In-Reply-To: <1264426888.82.0.129719799236.issue49@masanjin.net> Message-ID: <1264426888.82.0.129719799236.issue49@masanjin.net> New submission from anonymous: --- RuntimeError from thread: main Invalid email term type any ./sup/xapian_index.rb:573:in `mkterm' ./sup/xapian_index.rb:410:in `build_xapian_query' ./sup/xapian_index.rb:410:in `map' ./sup/xapian_index.rb:410:in `build_xapian_query' ./sup/xapian_index.rb:114:in `each_id' ./sup/xapian_index.rb:124:in `each_id_by_date' ./sup/xapian_index.rb:155:in `load_contacts' ./sup/index.rb:236:in `send' ./sup/index.rb:236:in `method_missing' ./sup/buffer.rb:543:in `ask_for_contacts' ./sup/util.rb:553:in `send' ./sup/util.rb:553:in `method_missing' ./sup/modes/compose-mode.rb:24:in `spawn_nicely' ../bin/sup:327 ---------- messages: 118 nosy: anonymous priority: bug ruby_version: 1.8.5 status: unread sup_version: next/a3c2f5a0a title: crash when pressing 'c' to compose _________________________________________ Sup issue tracker _________________________________________ From isra@herraiz.org Mon Jan 25 08:53:12 2010 From: isra@herraiz.org (Israel Herraiz) Date: Mon, 25 Jan 2010 14:53:12 +0100 Subject: [sup-devel] Exception when composing messages Message-ID: <1264427161-sup-6711@duck> Hi all, I am using the next branch of Sup, and since a couple of commits ago, whenever I try to compose a message (new, forward, etc), I obtain this exception: --- RuntimeError from thread: main Invalid email term type any ./lib/sup/xapian_index.rb:573:in `mkterm' ./lib/sup/xapian_index.rb:410:in `build_xapian_query' ./lib/sup/xapian_index.rb:410:in `map' ./lib/sup/xapian_index.rb:410:in `build_xapian_query' ./lib/sup/xapian_index.rb:114:in `each_id' ./lib/sup/xapian_index.rb:124:in `each_id_by_date' ./lib/sup/xapian_index.rb:155:in `load_contacts' ./lib/sup/index.rb:236:in `send' ./lib/sup/index.rb:236:in `method_missing' ./lib/sup/buffer.rb:543:in `ask_for_contacts' ./lib/sup/util.rb:553:in `send' ./lib/sup/util.rb:553:in `method_missing' ./lib/sup/modes/compose-mode.rb:24:in `spawn_nicely' bin/sup:327 The problem seems to be between lines 410 and 573 of lib/sup/xapian_index.rb Some time ago, around line 573, there was the following line in the file: when :any then PREFIX['email'] Adding that to the current version of file does not solve the problem though. I obtain another exception telling that it cannot convert from String to Array. If I change line 410 to the following (undoing my previous change), it works again: participant_terms = opts[:participants].map { |p| mkterm(:email,:to, (Redwood::Person === p) ? p.email : p) } Notice that I have just substituted :any by :to. I have to admit that I am not really aware of what that change implies. I have tried to find the commit that changed the behavior, without success. But in any case I think this is a bug :-). Cheers, Israel From isra@herraiz.org Mon Jan 25 08:57:07 2010 From: isra@herraiz.org (Israel Herraiz) Date: Mon, 25 Jan 2010 14:57:07 +0100 Subject: [sup-devel] Exception when composing messages In-Reply-To: <1264427161-sup-6711@duck> References: <1264427161-sup-6711@duck> Message-ID: <1264427765-sup-5441@duck> It seems that someone (not me :-) opened an issue about this some minutes before my message: http://masanjin.net/sup-bugs/issue49 Cheers, Israel From bwalton@artsci.utoronto.ca Mon Jan 25 09:22:49 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Mon, 25 Jan 2010 09:22:49 -0500 Subject: [sup-devel] [issue49] crash when pressing 'c' to compose In-Reply-To: <1264426888.82.0.129719799236.issue49@masanjin.net> References: <1264426888.82.0.129719799236.issue49@masanjin.net> Message-ID: <1264429332-sup-9299@ntdws12.chass.utoronto.ca> Excerpts from anonymous's message of Mon Jan 25 08:41:29 -0500 2010: This was me... Patch attached. > --- RuntimeError from thread: main > Invalid email term type any > ./sup/xapian_index.rb:573:in `mkterm' > ./sup/xapian_index.rb:410:in `build_xapian_query' > ./sup/xapian_index.rb:410:in `map' > ./sup/xapian_index.rb:410:in `build_xapian_query' > ./sup/xapian_index.rb:114:in `each_id' > ./sup/xapian_index.rb:124:in `each_id_by_date' > ./sup/xapian_index.rb:155:in `load_contacts' > ./sup/index.rb:236:in `send' > ./sup/index.rb:236:in `method_missing' > ./sup/buffer.rb:543:in `ask_for_contacts' > ./sup/util.rb:553:in `send' > ./sup/util.rb:553:in `method_missing' > ./sup/modes/compose-mode.rb:24:in `spawn_nicely' > ../bin/sup:327 HTH. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Fix-crash-in-mkterm-when-parameter-any-is-used-with-.patch Type: application/octet-stream Size: 1083 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From bwalton@artsci.utoronto.ca Mon Jan 25 09:29:05 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Mon, 25 Jan 2010 09:29:05 -0500 Subject: [sup-devel] [issue49] crash when pressing 'c' to compose In-Reply-To: <1264429332-sup-9299@ntdws12.chass.utoronto.ca> References: <1264426888.82.0.129719799236.issue49@masanjin.net> <1264429332-sup-9299@ntdws12.chass.utoronto.ca> Message-ID: <1264429693-sup-5640@ntdws12.chass.utoronto.ca> Excerpts from Ben Walton's message of Mon Jan 25 09:22:49 -0500 2010: > Patch attached. BTW, the xapian index version bump (v1 -> v2) meant I couldn't (easily) bisect this problem. Luckily it wasn't too tough to track down from the back trace. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From rlane@club.cc.cmu.edu Mon Jan 25 11:03:35 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 25 Jan 2010 08:03:35 -0800 Subject: [sup-devel] [PATCH] fix participants queries In-Reply-To: <1264429332-sup-9299@ntdws12.chass.utoronto.ca> References: <1264429332-sup-9299@ntdws12.chass.utoronto.ca> Message-ID: <1264435415-11782-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/xapian_index.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index 5efd47b..443b88d 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -407,7 +407,7 @@ EOS pos_terms << mkterm(:source_id, opts[:source_id]) if opts[:source_id] if opts[:participants] - participant_terms = opts[:participants].map { |p| mkterm(:email,:any, (Redwood::Person === p) ? p.email : p) } + participant_terms = opts[:participants].map { |p| [:from,:to].map { |d| mkterm(:email, d, (Redwood::Person === p) ? p.email : p) } }.flatten pos_terms << Q.new(Q::OP_OR, participant_terms) end -- 1.6.3.3 From sup-bugs@masanjin.net Mon Jan 25 11:18:41 2010 From: sup-bugs@masanjin.net (Scott Henson) Date: Mon, 25 Jan 2010 16:18:41 +0000 Subject: [sup-devel] [issue50] 0.10 error in ask_yes_or_no In-Reply-To: <1264436321.23.0.59454690461.issue50@masanjin.net> Message-ID: <1264436321.23.0.59454690461.issue50@masanjin.net> New submission from Scott Henson : [Mon Jan 25 11:06:26 -0500 2010] ERROR: oh crap, an exception ---------------------------------------------------------------- I'm very sorry. It seems that an error occurred in Sup. Please accept my sincere apologies. Please submit the contents of /home/shenson/.sup/exception-log.txt and a brief report of the circumstances to http://masanjin.net/sup-bugs/ so that I might address this problem. Thank you! Sincerely, William ---------------------------------------------------------------- --- NoMethodError from thread: main undefined method `ord' for 121:Fixnum /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/buffer.rb:648:in `ask_yes_or_no' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/util.rb:553:in `send' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/util.rb:553:in `method_missing' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/modes/thread-view-mode.rb:232:in `bounce' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/mode.rb:51:in `send' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/mode.rb:51:in `handle_input' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/lib/sup/buffer.rb:270:in `handle_input' /usr/lib/ruby/gems/1.8/gems/sup-0.10.1/bin/sup:270 /usr/bin/sup:19:in `load' /usr/bin/sup:19 shenson at junkyard ~$ cat /etc/redhat-release Fedora release 12 (Constantine) shenson at junkyard ~$ ruby --version ruby 1.8.6 (2009-08-04 patchlevel 383) [x86_64-linux] I was bouncing a message to another address and it caused the above error after I hit 'y'. ---------- messages: 120 nosy: shenson priority: bug ruby_version: ruby 1.8.6 (2009-08-04 patchlevel 383) [x86_64-linux] status: unread sup_version: 0.10 title: 0.10 error in ask_yes_or_no _________________________________________ Sup issue tracker _________________________________________ From rlane@club.cc.cmu.edu Mon Jan 25 11:21:41 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 25 Jan 2010 11:21:41 -0500 Subject: [sup-devel] [PATCH] copy thread when spawning ThreadViewMode In-Reply-To: <1264134316-17210-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264134316-17210-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264436284-sup-7250@zyrg.net> This breaks ThreadIndexMode#launch_another_thread. I'll send a new patch. From bwalton@artsci.utoronto.ca Mon Jan 25 11:35:54 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Mon, 25 Jan 2010 11:35:54 -0500 Subject: [sup-devel] [PATCH] fix participants queries In-Reply-To: <1264435415-11782-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264429332-sup-9299@ntdws12.chass.utoronto.ca> <1264435415-11782-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264437314-sup-4264@ntdws12.chass.utoronto.ca> Excerpts from Rich Lane's message of Mon Jan 25 11:03:35 -0500 2010: > - participant_terms = opts[:participants].map { |p| mkterm(:email,:any, (Redwood::Person === p) ? p.email : p) } > + participant_terms = opts[:participants].map { |p| [:from,:to].map { |d| mkterm(:email, d, (Redwood::Person === p) ? p.email : p) } }.flatten Cleaner than mine. +1 for prompt inclusion at gitorious. :) -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From bwalton@artsci.utoronto.ca Mon Jan 25 11:56:40 2010 From: bwalton@artsci.utoronto.ca (Ben Walton) Date: Mon, 25 Jan 2010 11:56:40 -0500 Subject: [sup-devel] [PATCH] Conditionally define Fixnum#ord In-Reply-To: <1264436321.23.0.59454690461.issue50@masanjin.net> References: <1264436321.23.0.59454690461.issue50@masanjin.net> Message-ID: <1264438600-30566-1-git-send-email-bwalton@artsci.utoronto.ca> Ruby 1.8.5 was throwing exceptions from lib/sup/util.rb line 650 due to calling .ord on a Fixnum. This patch defines Fixnum#ord if the method doesn't exist already. Helps on old ruby version (1.8.5 here). Signed-off-by: Ben Walton --- lib/sup/util.rb | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 5dadba1..861db7f 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -366,6 +366,12 @@ class Fixnum end end + unless method_defined?(:ord) + def ord + self + end + end + ## hacking the english language def pluralize s to_s + " " + -- 1.6.6 From wmorgan-sup@masanjin.net Mon Jan 25 16:19:13 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 25 Jan 2010 16:19:13 -0500 Subject: [sup-devel] Fwd: Re: Sup 0.10 released Message-ID: <1264454003-sup-9657@masanjin.net> I'm seeing a weird behavior with the xapian-full gem, and so is this guy. The installation claims it fails, but it actually succeeds. The spec file is not copied over after installation, so `gem list` doesn't show it, but if you require 'xapian' it actually does pick up the code, even after the failed installation. Ideas? --- Begin forwarded message from Andrea Fazzi --- From: Andrea Fazzi To: ruby-talk Date: Mon, 25 Jan 2010 05:32:10 -0500 Subject: Re: Sup 0.10 released William Morgan wrote: > I'm pleased to announce the release of Sup 0.10. This version is > frickin' awesome because not only do we have Ruby 1.9 support, the > Xapian backend is now the default! The next version will discard Ferret > like a used rag. I had issues installing xapian-full gem on my ubuntu box running MRI ruby1.8. The installation fails building native extension even if it seems that all the C stuff get compiled correctly. BTW, I solved the issue in this way: sudo gem install xapian-full cd /usr/lib/ruby/gems/1.8/gems/xapian-full-1.1.3/ sudo rake build sudo mv xapian-full.gemspec ../../specifications/ andrea at ubuntu-desktop:~$ irb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'xapian' => true Thanks for this great software! Cheers, Andrea --- End forwarded message --- -- William From wmorgan-sup@masanjin.net Mon Jan 25 16:20:00 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 25 Jan 2010 16:20:00 -0500 Subject: [sup-devel] [PATCH] fix participants queries In-Reply-To: <1264435415-11782-1-git-send-email-rlane@club.cc.cmu.edu> References: <1264429332-sup-9299@ntdws12.chass.utoronto.ca> <1264435415-11782-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264454391-sup-6232@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-25: > lib/sup/xapian_index.rb | 2 +- Applied to branch xapian-updates and remerged into next. Thanks! -- William From wmorgan-sup@masanjin.net Mon Jan 25 16:28:25 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 25 Jan 2010 16:28:25 -0500 Subject: [sup-devel] Exception when composing messages In-Reply-To: <1264427161-sup-6711@duck> References: <1264427161-sup-6711@duck> Message-ID: <1264454887-sup-9882@masanjin.net> Reformatted excerpts from Israel Herraiz's message of 2010-01-25: > I am using the next branch of Sup, and since a couple of commits ago, > whenever I try to compose a message (new, forward, etc), I obtain this > exception: This should be fixed! -- William From rlane@club.cc.cmu.edu Mon Jan 25 16:52:23 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 25 Jan 2010 16:52:23 -0500 Subject: [sup-devel] [PATCH] fix missing parentheses warning In-Reply-To: <8b854d6b1001250307o42e85f44id88d3eea7f18beb4@mail.gmail.com> References: <8b854d6b1001250307o42e85f44id88d3eea7f18beb4@mail.gmail.com> Message-ID: <1264456343-32418-1-git-send-email-rlane@club.cc.cmu.edu> --- lib/sup/message.rb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sup/message.rb b/lib/sup/message.rb index 3e55de5..a85cc0d 100644 --- a/lib/sup/message.rb +++ b/lib/sup/message.rb @@ -450,9 +450,9 @@ private subj = decode_header_field(payload.header.subject) || DEFAULT_SUBJECT subj = Message.normalize_subj(subj.gsub(/\s+/, " ").gsub(/\s+$/, "")) msgdate = payload.header.date - from_person = from ? Person.from_address(decode_header_field from) : nil - to_people = to ? Person.from_address_list(decode_header_field to) : nil - cc_people = cc ? Person.from_address_list(decode_header_field cc) : nil + from_person = from ? Person.from_address(decode_header_field(from)) : nil + to_people = to ? Person.from_address_list(decode_header_field(to)) : nil + cc_people = cc ? Person.from_address_list(decode_header_field(cc)) : nil [Chunk::EnclosedMessage.new(from_person, to_people, cc_people, msgdate, subj)] + message_to_chunks(payload, encrypted) else debug "no body for message/rfc822 enclosure; skipping" -- 1.5.6.5 From rlane@club.cc.cmu.edu Mon Jan 25 17:05:49 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 25 Jan 2010 17:05:49 -0500 Subject: [sup-devel] Fwd: Re: Sup 0.10 released In-Reply-To: <1264454003-sup-9657@masanjin.net> References: <1264454003-sup-9657@masanjin.net> Message-ID: <1264456949-sup-3@zyrg.net> Excerpts from William Morgan's message of 2010-01-25 16:19:13 -0500: > I'm seeing a weird behavior with the xapian-full gem, and so is this > guy. The installation claims it fails, but it actually succeeds. The > spec file is not copied over after installation, so `gem list` doesn't > show it, but if you require 'xapian' it actually does pick up the code, > even after the failed installation. > > Ideas? This has been reported before but I haven't figured out what's going on. I pushed the source of the xapian-full gem to git://github.com/rlane/xapian-full in case anyone else wants to take a crack at this. From rlane@club.cc.cmu.edu Mon Jan 25 18:37:24 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 25 Jan 2010 18:37:24 -0500 Subject: [sup-devel] Fwd: Re: Sup 0.10 released In-Reply-To: <1264456949-sup-3@zyrg.net> References: <1264454003-sup-9657@masanjin.net> <1264456949-sup-3@zyrg.net> Message-ID: <1264462577-sup-3137@zyrg.net> Excerpts from Rich Lane's message of 2010-01-25 17:05:49 -0500: > Excerpts from William Morgan's message of 2010-01-25 16:19:13 -0500: > > I'm seeing a weird behavior with the xapian-full gem, and so is this > > guy. The installation claims it fails, but it actually succeeds. The > > spec file is not copied over after installation, so `gem list` doesn't > > show it, but if you require 'xapian' it actually does pick up the code, > > even after the failed installation. > > > > Ideas? > > This has been reported before but I haven't figured out what's going on. > I pushed the source of the xapian-full gem to git://github.com/rlane/xapian-full > in case anyone else wants to take a crack at this. I think I fixed it. Please try xapian-full 1.1.3.1 from gemcutter. From marka@pobox.com Mon Jan 25 19:21:14 2010 From: marka@pobox.com (Mark Alexander) Date: Mon, 25 Jan 2010 19:21:14 -0500 Subject: [sup-devel] Fwd: Re: Sup 0.10 released In-Reply-To: <1264462577-sup-3137@zyrg.net> References: <1264454003-sup-9657@masanjin.net> <1264456949-sup-3@zyrg.net> <1264462577-sup-3137@zyrg.net> Message-ID: On Mon, Jan 25, 2010 at 6:37 PM, Rich Lane wrote: > I think I fixed it. Please try xapian-full 1.1.3.1 from gemcutter. Can you describe what you did to fix it? I spent several hours trying to fix this a while back and gave up. From rlane@club.cc.cmu.edu Mon Jan 25 19:35:44 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Mon, 25 Jan 2010 19:35:44 -0500 Subject: [sup-devel] Fwd: Re: Sup 0.10 released In-Reply-To: References: <1264454003-sup-9657@masanjin.net> <1264456949-sup-3@zyrg.net> <1264462577-sup-3137@zyrg.net> Message-ID: <1264465797-sup-429@zyrg.net> Excerpts from Mark Alexander's message of 2010-01-25 19:21:14 -0500: > On Mon, Jan 25, 2010 at 6:37 PM, Rich Lane wrote: > > I think I fixed it. Please try xapian-full 1.1.3.1 from gemcutter. > > Can you describe what you did to fix it? I spent several hours > trying to fix this a while back and gave up. It turns out gem expects extconf.rb to create a Makefile, but mine was just doing the compile itself. Gem also accepts Rakefiles for building extensions, so I moved the code into a minimal Rakefile. I also added the gemspec to the manifest. From wmorgan-sup@masanjin.net Tue Jan 26 08:22:09 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 26 Jan 2010 08:22:09 -0500 Subject: [sup-devel] Fwd: Re: Sup 0.10 released In-Reply-To: <1264462577-sup-3137@zyrg.net> References: <1264454003-sup-9657@masanjin.net> <1264456949-sup-3@zyrg.net> <1264462577-sup-3137@zyrg.net> Message-ID: <1264512093-sup-8869@masanjin.net> Reformatted excerpts from Rich Lane's message of 2010-01-25: > I think I fixed it. Please try xapian-full 1.1.3.1 from gemcutter. Works great. Nice one. I'm going to release an 0.10.2 that has deps on that and ncursesw. -- William From wmorgan-sup@masanjin.net Tue Jan 26 08:20:58 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 26 Jan 2010 08:20:58 -0500 Subject: [sup-devel] [PATCH] fix missing parentheses warning In-Reply-To: <1264456343-32418-1-git-send-email-rlane@club.cc.cmu.edu> References: <8b854d6b1001250307o42e85f44id88d3eea7f18beb4@mail.gmail.com> <1264456343-32418-1-git-send-email-rlane@club.cc.cmu.edu> Message-ID: <1264511297-sup-1185@masanjin.net> Applied directly to master. Thanks! What do people think of turning warnings off entirely for bin/sup? Should just be a matter of setting $VERBOSE = nil. It is a curses app, after all. -- William From wmorgan-sup@masanjin.net Tue Jan 26 09:05:40 2010 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 26 Jan 2010 09:05:40 -0500 Subject: [sup-devel] [PATCH] Conditionally define Fixnum#ord In-Reply-To: <1264438600-30566-1-git-send-email-bwalton@artsci.utoronto.ca> References: <1264436321.23.0.59454690461.issue50@masanjin.net> <1264438600-30566-1-git-send-email-bwalton@artsci.utoronto.ca> Message-ID: <1264514710-sup-1956@masanjin.net> Reformatted excerpts from Ben Walton's message of 2010-01-25: > Ruby 1.8.5 was throwing exceptions from lib/sup/util.rb line 650 due > to calling .ord on a Fixnum. This patch defines Fixnum#ord if the > method doesn't exist already. Helps on old ruby version (1.8.5 here). Applied to master. Thanks! -- William From nicolas.pouillard@gmail.com Tue Jan 26 10:50:30 2010 From: nicolas.pouillard@gmail.com (Nicolas Pouillard) Date: Tue, 26 Jan 2010 07:50:30 -0800 (PST) Subject: [sup-devel] Fwd: Re: Sup 0.10 released In-Reply-To: <1264512093-sup-8869@masanjin.net> References: <1264454003-sup-9657@masanjin.net> <1264456949-sup-3@zyrg.net> <1264462577-sup-3137@zyrg.net> <1264512093-sup-8869@masanjin.net> Message-ID: <4b5f0f46.1067f10a.2eaa.ffffaccd@mx.google.com> On Tue, 26 Jan 2010 08:22:09 -0500, William Morgan wrote: > Reformatted excerpts from Rich Lane's message of 2010-01-25: > > I think I fixed it. Please try xapian-full 1.1.3.1 from gemcutter. > > Works great. Nice one. > > I'm going to release an 0.10.2 that has deps on that and ncursesw. Yes worked great for me too. -- Nicolas Pouillard http://nicolaspouillard.fr From sup-bugs@masanjin.net Wed Jan 27 03:03:58 2010 From: sup-bugs@masanjin.net (anonymous) Date: Wed, 27 Jan 2010 08:03:58 +0000 Subject: [sup-devel] [issue51] Crash on sup start In-Reply-To: <1264579438.47.0.202537444992.issue51@masanjin.net> Message-ID: <1264579438.47.0.202537444992.issue51@masanjin.net> New submission from anonymous: sup crashes on startup. ---------- files: exception-log.txt messages: 122 nosy: anonymous priority: bug ruby_version: ruby 1.8.6 status: unread sup_version: sup vgit title: Crash on sup start _________________________________________ Sup issue tracker _________________________________________ -------------- next part -------------- --- RuntimeError from thread: load threads for thread-index-mode wrong id called on nil ./lib/sup.rb:17:in `id' ./lib/sup/modes/thread-index-mode.rb:226:in `update' ./lib/sup/hook.rb:122:in `sort_by' ./lib/sup/modes/thread-index-mode.rb:226:in `each' ./lib/sup/modes/thread-index-mode.rb:226:in `sort_by' ./lib/sup/modes/thread-index-mode.rb:226:in `update' ./lib/sup/modes/thread-index-mode.rb:224:in `synchronize' ./lib/sup/modes/thread-index-mode.rb:224:in `update' ./lib/sup/modes/thread-index-mode.rb:642:in `__unprotected_load_n_threads' (eval):12:in `load_n_threads' ./lib/sup/modes/thread-index-mode.rb:614:in `load_n_threads_background' ./lib/sup.rb:78:in `reporting_thread' ./lib/sup.rb:76:in `initialize' ./lib/sup.rb:76:in `new' ./lib/sup.rb:76:in `reporting_thread' ./lib/sup/modes/thread-index-mode.rb:613:in `load_n_threads_background' ./lib/sup/modes/thread-index-mode.rb:684:in `__unprotected_load_threads' (eval):12:in `load_threads' bin/sup:231 From sup-bugs@masanjin.net Wed Jan 27 07:46:54 2010 From: sup-bugs@masanjin.net (Shreyank Gupta) Date: Wed, 27 Jan 2010 12:46:54 +0000 Subject: [sup-devel] [issue52] Crash on sup start In-Reply-To: <1264596414.87.0.250405531257.issue52@masanjin.net> Message-ID: <1264596414.87.0.250405531257.issue52@masanjin.net> New submission from Shreyank Gupta : Crashes on start. ---------- files: exception-log.txt messages: 123 nosy: shreyankg priority: bug ruby_version: ruby 1.8.6 status: unread sup_version: sup v0.10.2 title: Crash on sup start _________________________________________ Sup issue tracker _________________________________________ -------------- next part -------------- --- RuntimeError from thread: main This Sup version expects a v1 index, but you have an existing v2 index. Please downgrade to your previous version and dump your labels before upgrading to this version (then run sup-sync --restore). /usr/lib/ruby/gems/1.8/gems/sup-0.10.2/lib/sup/xapian_index.rb:41:in `load_index' /usr/lib/ruby/gems/1.8/gems/sup-0.10.2/lib/sup/index.rb:71:in `load' /usr/lib/ruby/gems/1.8/gems/sup-0.10.2/lib/sup/index.rb:236:in `send' /usr/lib/ruby/gems/1.8/gems/sup-0.10.2/lib/sup/index.rb:236:in `method_missing' /usr/lib/ruby/gems/1.8/gems/sup-0.10.2/bin/sup:169 /usr/bin/sup:19:in `load' /usr/bin/sup:19 From sup-bugs@masanjin.net Wed Jan 27 16:11:48 2010 From: sup-bugs@masanjin.net (Anirudh Sanjeev) Date: Wed, 27 Jan 2010 21:11:48 +0000 Subject: [sup-devel] [issue53] Error if the composed text has tabs in the first character In-Reply-To: <1264626708.47.0.495243760209.issue53@masanjin.net> Message-ID: <1264626708.47.0.495243760209.issue53@masanjin.net> New submission from Anirudh Sanjeev : Steps to reproduce: 1. Compose message with a tab as a first character 2. View composed message in the compose-mode It looks like this in my text editor: http://imgur.com/NH2Rz.png Here's how it looks like in compose mode. Note how the last few characters of the compose mode is truncated. http://imgur.com/xdL0U.png ---------- messages: 124 nosy: anirudhs priority: bug ruby_version: 1.8 status: unread sup_version: next title: Error if the composed text has tabs in the first character _________________________________________ Sup issue tracker _________________________________________ From marka@pobox.com Wed Jan 27 16:57:33 2010 From: marka@pobox.com (Mark Alexander) Date: Wed, 27 Jan 2010 16:57:33 -0500 Subject: [sup-devel] [issue53] Error if the composed text has tabs in the first character In-Reply-To: <1264626708.47.0.495243760209.issue53@masanjin.net> References: <1264626708.47.0.495243760209.issue53@masanjin.net> <1264626708.47.0.495243760209.issue53@masanjin.net> Message-ID: I've been noticing this problem for a long time now. I think it happens with tabs anywhere in the message, or perhaps at the beginning of lines, but I haven't played with it enough to know for sure. From tero@tilus.net Wed Jan 27 17:15:19 2010 From: tero@tilus.net (Tero Tilus) Date: Thu, 28 Jan 2010 00:15:19 +0200 Subject: [sup-devel] [issue53] Error if the composed text has tabs in the first character In-Reply-To: <1264626708.47.0.495243760209.issue53@masanjin.net> References: <1264626708.47.0.495243760209.issue53@masanjin.net> Message-ID: <1264630303-sup-9772@tilus.net> Anirudh Sanjeev, 2010-01-27 23:11: > Steps to reproduce: > 1. Compose message with a tab as a first character > 2. View composed message in the compose-mode Looks like tabs are counted as 1 (instead of 8) when calculating string display width. Dunno why this did not affect thread-view-mode thought. Patch attached. -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Count-tabs-as-8-chars-when-calculating-display-lengt.patch Type: application/octet-stream Size: 620 bytes Desc: not available URL: From rlane@club.cc.cmu.edu Wed Jan 27 17:29:09 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Wed, 27 Jan 2010 17:29:09 -0500 Subject: [sup-devel] [issue53] Error if the composed text has tabs in the first character In-Reply-To: References: <1264626708.47.0.495243760209.issue53@masanjin.net> Message-ID: <1264629880-sup-9232@zyrg.net> Excerpts from Mark Alexander's message of 2010-01-27 16:57:33 -0500: > I've been noticing this problem for a long time now. > I think it happens with tabs anywhere in the > message, or perhaps at the beginning of lines, > but I haven't played with it enough to know for sure. Sup assumes that 1 codepoint == 1 screen cell. This also causes problems with double-width Chinese(?) characters. William has suggested using wc[s]width, and now that we've got our own fork of ncurses-ruby we might as well stick it in there. I looked at it briefly and iirc the troublesome part was getting a wchar_t from the bytes in a Ruby string. Tabs are funny because their width depends on their position. I say replace all tabs with 2 spaces before calling ncurses. From sup-bugs@masanjin.net Wed Jan 27 17:47:53 2010 From: sup-bugs@masanjin.net (Tero Tilus) Date: Wed, 27 Jan 2010 22:47:53 +0000 Subject: [sup-devel] [issue54] Log-mode and poll-mode buffers should not be killable In-Reply-To: <1264632472.97.0.545373102631.issue54@masanjin.net> Message-ID: <1264632472.97.0.545373102631.issue54@masanjin.net> New submission from Tero Tilus : [ this is a copy from ] As a related point, can I make it so that the log-mode and poll-mode buffers aren't killable with 'x'? I get in the habit of pressing 'x', and occasionally forget that when I'm viewing one of those buffers, I need to press 'I' instead. ---------- messages: 129 nosy: terotil priority: feature request ruby_version: any status: unread sup_version: 0.10 title: Log-mode and poll-mode buffers should not be killable _________________________________________ Sup issue tracker _________________________________________ From hyperbolist@gmail.com Wed Jan 27 21:48:43 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Wed, 27 Jan 2010 21:48:43 -0500 Subject: [sup-devel] [PATCH] [issue54] log-mode and poll-mode buffers are not killable In-Reply-To: <1264632472.97.0.545373102631.issue54@masanjin.net> References: <1264632472.97.0.545373102631.issue54@masanjin.net> Message-ID: <1264646626-sup-7355@changeling.local> --- lib/sup/modes/log-mode.rb | 2 ++ lib/sup/modes/poll-mode.rb | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/log-mode.rb b/lib/sup/modes/log-mode.rb index de320ce..e583caf 100644 --- a/lib/sup/modes/log-mode.rb +++ b/lib/sup/modes/log-mode.rb @@ -52,6 +52,8 @@ class LogMode < TextMode self.text = "" super end + + def killable?; false; end end end diff --git a/lib/sup/modes/poll-mode.rb b/lib/sup/modes/poll-mode.rb index cf61343..deb22d6 100644 --- a/lib/sup/modes/poll-mode.rb +++ b/lib/sup/modes/poll-mode.rb @@ -14,6 +14,8 @@ class PollMode < LogMode self << "Poll started at #{Time.now}\n" PollManager.do_poll { |s| self << (s + "\n") } end + + def killable?; false; end end end -- 1.6.6 From sup-bugs@masanjin.net Thu Jan 28 03:02:43 2010 From: sup-bugs@masanjin.net (anonymous) Date: Thu, 28 Jan 2010 08:02:43 +0000 Subject: [sup-devel] [issue55] undefined method `>=' for true:TrueClass In-Reply-To: <1264665763.28.0.0069731812863.issue55@masanjin.net> Message-ID: <1264665763.28.0.0069731812863.issue55@masanjin.net> New submission from anonymous: Source#current_offset= returns true instead of the set value, causing Source#done? to blow up on (self.cur_offset ||= start_offset) >= end_offset The fix is to swap the two lines in Source#current_offset= so that it returns the value: def cur_offset= o @dirty = true @cur_offset = o end As it is in 0.10.2 it returns the value for @dirty instead ---------- files: exception-log.txt messages: 139 nosy: anonymous priority: bug ruby_version: 1.9.1 status: unread sup_version: 0.10.2 title: undefined method `>=' for true:TrueClass _________________________________________ Sup issue tracker _________________________________________ -------------- next part -------------- --- NoMethodError from thread: poll after loading inbox undefined method `>=' for true:TrueClass /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/source.rb:88:in `done?' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/util.rb:599:in `__pass' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/util.rb:586:in `method_missing' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/poll.rb:100:in `block (2 levels) in do_poll' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/poll.rb:97:in `each' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/poll.rb:97:in `block in do_poll' :8:in `synchronize' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/poll.rb:96:in `do_poll' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/util.rb:559:in `method_missing' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/modes/poll-mode.rb:15:in `poll' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/poll.rb:47:in `poll_with_sources' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/poll.rb:62:in `poll' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup/util.rb:559:in `method_missing' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/bin/sup:226:in `block (2 levels) in ' /usr/local/lib/ruby-1.9/gems/1.9.1/gems/sup-0.10.2/lib/sup.rb:77:in `block in reporting_thread' From sup-bugs@masanjin.net Thu Jan 28 07:21:48 2010 From: sup-bugs@masanjin.net (ideesnoires) Date: Thu, 28 Jan 2010 12:21:48 +0000 Subject: [sup-devel] [issue56] Sup crashes while saving changes In-Reply-To: <1264681308.87.0.11225407467.issue56@masanjin.net> Message-ID: <1264681308.87.0.11225407467.issue56@masanjin.net> New submission from ideesnoires : I'm running sup with the ncurses patch as specified in http://sup.rubyforge.org/wiki/wiki.pl?UTF8 when i try to save the modified index with $ sup just crashes and leaves following exception behind: (also in exception log) --- NoMethodError from thread: saving thread undefined method `save_state' for # /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:480:in `actually_save' ./lib/sup/hook.rb:122:in `each_with_index' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:478:in `each' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:478:in `each_with_index' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:478:in `actually_save' ./lib/sup/buffer.rb:721:in `say' ./lib/sup/util.rb:559:in `send' ./lib/sup/util.rb:559:in `method_missing' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:477:in `actually_save' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:472:in `synchronize' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:472:in `actually_save' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:465:in `save' ./lib/sup.rb:78:in `reporting_thread' ./lib/sup.rb:76:in `initialize' ./lib/sup.rb:76:in `new' ./lib/sup.rb:76:in `reporting_thread' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:465:in `save' ./lib/sup/mode.rb:51:in `send' ./lib/sup/mode.rb:51:in `handle_input' ./lib/sup/buffer.rb:272:in `handle_input' bin/sup:276 ---------- files: exception-log.txt messages: 140 nosy: ideesnoires priority: bug ruby_version: 1.8 status: unread sup_version: next rev. 117b4f0 title: Sup crashes while saving changes _________________________________________ Sup issue tracker _________________________________________ -------------- next part -------------- --- NoMethodError from thread: saving thread undefined method `save_state' for # /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:480:in `actually_save' ./lib/sup/hook.rb:122:in `each_with_index' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:478:in `each' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:478:in `each_with_index' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:478:in `actually_save' ./lib/sup/buffer.rb:721:in `say' ./lib/sup/util.rb:559:in `send' ./lib/sup/util.rb:559:in `method_missing' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:477:in `actually_save' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:472:in `synchronize' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:472:in `actually_save' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:465:in `save' ./lib/sup.rb:78:in `reporting_thread' ./lib/sup.rb:76:in `initialize' ./lib/sup.rb:76:in `new' ./lib/sup.rb:76:in `reporting_thread' /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:465:in `save' ./lib/sup/mode.rb:51:in `send' ./lib/sup/mode.rb:51:in `handle_input' ./lib/sup/buffer.rb:272:in `handle_input' bin/sup:276 From hyperbolist@gmail.com Thu Jan 28 08:46:25 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 28 Jan 2010 08:46:25 -0500 Subject: [sup-devel] [PATCH] [issue54] log-mode and poll-mode buffers are not killable In-Reply-To: <1264646626-sup-7355@changeling.local> References: <1264632472.97.0.545373102631.issue54@masanjin.net> <1264646626-sup-7355@changeling.local> Message-ID: <1264686346-sup-9488@changeling.local> That doesn't quite work, as sup won't quit. Another patch on its way. From hyperbolist@gmail.com Thu Jan 28 09:07:28 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 28 Jan 2010 09:07:28 -0500 Subject: [sup-devel] [PATCHv2] [issue54] log-mode and poll-mode buffers are not killable In-Reply-To: <1264632472.97.0.545373102631.issue54@masanjin.net> References: <1264632472.97.0.545373102631.issue54@masanjin.net> Message-ID: <1264687215-sup-8249@changeling.local> Oops. Now, with the ability to quit sup. --- lib/sup/buffer.rb | 4 ++-- lib/sup/modes/log-mode.rb | 2 ++ lib/sup/modes/poll-mode.rb | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 990dd4a..5fb1047 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -414,8 +414,8 @@ EOS def kill_all_buffers_safely until @buffers.empty? - ## inbox mode always claims it's unkillable. we'll ignore it. - return false unless @buffers.last.mode.is_a?(InboxMode) || @buffers.last.mode.killable? + ## inbox, log and poll modes always claim they're unkillable. we'll ignore them. + return false unless @buffers.last.mode.is_a?(InboxMode) || @buffers.last.mode.is_a?(LogMode) || @buffers.last.mode.is_a?(PollMode) || @buffers.last.mode.killable? kill_buffer @buffers.last end true diff --git a/lib/sup/modes/log-mode.rb b/lib/sup/modes/log-mode.rb index de320ce..e583caf 100644 --- a/lib/sup/modes/log-mode.rb +++ b/lib/sup/modes/log-mode.rb @@ -52,6 +52,8 @@ class LogMode < TextMode self.text = "" super end + + def killable?; false; end end end diff --git a/lib/sup/modes/poll-mode.rb b/lib/sup/modes/poll-mode.rb index cf61343..deb22d6 100644 --- a/lib/sup/modes/poll-mode.rb +++ b/lib/sup/modes/poll-mode.rb @@ -14,6 +14,8 @@ class PollMode < LogMode self << "Poll started at #{Time.now}\n" PollManager.do_poll { |s| self << (s + "\n") } end + + def killable?; false; end end end -- 1.6.6 From sup-bugs@masanjin.net Thu Jan 28 15:06:04 2010 From: sup-bugs@masanjin.net (Anirudh Sanjeev) Date: Thu, 28 Jan 2010 20:06:04 +0000 Subject: [sup-devel] [issue57] Request: Flush changes periodically In-Reply-To: <1264709164.82.0.12859120302.issue57@masanjin.net> Message-ID: <1264709164.82.0.12859120302.issue57@masanjin.net> New submission from Anirudh Sanjeev : Can there be an optional functionality to flush changes to disk every 10-15 minutes, instead of having to press $ every time Rationale: I'm in a place where power cuts are extremely frequent. I keep forgetting to flush changes manually requiring me to re-delete and archive my messages every time I reboot and restart sup. I run sup off of git 'next' head. A patch which will hard-code this functionality would be fine as well. Alternatively, is there a command I can call via a cron job to do this? Thanks! ---------- messages: 142 nosy: anirudhs priority: feature request ruby_version: 1.8 status: unread sup_version: git/next title: Request: Flush changes periodically _________________________________________ Sup issue tracker _________________________________________ From hyperbolist@gmail.com Thu Jan 28 15:21:54 2010 From: hyperbolist@gmail.com (Eric Sherman) Date: Thu, 28 Jan 2010 15:21:54 -0500 Subject: [sup-devel] [issue57] Request: Flush changes periodically In-Reply-To: <1264709164.82.0.12859120302.issue57@masanjin.net> References: <1264709164.82.0.12859120302.issue57@masanjin.net> Message-ID: <1264709474-sup-4387@changeling.local> Excerpts from Anirudh Sanjeev's message of Thu Jan 28 15:06:04 -0500 2010: > > Can there be an optional functionality to flush changes to disk every 10-15 > minutes, instead of having to press $ every time You may want to try these patches: [PATCHv3] idle and unidle updates [1] [PATCH] flush index on idle [2] The first one relays the idle and unidle updates, and the second one will actually perform the flush when it gets an idle update. And you may be interested in this one too: [PATCHv5] [issue14] poll updates accumulate while idle [3] I use these and they meet my needs. [1]: http://rubyforge.org/pipermail/sup-devel/2010-January/000285.html [2]: http://rubyforge.org/pipermail/sup-devel/2010-January/000274.html [3]: http://rubyforge.org/pipermail/sup-devel/2010-January/000241.html From sup-bugs@masanjin.net Fri Jan 29 05:14:40 2010 From: sup-bugs@masanjin.net (Gregor Hoffleit) Date: Fri, 29 Jan 2010 10:14:40 +0000 Subject: [sup-devel] [issue58] Set background for starred column In-Reply-To: <1264760080.41.0.139357784083.issue58@masanjin.net> Message-ID: <1264760080.41.0.139357784083.issue58@masanjin.net> New submission from Gregor Hoffleit : For the sake of consistency, Sup should always use the starred_color for the 'starred' column in the thread-index-mode, whether there's a star or a blank. Rationale: With this patch, I'm able to set the background color of the thread- index to bg:7 without having to change my term's background color. Without the patch, the background color shines through in the starred column. ---------- files: bg-starred.diff messages: 143 nosy: flight priority: bug ruby_version: 1.8.5 status: unread sup_version: 0.10.2 title: Set background for starred column _________________________________________ Sup issue tracker _________________________________________ -------------- next part -------------- A non-text attachment was scrubbed... Name: bg-starred.diff Type: application/octet-stream Size: 483 bytes Desc: not available URL: From sup-bugs@masanjin.net Sun Jan 31 16:38:24 2010 From: sup-bugs@masanjin.net (anonymous) Date: Sun, 31 Jan 2010 21:38:24 +0000 Subject: [sup-devel] [issue59] gem install sup on osx 10.6 fails due to .bundle instead of .so being built in xapian-full In-Reply-To: <1264973904.76.0.328276768293.issue59@masanjin.net> Message-ID: <1264973904.76.0.328276768293.issue59@masanjin.net> New submission from anonymous: on a default os X 10.6 machine (after updating rubygems) doing a 'gem sup install' fails: The problem is xapian-full is making a .bundle instead of a .so. It's easy to change to make a .so file (just remove the -bundle and chenge the output to .so, but I know nothing of Ruby, or how to make ruby gems behave. I can manually build the .so file, but then doing another 'gem install sup' just replaces the directory I just fixed. So I don't even know of how to work-around this. Below is the evil details: p.cc libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -fno-strict-aliasing -Wall -Wno-unused -Wno-uninitialized -fvisibility=hidden -I/Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1/xapian-core-1.1.3/include -g -O2 -MT xapian_wrap.lo -MD -MP -MF .deps/xapian_wrap.Tpo -c xapian_wrap.cc -fno-common -DPIC -o .libs/xapian_wrap.o mv -f .deps/xapian_wrap.Tpo .deps/xapian_wrap.Plo /bin/sh ../libtool --tag=CXX --mode=link g++ -fno-strict-aliasing -Wall -Wno-unused -Wno-uninitialized -fvisibility=hidden -I/Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1/xapian-core-1.1.3/include -g -O2 -avoid-version -module -shrext ".bundle" -o _xapian.la -rpath /Library/Ruby/Site/1.8/universal-darwin10.0 xapian_wrap.lo /Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1/xapian-core-1.1.3/libxapian-1.1.la -lstdc++ libtool: link: g++ -Wl,-undefined -Wl,dynamic_lookup -o .libs/_xapian.bundle -bundle .libs/xapian_wrap.o /Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1/xapian-core-1.1.3/.libs/libxapian-1.1.dylib -lz -lstdc++ libtool: link: dsymutil .libs/_xapian.bundle || : libtool: link: ( cd ".libs" && rm -f "_xapian.la" && ln -s "../_xapian.la" "_xapian.la" ) mkdir -p lib cp xapian-bindings-1.1.3/ruby/.libs/_xapian.so lib cp: xapian-bindings-1.1.3/ruby/.libs/_xapian.so: No such file or directory rake aborted! /Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1/rakefile:6:in `system!' (See full trace by running task with --trace) Gem files will remain installed in /Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1 for inspection. Results logged to /Users/tara/.gem/ruby/1.8/gems/xapian-full-1.1.3.1/gem_make.out tara at mudita ~ % gem install ferret ---------- messages: 144 nosy: anonymous priority: bug ruby_version: 1.8.7 status: unread sup_version: 0.10.2 title: gem install sup on osx 10.6 fails due to .bundle instead of .so being built in xapian-full _________________________________________ Sup issue tracker _________________________________________ From rlane@club.cc.cmu.edu Sun Jan 31 17:53:45 2010 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sun, 31 Jan 2010 17:53:45 -0500 Subject: [sup-devel] [issue59] gem install sup on osx 10.6 fails due to .bundle instead of .so being built in xapian-full In-Reply-To: <1264973904.76.0.328276768293.issue59@masanjin.net> References: <1264973904.76.0.328276768293.issue59@masanjin.net> Message-ID: <1264978339-sup-4555@zyrg.net> Excerpts from anonymous's message of 2010-01-31 16:38:24 -0500: > > New submission from anonymous: > > on a default os X 10.6 machine (after updating rubygems) doing a 'gem sup > install' fails: > > The problem is xapian-full is making a .bundle instead of a .so. It's easy to > change to make a .so file (just remove the -bundle and chenge the output to .so, > but I know nothing of Ruby, or how to make ruby gems behave. I can manually > build the .so file, but then doing another 'gem install sup' just replaces the > directory I just fixed. So I don't even know of how to work-around this. I just pushed xapian-full-1.1.3.2 which should fix this issue.