sup

A curses threads-with-tags style email client

sup-website.git

git clone https://supmua.dev/git/sup-website/

community/pipermail-archives/sup-talk/2009-02.txt (64118B) - raw

      1 From simon.raven@gmail.com  Sun Feb  1 17:26:23 2009
      2 From: simon.raven@gmail.com (Simon Raven)
      3 Date: Sun, 1 Feb 2009 17:26:23 -0500
      4 Subject: [sup-talk] sup-mail crash
      5 Message-ID: <20090201222618.GA6346@acahkos.kisikew.org>
      6 
      7 
      8 attached is the exception log
      9 
     10 
     11 -- 
     12 "A mouse is a device used to point at the xterm you want to type in"
     13                 -- A.S.R.
     14 -------------- next part --------------
     15 --- IOError from thread: load threads for thread-index-mode
     16 IO Error occured at <except.c>:93 in xraise
     17 Error occured in fs_store.c:293 - fsi_seek_i
     18 	seeking pos 377228: <Bad file descriptor>
     19 
     20 /usr/lib/ruby/1.8/sup/index.rb:362:in `default'
     21 /usr/lib/ruby/1.8/sup/index.rb:362:in `[]'
     22 /usr/lib/ruby/1.8/sup/index.rb:362:in `build_message'
     23 /usr/lib/ruby/1.8/sup/index.rb:342:in `each_message_in_thread_for'
     24 /usr/lib/ruby/1.8/sup/thread.rb:341:in `call'
     25 /usr/lib/ruby/1.8/sup/thread.rb:341:in `load_thread_for_message'
     26 /usr/lib/ruby/1.8/sup/index.rb:354:in `each_message_in_thread_for'
     27 /usr/lib/ruby/1.8/sup/index.rb:354:in `each'
     28 /usr/lib/ruby/1.8/sup/index.rb:354:in `each_message_in_thread_for'
     29 /usr/lib/ruby/1.8/sup/thread.rb:339:in `load_thread_for_message'
     30 /usr/lib/ruby/1.8/sup/thread.rb:331:in `load_n_threads'
     31 /usr/lib/ruby/1.8/sup/index.rb:263:in `each_id_by_date'
     32 /usr/lib/ruby/1.8/sup/index.rb:263:in `each'
     33 /usr/lib/ruby/1.8/sup/index.rb:263:in `each_id_by_date'
     34 /usr/lib/ruby/1.8/sup/thread.rb:326:in `load_n_threads'
     35 /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:499:in `__unprotected_load_n_threads'
     36 (eval):12:in `load_n_threads'
     37 /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:483:in `load_n_threads_background'
     38 /usr/lib/ruby/1.8/sup.rb:84:in `reporting_thread'
     39 /usr/lib/ruby/1.8/sup.rb:82:in `initialize'
     40 /usr/lib/ruby/1.8/sup.rb:82:in `new'
     41 /usr/lib/ruby/1.8/sup.rb:82:in `reporting_thread'
     42 /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:482:in `load_n_threads_background'
     43 /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:552:in `__unprotected_load_threads'
     44 (eval):12:in `load_threads'
     45 /usr/lib/ruby/1.8/sup/modes/thread-index-mode.rb:76:in `initialize'
     46 /usr/lib/ruby/1.8/sup/modes/line-cursor-mode.rb:177:in `call'
     47 /usr/lib/ruby/1.8/sup/modes/line-cursor-mode.rb:177:in `call_load_more_callbacks'
     48 /usr/lib/ruby/1.8/sup/modes/line-cursor-mode.rb:177:in `each'
     49 /usr/lib/ruby/1.8/sup/modes/line-cursor-mode.rb:177:in `call_load_more_callbacks'
     50 /usr/lib/ruby/1.8/sup/modes/line-cursor-mode.rb:137:in `page_down'
     51 /usr/lib/ruby/1.8/sup/mode.rb:49:in `send'
     52 /usr/lib/ruby/1.8/sup/mode.rb:49:in `handle_input'
     53 /usr/lib/ruby/1.8/sup/buffer.rb:240:in `handle_input'
     54 /usr/bin/sup-mail:187
     55 
     56 From tpo2@sourcepole.ch  Mon Feb  9 17:41:46 2009
     57 From: tpo2@sourcepole.ch (Tomas Pospisek Mailing Lists)
     58 Date: Mon, 09 Feb 2009 23:41:46 +0100
     59 Subject: [sup-talk] sup-mail crash
     60 In-Reply-To: <20090201222618.GA6346@acahkos.kisikew.org>
     61 Message-ID: <zcSrlYwa.1234219306.5754650.tpo2@mail>
     62 
     63 
     64 Search the ML archives. This looks similar to other crash reports and
     65 might be the same issue.
     66 *t
     67 
     68 On 2/6/2009, "Simon Raven" <simon.raven at gmail.com> wrote:
     69 
     70 >attached is the exception log
     71 > ...
     72 > IO Error occured at <except.c>:93 in xraise
     73 > Error occured in fs_store.c:293 - fsi_seek_i
     74 >	seeking pos 377228: <Bad file descriptor>
     75 
     76 From wmorgan-sup@masanjin.net  Mon Feb  9 18:09:37 2009
     77 From: wmorgan-sup@masanjin.net (William Morgan)
     78 Date: Mon, 09 Feb 2009 15:09:37 -0800
     79 Subject: [sup-talk] sup-mail crash
     80 In-Reply-To: <zcSrlYwa.1234219306.5754650.tpo2@mail>
     81 References: <20090201222618.GA6346@acahkos.kisikew.org>
     82 	<zcSrlYwa.1234219306.5754650.tpo2@mail>
     83 Message-ID: <1234220954-sup-3688@entry>
     84 
     85 Reformatted excerpts from Tomas Pospisek Mailing Lists's message of 2009-02-09:
     86 > Search the ML archives. This looks similar to other crash reports and
     87 > might be the same issue.
     88 
     89 In particular I'm pretty sure this is fixed in git, which I'll be
     90 releasing "any day now".
     91 -- 
     92 William <wmorgan-sup at masanjin.net>
     93 
     94 From marcus-sup@bar-coded.net  Tue Feb 10 07:28:08 2009
     95 From: marcus-sup@bar-coded.net (Marcus Williams)
     96 Date: Tue, 10 Feb 2009 12:28:08 +0000
     97 Subject: [sup-talk] sup-mail crash
     98 In-Reply-To: <1234220954-sup-3688@entry>
     99 References: <20090201222618.GA6346@acahkos.kisikew.org>
    100 	<zcSrlYwa.1234219306.5754650.tpo2@mail> <1234220954-sup-3688@entry>
    101 Message-ID: <1234268739-sup-5896@tomsk>
    102 
    103 On 9.2.2009, William Morgan wrote:
    104 > In particular I'm pretty sure this is fixed in git, which I'll be
    105 > releasing "any day now".
    106 
    107 I've not been able to track sup git on my work machine for a while
    108 because something introduced between 0.6 and latest head has borked
    109 the mbox code. I get an odd hash error about the hash changing whilst
    110 being read or something. Not sure how to track down what causes it
    111 though.
    112 
    113 I can probably update and get stack trace if its any use.
    114 
    115 Marcus
    116 
    117 From tpo2@sourcepole.ch  Wed Feb 11 18:05:46 2009
    118 From: tpo2@sourcepole.ch (Tomas Pospisek Mailing Lists)
    119 Date: Thu, 12 Feb 2009 00:05:46 +0100
    120 Subject: [sup-talk] sup-mail crash
    121 In-Reply-To: <1234220954-sup-3688@entry>
    122 Message-ID: <VsjZMWsy.1234393546.2578350.tpo2@mail>
    123 
    124 
    125 On 2/10/2009, "William Morgan" <wmorgan-sup at masanjin.net> wrote:
    126 
    127 >Reformatted excerpts from Tomas Pospisek Mailing Lists's message of 2009-02-09:
    128 >> Search the ML archives. This looks similar to other crash reports and
    129 >> might be the same issue.
    130 >
    131 >In particular I'm pretty sure this is fixed in git, which I'll be
    132 >releasing "any day now".
    133 
    134 Wow. That would be fantastic. I quite liked sup, but it wasn't stable.
    135 And being stable at runtime is about the number #1 feature for any SW
    136 for me.
    137 *t, waiting the day X
    138 
    139 From wmorgan-sup@masanjin.net  Thu Feb 12 16:58:20 2009
    140 From: wmorgan-sup@masanjin.net (William Morgan)
    141 Date: Thu, 12 Feb 2009 13:58:20 -0800
    142 Subject: [sup-talk] sup-mail crash
    143 In-Reply-To: <1234268739-sup-5896@tomsk>
    144 References: <20090201222618.GA6346@acahkos.kisikew.org>
    145 	<zcSrlYwa.1234219306.5754650.tpo2@mail>
    146 	<1234220954-sup-3688@entry> <1234268739-sup-5896@tomsk>
    147 Message-ID: <1234475856-sup-8907@entry>
    148 
    149 Reformatted excerpts from Marcus Williams's message of 2009-02-10:
    150 > I can probably update and get stack trace if its any use.
    151 
    152 Yeah, I'd be interested in this. There are definite mbox problems but I
    153 don't think they are new ones, and they don't involve anything with
    154 hashes AFAIK.
    155 -- 
    156 William <wmorgan-sup at masanjin.net>
    157 
    158 From rick.tessner@gmail.com  Thu Feb 12 17:21:27 2009
    159 From: rick.tessner@gmail.com (Rick Tessner)
    160 Date: Thu, 12 Feb 2009 14:21:27 -0800
    161 Subject: [sup-talk] [PATCH] sup-mail crash
    162 In-Reply-To: <1234475856-sup-8907@entry>
    163 References: <20090201222618.GA6346@acahkos.kisikew.org>
    164 	<zcSrlYwa.1234219306.5754650.tpo2@mail> <1234220954-sup-3688@entry>
    165 	<1234268739-sup-5896@tomsk>  <1234475856-sup-8907@entry>
    166 Message-ID: <1234477287.6877.10.camel@onnadayr.ca>
    167 
    168 On Thu, 2009-02-12 at 13:58 -0800, William Morgan wrote:
    169 > Reformatted excerpts from Marcus Williams's message of 2009-02-10:
    170 > > I can probably update and get stack trace if its any use.
    171 > 
    172 > Yeah, I'd be interested in this. There are definite mbox problems but I
    173 > don't think they are new ones, and they don't involve anything with
    174 > hashes AFAIK.
    175 
    176 Resending since it looks like I only replied to wmorgan originally ...
    177 
    178 I've had this problem occassionally about a "hash modified during
    179 iteration" and I use maildir rather than mbox.
    180 
    181 Attached is a patch to fix that problem.
    182 
    183 -- 
    184 Rick
    185 rick.tessner at gmail.com
    186 -------------- next part --------------
    187 A non-text attachment was scrubbed...
    188 Name: 0001-Fixed-bug-where-exception-would-be-raised-about-hash.patch
    189 Type: application/mbox
    190 Size: 973 bytes
    191 Desc: not available
    192 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090212/1b62cf21/attachment.bin>
    193 
    194 From stipim@rpi.edu  Mon Feb 16 01:44:54 2009
    195 From: stipim@rpi.edu (Michael John Stipicevic)
    196 Date: Mon, 16 Feb 2009 01:44:54 -0500
    197 Subject: [sup-talk] (no subject)
    198 Message-ID: <200902160644.n1G6isMF003158@rmtacc26-la.rcs.rpi.edu>
    199 
    200 >From 9b863d8c86226b3d148e56060092556e2b13a5df Mon Sep 17 00:00:00 2001
    201 From: Mike Stipicevic <stipim at rpi.edu>
    202 Date: Mon, 16 Feb 2009 00:39:50 -0500
    203 Subject: [PATCH] Added UndoManager class
    204 
    205 The UndoManager keeps a list of lambdas that undo actions. It's designed to be used by keypress hooks. It is initialized in the main sup thread along with UpdateManager, etc.
    206 ---
    207  lib/sup.rb                         |    2 +
    208  lib/sup/modes/thread-index-mode.rb |    6 +++++
    209  lib/sup/undo.rb                    |   42 ++++++++++++++++++++++++++++++++++++
    210  3 files changed, 50 insertions(+), 0 deletions(-)
    211  create mode 100644 lib/sup/undo.rb
    212 
    213 diff --git a/lib/sup.rb b/lib/sup.rb
    214 index 93369a5..eda673b 100644
    215 --- a/lib/sup.rb
    216 +++ b/lib/sup.rb
    217 @@ -125,6 +125,7 @@ module Redwood
    218      Redwood::PollManager.new
    219      Redwood::SuicideManager.new Redwood::SUICIDE_FN
    220      Redwood::CryptoManager.new
    221 +    Redwood::UndoManager.new
    222    end
    223  
    224    def finish
    225 @@ -281,6 +282,7 @@ require "sup/tagger"
    226  require "sup/draft"
    227  require "sup/poll"
    228  require "sup/crypto"
    229 +require "sup/undo"
    230  require "sup/horizontal-selector"
    231  require "sup/modes/line-cursor-mode"
    232  require "sup/modes/help-mode"
    233 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    234 index 4de4613..ee30284 100644
    235 --- a/lib/sup/modes/thread-index-mode.rb
    236 +++ b/lib/sup/modes/thread-index-mode.rb
    237 @@ -44,6 +44,7 @@ EOS
    238      k.add :tag_matching, "Tag matching threads", 'g'
    239      k.add :apply_to_tagged, "Apply next command to all tagged threads", ';'
    240      k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
    241 +    k.add :undo, "Undo the previous action", 'u'
    242    end
    243  
    244    def initialize hidden_labels=[], load_thread_opts={}
    245 @@ -83,6 +84,7 @@ EOS
    246  
    247    def reload
    248      drop_all_threads
    249 +    UndoManager.clear
    250      BufferManager.draw_screen
    251      load_threads :num => buffer.content_height
    252    end
    253 @@ -208,6 +210,10 @@ EOS
    254      add_or_unhide m
    255    end
    256  
    257 +  def undo
    258 +    UndoManager.undo
    259 +  end
    260 +
    261    def update
    262      @mutex.synchronize do
    263        ## let's see you do THIS in python
    264 diff --git a/lib/sup/undo.rb b/lib/sup/undo.rb
    265 new file mode 100644
    266 index 0000000..250433d
    267 --- /dev/null
    268 +++ b/lib/sup/undo.rb
    269 @@ -0,0 +1,42 @@
    270 +module Redwood
    271 +
    272 +## Implements a single undo list for the Sup instance
    273 +##
    274 +## The basic idea is to keep a list of lambdas to undo
    275 +## things. When an action is called (such as 'archive'),
    276 +## a lambda is registered with UndoManager that will
    277 +## undo the archival action
    278 +
    279 +class UndoManager
    280 +  include Singleton
    281 +
    282 +  def initialize
    283 +    @@actionlist = []
    284 +    self.class.i_am_the_instance self
    285 +  end
    286 +
    287 +  def register desc, actions
    288 +    actions = [actions] unless actions.is_a?Array
    289 +    raise StandardError, "when would I need to undo 'nothing?'" unless actions.length > 0
    290 +    Redwood::log "registering #{actions.length} actions: #{desc}"
    291 +    @@actionlist.push({:desc => desc, :actions => actions})
    292 +  end
    293 +
    294 +  def undo
    295 +    unless @@actionlist.length == 0 then
    296 +      actionset = @@actionlist.pop
    297 +      Redwood::log "undoing #{actionset[:desc]}..."
    298 +      actionset[:actions].each{|action|
    299 +        action.call
    300 +      }
    301 +      BufferManager.flash "undid #{actionset[:desc]}"
    302 +    else
    303 +      BufferManager.flash "nothing more to undo"
    304 +    end
    305 +  end
    306 +
    307 +  def clear
    308 +    @@actionlist = []
    309 +  end
    310 +end
    311 +end
    312 -- 
    313 1.5.3
    314 
    315 
    316 From stipim@rpi.edu  Mon Feb 16 01:45:00 2009
    317 From: stipim@rpi.edu (Michael John Stipicevic)
    318 Date: Mon, 16 Feb 2009 01:45:00 -0500
    319 Subject: [sup-talk] (no subject)
    320 Message-ID: <200902160645.n1G6j0j7003164@rmtacc26-la.rcs.rpi.edu>
    321 
    322 >From 61a256d09ec8091e5ab44cc4e0e5c9c24c81a4cf Mon Sep 17 00:00:00 2001
    323 From: Mike Stipicevic <stipim at rpi.edu>
    324 Date: Mon, 16 Feb 2009 00:40:39 -0500
    325 Subject: [PATCH] Added undo for archive
    326 
    327 ---
    328  lib/sup/modes/inbox-mode.rb        |   35 +++++++++++++++++++++++++++++++++++
    329  lib/sup/modes/thread-index-mode.rb |   21 +++++++++++++++++++--
    330  2 files changed, 54 insertions(+), 2 deletions(-)
    331 
    332 diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb
    333 index 559892d..21eb9ac 100644
    334 --- a/lib/sup/modes/inbox-mode.rb
    335 +++ b/lib/sup/modes/inbox-mode.rb
    336 @@ -26,12 +26,28 @@ class InboxMode < ThreadIndexMode
    337  
    338    def archive
    339      return unless cursor_thread
    340 +    thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread
    341 +
    342 +    undo = lambda {
    343 +      thread.apply_label :inbox
    344 +      add_or_unhide thread.first
    345 +    }
    346 +    UndoManager.register("archiving thread #{thread.first.id}", undo)
    347 +
    348      cursor_thread.remove_label :inbox
    349      hide_thread cursor_thread
    350      regen_text
    351    end
    352  
    353    def multi_archive threads
    354 +    undo = threads.map {|t|
    355 +             lambda{
    356 +               t.apply_label :inbox
    357 +               add_or_unhide t.first
    358 +             }}
    359 +    UndoManager.register("archiving #{threads.size} #{threads.size.pluralize 'thread'}",
    360 +                         undo << lambda {regen_text} )
    361 +
    362      threads.each do |t|
    363        t.remove_label :inbox
    364        hide_thread t
    365 @@ -41,6 +57,15 @@ class InboxMode < ThreadIndexMode
    366  
    367    def read_and_archive
    368      return unless cursor_thread
    369 +    thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread
    370 +
    371 +    undo = lambda {
    372 +      thread.apply_label :inbox
    373 +      thread.apply_label :unread
    374 +      add_or_unhide thread.first
    375 +    }
    376 +    UndoManager.register("reading and archiving thread ", undo)
    377 +
    378      cursor_thread.remove_label :unread
    379      cursor_thread.remove_label :inbox
    380      hide_thread cursor_thread
    381 @@ -48,6 +73,16 @@ class InboxMode < ThreadIndexMode
    382    end
    383  
    384    def multi_read_and_archive threads
    385 +    undo = threads.map {|t|
    386 +      lambda {
    387 +        t.apply_label :inbox
    388 +        t.apply_label :unread
    389 +        add_or_unhide t.first
    390 +      }
    391 +    }
    392 +    UndoManager.register("reading and archiving #{threads.size} #{threads.size.pluralize 'thread'}",
    393 +                         undo << lambda {regen_text})
    394 +
    395      threads.each do |t|
    396        t.remove_label :unread
    397        t.remove_label :inbox
    398 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    399 index ee30284..120acad 100644
    400 --- a/lib/sup/modes/thread-index-mode.rb
    401 +++ b/lib/sup/modes/thread-index-mode.rb
    402 @@ -259,13 +259,27 @@ EOS
    403    end
    404  
    405    def actually_toggle_archived t
    406 +    thread = t
    407 +    pos = curpos
    408      if t.has_label? :inbox
    409        t.remove_label :inbox
    410 +      undo = lambda {
    411 +        thread.apply_label :inbox
    412 +        update_text_for_line pos
    413 +        UpdateManager.relay self,:unarchived, thread.first
    414 +      }
    415        UpdateManager.relay self, :archived, t.first
    416      else
    417        t.apply_label :inbox
    418 +      undo = lambda {
    419 +        thread.remove_label :inbox
    420 +        update_text_for_line pos
    421 +        UpdateManager.relay self, :unarchived, thread.first
    422 +      }
    423        UpdateManager.relay self, :unarchived, t.first
    424      end
    425 +
    426 +    return undo
    427    end
    428  
    429    def actually_toggle_spammed t
    430 @@ -290,12 +304,15 @@ EOS
    431  
    432    def toggle_archived 
    433      t = cursor_thread or return
    434 -    actually_toggle_archived t
    435 +    undo = [actually_toggle_archived(t), lambda {self.update_text_for_line curpos}]
    436 +    UndoManager.register("deleting/undeleting thread #{t.first.id}",undo)
    437      update_text_for_line curpos
    438    end
    439  
    440    def multi_toggle_archived threads
    441 -    threads.each { |t| actually_toggle_archived t }
    442 +    undo = threads.map { |t| actually_toggle_archived t}
    443 +    UndoManager.register("deleting/undeleting #{threads.size} #{threads.size.pluralize 'thread'}",
    444 +                         undo << lambda {self.regen_text})
    445      regen_text
    446    end
    447  
    448 -- 
    449 1.5.3
    450 
    451 
    452 From stipim@rpi.edu  Mon Feb 16 01:45:04 2009
    453 From: stipim@rpi.edu (Michael John Stipicevic)
    454 Date: Mon, 16 Feb 2009 01:45:04 -0500
    455 Subject: [sup-talk] (no subject)
    456 Message-ID: <200902160645.n1G6j4hf003172@rmtacc26-la.rcs.rpi.edu>
    457 
    458 >From e42299ce17ed7c12989d0c8a6dea2ed100921e4a Mon Sep 17 00:00:00 2001
    459 From: Mike Stipicevic <stipim at rpi.edu>
    460 Date: Mon, 16 Feb 2009 00:03:57 -0500
    461 Subject: [PATCH] Added undo for starring
    462 
    463 ---
    464  lib/sup/modes/thread-index-mode.rb |   21 +++++++++++++++++++--
    465  1 files changed, 19 insertions(+), 2 deletions(-)
    466 
    467 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    468 index 120acad..62fdb85 100644
    469 --- a/lib/sup/modes/thread-index-mode.rb
    470 +++ b/lib/sup/modes/thread-index-mode.rb
    471 @@ -237,24 +237,41 @@ EOS
    472    end
    473  
    474    def actually_toggle_starred t
    475 +    thread = t # cargo cult programming
    476 +    pos = curpos
    477      if t.has_label? :starred # if ANY message has a star
    478 +      undo = lambda {
    479 +        thread.first.add_label :starred
    480 +        update_text_for_line pos
    481 +        UpdateManager.relay self, :starred, thread.first
    482 +      }
    483        t.remove_label :starred # remove from all
    484        UpdateManager.relay self, :unstarred, t.first
    485      else
    486 +      undo = lambda {
    487 +        thread.remove_label :starred
    488 +        update_text_for_line pos
    489 +        UpdateManager.relay self, :unstarred, thread.first
    490 +      }
    491        t.first.add_label :starred # add only to first
    492        UpdateManager.relay self, :starred, t.first
    493      end
    494 +
    495 +    return undo
    496    end  
    497  
    498    def toggle_starred 
    499      t = cursor_thread or return
    500 -    actually_toggle_starred t
    501 +    undo = actually_toggle_starred t
    502 +    UndoManager.register("starring/unstarring thread #{t.first.id}",undo)
    503      update_text_for_line curpos
    504      cursor_down
    505    end
    506  
    507    def multi_toggle_starred threads
    508 -    threads.each { |t| actually_toggle_starred t }
    509 +    undo = threads.map { |t| actually_toggle_starred t }
    510 +    UndoManager.register("starring/unstarring #{threads.size} #{threads.size.pluralize 'thread'}",
    511 +                         undo)
    512      regen_text
    513    end
    514  
    515 -- 
    516 1.5.3
    517 
    518 
    519 From stipim@rpi.edu  Mon Feb 16 01:45:08 2009
    520 From: stipim@rpi.edu (Michael John Stipicevic)
    521 Date: Mon, 16 Feb 2009 01:45:08 -0500
    522 Subject: [sup-talk] (no subject)
    523 Message-ID: <200902160645.n1G6j8o5003178@rmtacc26-la.rcs.rpi.edu>
    524 
    525 >From 31bb0fd8f6e701107ce79ad2dbd9d42da4635742 Mon Sep 17 00:00:00 2001
    526 From: Mike Stipicevic <stipim at rpi.edu>
    527 Date: Mon, 16 Feb 2009 00:06:36 -0500
    528 Subject: [PATCH] Added undo for spam
    529 
    530 ---
    531  lib/sup/modes/thread-index-mode.rb |   22 ++++++++++++++++++----
    532  1 files changed, 18 insertions(+), 4 deletions(-)
    533 
    534 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    535 index 62fdb85..1e02b5b 100644
    536 --- a/lib/sup/modes/thread-index-mode.rb
    537 +++ b/lib/sup/modes/thread-index-mode.rb
    538 @@ -300,13 +300,28 @@ EOS
    539    end
    540  
    541    def actually_toggle_spammed t
    542 +    thread = t
    543      if t.has_label? :spam
    544 +      undo = lambda {
    545 +        thread.apply_label :spam
    546 +        self.hide_thread thread
    547 +        UpdateManager.relay self,:spammed, thread.first
    548 +      }
    549        t.remove_label :spam
    550 +      add_or_unhide t.first
    551        UpdateManager.relay self, :unspammed, t.first
    552      else
    553 +      undo = lambda {
    554 +        thread.remove_label :spam
    555 +        add_or_unhide thread.first
    556 +        UpdateManager.relay self,:unspammed, thread.first
    557 +      }
    558        t.apply_label :spam
    559 +      hide_thread t
    560        UpdateManager.relay self, :spammed, t.first
    561      end
    562 +
    563 +    return undo
    564    end
    565  
    566    def actually_toggle_deleted t
    567 @@ -390,10 +405,9 @@ EOS
    568    ## see deleted or spam emails, and when you undelete or unspam them
    569    ## you also want them to disappear immediately.
    570    def multi_toggle_spam threads
    571 -    threads.each do |t|
    572 -      actually_toggle_spammed t
    573 -      hide_thread t 
    574 -    end
    575 +    undo = threads.map{ |t| actually_toggle_spammed t}
    576 +    UndoManager.register("marking/unmarking #{threads.size} #{threads.size.pluralize 'thread'} as spam",
    577 +                         undo <<  lambda {self.regen_text})
    578      regen_text
    579    end
    580  
    581 -- 
    582 1.5.3
    583 
    584 
    585 From stipim@rpi.edu  Mon Feb 16 01:45:13 2009
    586 From: stipim@rpi.edu (Michael John Stipicevic)
    587 Date: Mon, 16 Feb 2009 01:45:13 -0500
    588 Subject: [sup-talk] (no subject)
    589 Message-ID: <200902160645.n1G6jDOn003184@rmtacc26-la.rcs.rpi.edu>
    590 
    591 >From d1b5ff3d022e0e6aeabf410b0778fd11a5449ed0 Mon Sep 17 00:00:00 2001
    592 From: Mike Stipicevic <stipim at rpi.edu>
    593 Date: Mon, 16 Feb 2009 00:08:03 -0500
    594 Subject: [PATCH] Added undo for thread deletion
    595 
    596 ---
    597  lib/sup/modes/thread-index-mode.rb |   21 +++++++++++++++++----
    598  1 files changed, 17 insertions(+), 4 deletions(-)
    599 
    600 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    601 index 1e02b5b..ae7c299 100644
    602 --- a/lib/sup/modes/thread-index-mode.rb
    603 +++ b/lib/sup/modes/thread-index-mode.rb
    604 @@ -326,12 +326,26 @@ EOS
    605  
    606    def actually_toggle_deleted t
    607      if t.has_label? :deleted
    608 +      undo = lambda {
    609 +        t.apply_label :deleted
    610 +        hide_thread t
    611 +        UpdateManager.relay self, :deleted, t.first
    612 +      }
    613        t.remove_label :deleted
    614 +      add_or_unhide t.first
    615        UpdateManager.relay self, :undeleted, t.first
    616      else
    617 +      undo = lambda {
    618 +        t.remove_label :deleted
    619 +        add_or_unhide t.first
    620 +        UpdateManager.relay self, :undeleted, t.first
    621 +      }
    622        t.apply_label :deleted
    623 +  hide_thread t
    624        UpdateManager.relay self, :deleted, t.first
    625      end
    626 +
    627 +    return undo
    628    end
    629  
    630    def toggle_archived 
    631 @@ -418,10 +432,9 @@ EOS
    632  
    633    ## see comment for multi_toggle_spam
    634    def multi_toggle_deleted threads
    635 -    threads.each do |t|
    636 -      actually_toggle_deleted t
    637 -      hide_thread t 
    638 -    end
    639 +    undo = threads.map{ |t| actually_toggle_deleted t}
    640 +    UndoManager.register("deleting/undeleting #{threads.size} #{threads.size.pluralize 'thread'}",
    641 +                         undo << lambda {regen_text})
    642      regen_text
    643    end
    644  
    645 -- 
    646 1.5.3
    647 
    648 
    649 From stipim@rpi.edu  Mon Feb 16 01:45:43 2009
    650 From: stipim@rpi.edu (Michael John Stipicevic)
    651 Date: Mon, 16 Feb 2009 01:45:43 -0500
    652 Subject: [sup-talk] (no subject)
    653 Message-ID: <200902160645.n1G6jhQK003190@rmtacc26-la.rcs.rpi.edu>
    654 
    655 >From 9a5ac47e979de8030756b88d4e52b6d8a289a25a Mon Sep 17 00:00:00 2001
    656 From: Mike Stipicevic <stipim at rpi.edu>
    657 Date: Mon, 16 Feb 2009 00:10:32 -0500
    658 Subject: [PATCH] Added undo for delete thread
    659 
    660 ---
    661  lib/sup/modes/thread-index-mode.rb |    9 ++++++++-
    662  1 files changed, 8 insertions(+), 1 deletions(-)
    663 
    664 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    665 index ae7c299..159839d 100644
    666 --- a/lib/sup/modes/thread-index-mode.rb
    667 +++ b/lib/sup/modes/thread-index-mode.rb
    668 @@ -443,11 +443,18 @@ EOS
    669      multi_kill [t]
    670    end
    671  
    672 +  ## m-m-m-m-MULTI-KILL
    673    def multi_kill threads
    674 -    threads.each do |t|
    675 +    undo = threads.map do |t|
    676        t.apply_label :killed
    677        hide_thread t
    678 +      thread = t
    679 +      lambda { thread.remove_label :killed
    680 +        add_or_unhide thread.first
    681 +      }
    682      end
    683 +    UndoManager.register("killing #{threads.size} #{threads.size.pluralize 'thread'}",
    684 +                         undo << lambda {regen_text})
    685      regen_text
    686      BufferManager.flash "#{threads.size.pluralize 'Thread'} killed."
    687    end
    688 -- 
    689 1.5.3
    690 
    691 
    692 From stipim@rpi.edu  Mon Feb 16 01:45:47 2009
    693 From: stipim@rpi.edu (Michael John Stipicevic)
    694 Date: Mon, 16 Feb 2009 01:45:47 -0500
    695 Subject: [sup-talk] (no subject)
    696 Message-ID: <200902160645.n1G6jlqS003196@rmtacc26-la.rcs.rpi.edu>
    697 
    698 >From 1fd41c30189db832abb54f1cda416d0aa624e028 Mon Sep 17 00:00:00 2001
    699 From: Mike Stipicevic <stipim at rpi.edu>
    700 Date: Mon, 16 Feb 2009 00:11:28 -0500
    701 Subject: [PATCH] Added undo for label edit
    702 
    703 ---
    704  lib/sup/modes/thread-index-mode.rb |   27 +++++++++++++++++++++++++--
    705  1 files changed, 25 insertions(+), 2 deletions(-)
    706 
    707 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    708 index 159839d..f28302b 100644
    709 --- a/lib/sup/modes/thread-index-mode.rb
    710 +++ b/lib/sup/modes/thread-index-mode.rb
    711 @@ -509,6 +509,10 @@ EOS
    712    def edit_labels
    713      thread = cursor_thread or return
    714      speciall = (@hidden_labels + LabelManager::RESERVED_LABELS).uniq
    715 +
    716 +    old_labels = thread.labels
    717 +    pos = curpos
    718 +
    719      keepl, modifyl = thread.labels.partition { |t| speciall.member? t }
    720  
    721      user_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", modifyl, @hidden_labels
    722 @@ -517,6 +521,15 @@ EOS
    723      thread.labels = keepl + user_labels
    724      user_labels.each { |l| LabelManager << l }
    725      update_text_for_line curpos
    726 +
    727 +    undo = lambda{
    728 +      thread.labels = old_labels
    729 +      update_text_for_line pos
    730 +      UpdateManager.relay self, :labeled, thread.first
    731 +    }
    732 +
    733 +    UndoManager.register("labeling thread #{thread.first.id}", undo)
    734 +
    735      UpdateManager.relay self, :labeled, thread.first
    736    end
    737  
    738 @@ -526,8 +539,18 @@ EOS
    739      
    740      hl = user_labels.select { |l| @hidden_labels.member? l }
    741      if hl.empty?
    742 -      threads.each { |t| user_labels.each { |l| t.apply_label l } }
    743 -      user_labels.each { |l| LabelManager << l }
    744 +      undo = threads.map { |t| old_labels = t.labels
    745 +        user_labels.each { |l| t.apply_label l }
    746 +        ## UpdateManager or some other regresh mechanism?
    747 +        UpdateManager.relay self, :labeled, t.first
    748 +        lambda {
    749 +          t.labels = old_labels
    750 +          UpdateManager.relay self, :labeled, t.first
    751 +        }
    752 +      }
    753 +    user_labels.each { |l| LabelManager << l }
    754 +    UndoManager.register("labeling #{threads.size} #{threads.size.pluralize 'thread'}",
    755 +                         undo << lambda { regen_text})
    756      else
    757        BufferManager.flash "'#{hl}' is a reserved label!"
    758      end
    759 -- 
    760 1.5.3
    761 
    762 
    763 From stipim@rpi.edu  Mon Feb 16 01:45:51 2009
    764 From: stipim@rpi.edu (Michael John Stipicevic)
    765 Date: Mon, 16 Feb 2009 01:45:51 -0500
    766 Subject: [sup-talk] (no subject)
    767 Message-ID: <200902160645.n1G6jpBe003202@rmtacc26-la.rcs.rpi.edu>
    768 
    769 >From e7abf80a590aa2f2de35343fceecea9deae41193 Mon Sep 17 00:00:00 2001
    770 From: Mike Stipicevic <stipim at rpi.edu>
    771 Date: Mon, 16 Feb 2009 00:11:46 -0500
    772 Subject: [PATCH] Changed README to reflect addition of undo
    773 
    774 ---
    775  README.txt |    2 +-
    776  1 files changed, 1 insertions(+), 1 deletions(-)
    777 
    778 diff --git a/README.txt b/README.txt
    779 index 1b2b516..05349d7 100644
    780 --- a/README.txt
    781 +++ b/README.txt
    782 @@ -80,7 +80,7 @@ Current limitations which will be fixed:
    783  - Unix-centrism in MIME attachment handling and in sendmail
    784    invocation.
    785  
    786 -- Several obvious missing features, like undo, filters / saved
    787 +- Several obvious missing features, like filters / saved
    788    searches, message annotations, etc.
    789  
    790  == SYNOPSYS:
    791 -- 
    792 1.5.3
    793 
    794 
    795 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    796 From: stipim@rpi.edu (Michael John Stipicevic)
    797 Date: Mon, 16 Feb 2009 01:25:59 -0500
    798 Subject: [sup-talk] (no subject)
    799 Message-ID: <200902160625.n1G6PxM4003065@rmtacc26-la.rcs.rpi.edu>
    800 
    801 
    802 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    803 From: stipim@rpi.edu (Michael John Stipicevic)
    804 Date: Mon, 16 Feb 2009 01:25:59 -0500
    805 Subject: [sup-talk] (no subject)
    806 Message-ID: <200902160625.n1G6PxC7003062@rmtacc26-la.rcs.rpi.edu>
    807 
    808 
    809 From stipim@rpi.edu  Mon Feb 16 01:21:50 2009
    810 From: stipim@rpi.edu (Mike Stipicevic)
    811 Date: Mon, 16 Feb 2009 01:21:50 -0500
    812 Subject: [sup-talk] undo
    813 Message-ID: <1234764952-sup-604@rmtacc25-lb.rcs.rpi.edu>
    814 
    815 Hey,
    816 
    817 I've added basic undo for sup-the-client. It's mostly centered around labelling (including archiving, spam, etc). It currently does not handle thread-joining, contacts or anything outside of the thread/inbox view.
    818 
    819 I wasn't sure how to organize my patches, so I apologize if I've split them, into too many.
    820 
    821 Thanks,
    822 - Mike
    823 -- 
    824 Mike Stipicevic
    825 RPI EE/CSYS Class of '09
    826 
    827 stipim at rpi.edu
    828 mstipicevic at ieee.org
    829 
    830 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    831 From: stipim@rpi.edu (Michael John Stipicevic)
    832 Date: Mon, 16 Feb 2009 01:25:59 -0500
    833 Subject: [sup-talk] (no subject)
    834 Message-ID: <200902160625.n1G6PxRO003067@rmtacc26-la.rcs.rpi.edu>
    835 
    836 
    837 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    838 From: stipim@rpi.edu (Michael John Stipicevic)
    839 Date: Mon, 16 Feb 2009 01:25:59 -0500
    840 Subject: [sup-talk] (no subject)
    841 Message-ID: <200902160625.n1G6PxxJ003055@rmtacc26-la.rcs.rpi.edu>
    842 
    843 
    844 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    845 From: stipim@rpi.edu (Michael John Stipicevic)
    846 Date: Mon, 16 Feb 2009 01:25:59 -0500
    847 Subject: [sup-talk] (no subject)
    848 Message-ID: <200902160625.n1G6PxGV003071@rmtacc26-la.rcs.rpi.edu>
    849 
    850 
    851 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    852 From: stipim@rpi.edu (Michael John Stipicevic)
    853 Date: Mon, 16 Feb 2009 01:25:59 -0500
    854 Subject: [sup-talk] (no subject)
    855 Message-ID: <200902160625.n1G6PxBe003074@rmtacc26-la.rcs.rpi.edu>
    856 
    857 
    858 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    859 From: stipim@rpi.edu (Michael John Stipicevic)
    860 Date: Mon, 16 Feb 2009 01:25:59 -0500
    861 Subject: [sup-talk] (no subject)
    862 Message-ID: <200902160625.n1G6PxMd003053@rmtacc26-la.rcs.rpi.edu>
    863 
    864 
    865 From stipim@rpi.edu  Mon Feb 16 01:25:59 2009
    866 From: stipim@rpi.edu (Michael John Stipicevic)
    867 Date: Mon, 16 Feb 2009 01:25:59 -0500
    868 Subject: [sup-talk] (no subject)
    869 Message-ID: <200902160625.n1G6PxLo003059@rmtacc26-la.rcs.rpi.edu>
    870 
    871 
    872 From stipim@rpi.edu  Mon Feb 16 01:27:00 2009
    873 From: stipim@rpi.edu (Michael John Stipicevic)
    874 Date: Mon, 16 Feb 2009 01:27:00 -0500
    875 Subject: [sup-talk] (no subject)
    876 Message-ID: <200902160627.n1G6R0ZG003126@rmtacc26-la.rcs.rpi.edu>
    877 
    878 >From 9b863d8c86226b3d148e56060092556e2b13a5df Mon Sep 17 00:00:00 2001
    879 From: Mike Stipicevic <stipim at rpi.edu>
    880 Date: Mon, 16 Feb 2009 00:39:50 -0500
    881 Subject: [PATCH] Added UndoManager class
    882 
    883 The UndoManager keeps a list of lambdas that undo actions. It's designed to be used by keypress hooks. It is initialized in the main sup thread along with UpdateManager, etc.
    884 ---
    885  lib/sup.rb                         |    2 +
    886  lib/sup/modes/thread-index-mode.rb |    6 +++++
    887  lib/sup/undo.rb                    |   42 ++++++++++++++++++++++++++++++++++++
    888  3 files changed, 50 insertions(+), 0 deletions(-)
    889  create mode 100644 lib/sup/undo.rb
    890 
    891 diff --git a/lib/sup.rb b/lib/sup.rb
    892 index 93369a5..eda673b 100644
    893 --- a/lib/sup.rb
    894 +++ b/lib/sup.rb
    895 @@ -125,6 +125,7 @@ module Redwood
    896      Redwood::PollManager.new
    897      Redwood::SuicideManager.new Redwood::SUICIDE_FN
    898      Redwood::CryptoManager.new
    899 +    Redwood::UndoManager.new
    900    end
    901  
    902    def finish
    903 @@ -281,6 +282,7 @@ require "sup/tagger"
    904  require "sup/draft"
    905  require "sup/poll"
    906  require "sup/crypto"
    907 +require "sup/undo"
    908  require "sup/horizontal-selector"
    909  require "sup/modes/line-cursor-mode"
    910  require "sup/modes/help-mode"
    911 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
    912 index 4de4613..ee30284 100644
    913 --- a/lib/sup/modes/thread-index-mode.rb
    914 +++ b/lib/sup/modes/thread-index-mode.rb
    915 @@ -44,6 +44,7 @@ EOS
    916      k.add :tag_matching, "Tag matching threads", 'g'
    917      k.add :apply_to_tagged, "Apply next command to all tagged threads", ';'
    918      k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
    919 +    k.add :undo, "Undo the previous action", 'u'
    920    end
    921  
    922    def initialize hidden_labels=[], load_thread_opts={}
    923 @@ -83,6 +84,7 @@ EOS
    924  
    925    def reload
    926      drop_all_threads
    927 +    UndoManager.clear
    928      BufferManager.draw_screen
    929      load_threads :num => buffer.content_height
    930    end
    931 @@ -208,6 +210,10 @@ EOS
    932      add_or_unhide m
    933    end
    934  
    935 +  def undo
    936 +    UndoManager.undo
    937 +  end
    938 +
    939    def update
    940      @mutex.synchronize do
    941        ## let's see you do THIS in python
    942 diff --git a/lib/sup/undo.rb b/lib/sup/undo.rb
    943 new file mode 100644
    944 index 0000000..250433d
    945 --- /dev/null
    946 +++ b/lib/sup/undo.rb
    947 @@ -0,0 +1,42 @@
    948 +module Redwood
    949 +
    950 +## Implements a single undo list for the Sup instance
    951 +##
    952 +## The basic idea is to keep a list of lambdas to undo
    953 +## things. When an action is called (such as 'archive'),
    954 +## a lambda is registered with UndoManager that will
    955 +## undo the archival action
    956 +
    957 +class UndoManager
    958 +  include Singleton
    959 +
    960 +  def initialize
    961 +    @@actionlist = []
    962 +    self.class.i_am_the_instance self
    963 +  end
    964 +
    965 +  def register desc, actions
    966 +    actions = [actions] unless actions.is_a?Array
    967 +    raise StandardError, "when would I need to undo 'nothing?'" unless actions.length > 0
    968 +    Redwood::log "registering #{actions.length} actions: #{desc}"
    969 +    @@actionlist.push({:desc => desc, :actions => actions})
    970 +  end
    971 +
    972 +  def undo
    973 +    unless @@actionlist.length == 0 then
    974 +      actionset = @@actionlist.pop
    975 +      Redwood::log "undoing #{actionset[:desc]}..."
    976 +      actionset[:actions].each{|action|
    977 +        action.call
    978 +      }
    979 +      BufferManager.flash "undid #{actionset[:desc]}"
    980 +    else
    981 +      BufferManager.flash "nothing more to undo"
    982 +    end
    983 +  end
    984 +
    985 +  def clear
    986 +    @@actionlist = []
    987 +  end
    988 +end
    989 +end
    990 -- 
    991 1.5.3
    992 
    993 >From 61a256d09ec8091e5ab44cc4e0e5c9c24c81a4cf Mon Sep 17 00:00:00 2001
    994 From: Mike Stipicevic <stipim at rpi.edu>
    995 Date: Mon, 16 Feb 2009 00:40:39 -0500
    996 Subject: [PATCH] Added undo for archive
    997 
    998 ---
    999  lib/sup/modes/inbox-mode.rb        |   35 +++++++++++++++++++++++++++++++++++
   1000  lib/sup/modes/thread-index-mode.rb |   21 +++++++++++++++++++--
   1001  2 files changed, 54 insertions(+), 2 deletions(-)
   1002 
   1003 diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb
   1004 index 559892d..21eb9ac 100644
   1005 --- a/lib/sup/modes/inbox-mode.rb
   1006 +++ b/lib/sup/modes/inbox-mode.rb
   1007 @@ -26,12 +26,28 @@ class InboxMode < ThreadIndexMode
   1008  
   1009    def archive
   1010      return unless cursor_thread
   1011 +    thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread
   1012 +
   1013 +    undo = lambda {
   1014 +      thread.apply_label :inbox
   1015 +      add_or_unhide thread.first
   1016 +    }
   1017 +    UndoManager.register("archiving thread #{thread.first.id}", undo)
   1018 +
   1019      cursor_thread.remove_label :inbox
   1020      hide_thread cursor_thread
   1021      regen_text
   1022    end
   1023  
   1024    def multi_archive threads
   1025 +    undo = threads.map {|t|
   1026 +             lambda{
   1027 +               t.apply_label :inbox
   1028 +               add_or_unhide t.first
   1029 +             }}
   1030 +    UndoManager.register("archiving #{threads.size} #{threads.size.pluralize 'thread'}",
   1031 +                         undo << lambda {regen_text} )
   1032 +
   1033      threads.each do |t|
   1034        t.remove_label :inbox
   1035        hide_thread t
   1036 @@ -41,6 +57,15 @@ class InboxMode < ThreadIndexMode
   1037  
   1038    def read_and_archive
   1039      return unless cursor_thread
   1040 +    thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread
   1041 +
   1042 +    undo = lambda {
   1043 +      thread.apply_label :inbox
   1044 +      thread.apply_label :unread
   1045 +      add_or_unhide thread.first
   1046 +    }
   1047 +    UndoManager.register("reading and archiving thread ", undo)
   1048 +
   1049      cursor_thread.remove_label :unread
   1050      cursor_thread.remove_label :inbox
   1051      hide_thread cursor_thread
   1052 @@ -48,6 +73,16 @@ class InboxMode < ThreadIndexMode
   1053    end
   1054  
   1055    def multi_read_and_archive threads
   1056 +    undo = threads.map {|t|
   1057 +      lambda {
   1058 +        t.apply_label :inbox
   1059 +        t.apply_label :unread
   1060 +        add_or_unhide t.first
   1061 +      }
   1062 +    }
   1063 +    UndoManager.register("reading and archiving #{threads.size} #{threads.size.pluralize 'thread'}",
   1064 +                         undo << lambda {regen_text})
   1065 +
   1066      threads.each do |t|
   1067        t.remove_label :unread
   1068        t.remove_label :inbox
   1069 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
   1070 index ee30284..120acad 100644
   1071 --- a/lib/sup/modes/thread-index-mode.rb
   1072 +++ b/lib/sup/modes/thread-index-mode.rb
   1073 @@ -259,13 +259,27 @@ EOS
   1074    end
   1075  
   1076    def actually_toggle_archived t
   1077 +    thread = t
   1078 +    pos = curpos
   1079      if t.has_label? :inbox
   1080        t.remove_label :inbox
   1081 +      undo = lambda {
   1082 +        thread.apply_label :inbox
   1083 +        update_text_for_line pos
   1084 +        UpdateManager.relay self,:unarchived, thread.first
   1085 +      }
   1086        UpdateManager.relay self, :archived, t.first
   1087      else
   1088        t.apply_label :inbox
   1089 +      undo = lambda {
   1090 +        thread.remove_label :inbox
   1091 +        update_text_for_line pos
   1092 +        UpdateManager.relay self, :unarchived, thread.first
   1093 +      }
   1094        UpdateManager.relay self, :unarchived, t.first
   1095      end
   1096 +
   1097 +    return undo
   1098    end
   1099  
   1100    def actually_toggle_spammed t
   1101 @@ -290,12 +304,15 @@ EOS
   1102  
   1103    def toggle_archived 
   1104      t = cursor_thread or return
   1105 -    actually_toggle_archived t
   1106 +    undo = [actually_toggle_archived(t), lambda {self.update_text_for_line curpos}]
   1107 +    UndoManager.register("deleting/undeleting thread #{t.first.id}",undo)
   1108      update_text_for_line curpos
   1109    end
   1110  
   1111    def multi_toggle_archived threads
   1112 -    threads.each { |t| actually_toggle_archived t }
   1113 +    undo = threads.map { |t| actually_toggle_archived t}
   1114 +    UndoManager.register("deleting/undeleting #{threads.size} #{threads.size.pluralize 'thread'}",
   1115 +                         undo << lambda {self.regen_text})
   1116      regen_text
   1117    end
   1118  
   1119 -- 
   1120 1.5.3
   1121 
   1122 >From e42299ce17ed7c12989d0c8a6dea2ed100921e4a Mon Sep 17 00:00:00 2001
   1123 From: Mike Stipicevic <stipim at rpi.edu>
   1124 Date: Mon, 16 Feb 2009 00:03:57 -0500
   1125 Subject: [PATCH] Added undo for starring
   1126 
   1127 ---
   1128  lib/sup/modes/thread-index-mode.rb |   21 +++++++++++++++++++--
   1129  1 files changed, 19 insertions(+), 2 deletions(-)
   1130 
   1131 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
   1132 index 120acad..62fdb85 100644
   1133 --- a/lib/sup/modes/thread-index-mode.rb
   1134 +++ b/lib/sup/modes/thread-index-mode.rb
   1135 @@ -237,24 +237,41 @@ EOS
   1136    end
   1137  
   1138    def actually_toggle_starred t
   1139 +    thread = t # cargo cult programming
   1140 +    pos = curpos
   1141      if t.has_label? :starred # if ANY message has a star
   1142 +      undo = lambda {
   1143 +        thread.first.add_label :starred
   1144 +        update_text_for_line pos
   1145 +        UpdateManager.relay self, :starred, thread.first
   1146 +      }
   1147        t.remove_label :starred # remove from all
   1148        UpdateManager.relay self, :unstarred, t.first
   1149      else
   1150 +      undo = lambda {
   1151 +        thread.remove_label :starred
   1152 +        update_text_for_line pos
   1153 +        UpdateManager.relay self, :unstarred, thread.first
   1154 +      }
   1155        t.first.add_label :starred # add only to first
   1156        UpdateManager.relay self, :starred, t.first
   1157      end
   1158 +
   1159 +    return undo
   1160    end  
   1161  
   1162    def toggle_starred 
   1163      t = cursor_thread or return
   1164 -    actually_toggle_starred t
   1165 +    undo = actually_toggle_starred t
   1166 +    UndoManager.register("starring/unstarring thread #{t.first.id}",undo)
   1167      update_text_for_line curpos
   1168      cursor_down
   1169    end
   1170  
   1171    def multi_toggle_starred threads
   1172 -    threads.each { |t| actually_toggle_starred t }
   1173 +    undo = threads.map { |t| actually_toggle_starred t }
   1174 +    UndoManager.register("starring/unstarring #{threads.size} #{threads.size.pluralize 'thread'}",
   1175 +                         undo)
   1176      regen_text
   1177    end
   1178  
   1179 -- 
   1180 1.5.3
   1181 
   1182 >From 31bb0fd8f6e701107ce79ad2dbd9d42da4635742 Mon Sep 17 00:00:00 2001
   1183 From: Mike Stipicevic <stipim at rpi.edu>
   1184 Date: Mon, 16 Feb 2009 00:06:36 -0500
   1185 Subject: [PATCH] Added undo for spam
   1186 
   1187 ---
   1188  lib/sup/modes/thread-index-mode.rb |   22 ++++++++++++++++++----
   1189  1 files changed, 18 insertions(+), 4 deletions(-)
   1190 
   1191 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
   1192 index 62fdb85..1e02b5b 100644
   1193 --- a/lib/sup/modes/thread-index-mode.rb
   1194 +++ b/lib/sup/modes/thread-index-mode.rb
   1195 @@ -300,13 +300,28 @@ EOS
   1196    end
   1197  
   1198    def actually_toggle_spammed t
   1199 +    thread = t
   1200      if t.has_label? :spam
   1201 +      undo = lambda {
   1202 +        thread.apply_label :spam
   1203 +        self.hide_thread thread
   1204 +        UpdateManager.relay self,:spammed, thread.first
   1205 +      }
   1206        t.remove_label :spam
   1207 +      add_or_unhide t.first
   1208        UpdateManager.relay self, :unspammed, t.first
   1209      else
   1210 +      undo = lambda {
   1211 +        thread.remove_label :spam
   1212 +        add_or_unhide thread.first
   1213 +        UpdateManager.relay self,:unspammed, thread.first
   1214 +      }
   1215        t.apply_label :spam
   1216 +      hide_thread t
   1217        UpdateManager.relay self, :spammed, t.first
   1218      end
   1219 +
   1220 +    return undo
   1221    end
   1222  
   1223    def actually_toggle_deleted t
   1224 @@ -390,10 +405,9 @@ EOS
   1225    ## see deleted or spam emails, and when you undelete or unspam them
   1226    ## you also want them to disappear immediately.
   1227    def multi_toggle_spam threads
   1228 -    threads.each do |t|
   1229 -      actually_toggle_spammed t
   1230 -      hide_thread t 
   1231 -    end
   1232 +    undo = threads.map{ |t| actually_toggle_spammed t}
   1233 +    UndoManager.register("marking/unmarking #{threads.size} #{threads.size.pluralize 'thread'} as spam",
   1234 +                         undo <<  lambda {self.regen_text})
   1235      regen_text
   1236    end
   1237  
   1238 -- 
   1239 1.5.3
   1240 
   1241 >From d1b5ff3d022e0e6aeabf410b0778fd11a5449ed0 Mon Sep 17 00:00:00 2001
   1242 From: Mike Stipicevic <stipim at rpi.edu>
   1243 Date: Mon, 16 Feb 2009 00:08:03 -0500
   1244 Subject: [PATCH] Added undo for thread deletion
   1245 
   1246 ---
   1247  lib/sup/modes/thread-index-mode.rb |   21 +++++++++++++++++----
   1248  1 files changed, 17 insertions(+), 4 deletions(-)
   1249 
   1250 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
   1251 index 1e02b5b..ae7c299 100644
   1252 --- a/lib/sup/modes/thread-index-mode.rb
   1253 +++ b/lib/sup/modes/thread-index-mode.rb
   1254 @@ -326,12 +326,26 @@ EOS
   1255  
   1256    def actually_toggle_deleted t
   1257      if t.has_label? :deleted
   1258 +      undo = lambda {
   1259 +        t.apply_label :deleted
   1260 +        hide_thread t
   1261 +        UpdateManager.relay self, :deleted, t.first
   1262 +      }
   1263        t.remove_label :deleted
   1264 +      add_or_unhide t.first
   1265        UpdateManager.relay self, :undeleted, t.first
   1266      else
   1267 +      undo = lambda {
   1268 +        t.remove_label :deleted
   1269 +        add_or_unhide t.first
   1270 +        UpdateManager.relay self, :undeleted, t.first
   1271 +      }
   1272        t.apply_label :deleted
   1273 +  hide_thread t
   1274        UpdateManager.relay self, :deleted, t.first
   1275      end
   1276 +
   1277 +    return undo
   1278    end
   1279  
   1280    def toggle_archived 
   1281 @@ -418,10 +432,9 @@ EOS
   1282  
   1283    ## see comment for multi_toggle_spam
   1284    def multi_toggle_deleted threads
   1285 -    threads.each do |t|
   1286 -      actually_toggle_deleted t
   1287 -      hide_thread t 
   1288 -    end
   1289 +    undo = threads.map{ |t| actually_toggle_deleted t}
   1290 +    UndoManager.register("deleting/undeleting #{threads.size} #{threads.size.pluralize 'thread'}",
   1291 +                         undo << lambda {regen_text})
   1292      regen_text
   1293    end
   1294  
   1295 -- 
   1296 1.5.3
   1297 
   1298 >From 9a5ac47e979de8030756b88d4e52b6d8a289a25a Mon Sep 17 00:00:00 2001
   1299 From: Mike Stipicevic <stipim at rpi.edu>
   1300 Date: Mon, 16 Feb 2009 00:10:32 -0500
   1301 Subject: [PATCH] Added undo for delete thread
   1302 
   1303 ---
   1304  lib/sup/modes/thread-index-mode.rb |    9 ++++++++-
   1305  1 files changed, 8 insertions(+), 1 deletions(-)
   1306 
   1307 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
   1308 index ae7c299..159839d 100644
   1309 --- a/lib/sup/modes/thread-index-mode.rb
   1310 +++ b/lib/sup/modes/thread-index-mode.rb
   1311 @@ -443,11 +443,18 @@ EOS
   1312      multi_kill [t]
   1313    end
   1314  
   1315 +  ## m-m-m-m-MULTI-KILL
   1316    def multi_kill threads
   1317 -    threads.each do |t|
   1318 +    undo = threads.map do |t|
   1319        t.apply_label :killed
   1320        hide_thread t
   1321 +      thread = t
   1322 +      lambda { thread.remove_label :killed
   1323 +        add_or_unhide thread.first
   1324 +      }
   1325      end
   1326 +    UndoManager.register("killing #{threads.size} #{threads.size.pluralize 'thread'}",
   1327 +                         undo << lambda {regen_text})
   1328      regen_text
   1329      BufferManager.flash "#{threads.size.pluralize 'Thread'} killed."
   1330    end
   1331 -- 
   1332 1.5.3
   1333 
   1334 >From 1fd41c30189db832abb54f1cda416d0aa624e028 Mon Sep 17 00:00:00 2001
   1335 From: Mike Stipicevic <stipim at rpi.edu>
   1336 Date: Mon, 16 Feb 2009 00:11:28 -0500
   1337 Subject: [PATCH] Added undo for label edit
   1338 
   1339 ---
   1340  lib/sup/modes/thread-index-mode.rb |   27 +++++++++++++++++++++++++--
   1341  1 files changed, 25 insertions(+), 2 deletions(-)
   1342 
   1343 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
   1344 index 159839d..f28302b 100644
   1345 --- a/lib/sup/modes/thread-index-mode.rb
   1346 +++ b/lib/sup/modes/thread-index-mode.rb
   1347 @@ -509,6 +509,10 @@ EOS
   1348    def edit_labels
   1349      thread = cursor_thread or return
   1350      speciall = (@hidden_labels + LabelManager::RESERVED_LABELS).uniq
   1351 +
   1352 +    old_labels = thread.labels
   1353 +    pos = curpos
   1354 +
   1355      keepl, modifyl = thread.labels.partition { |t| speciall.member? t }
   1356  
   1357      user_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", modifyl, @hidden_labels
   1358 @@ -517,6 +521,15 @@ EOS
   1359      thread.labels = keepl + user_labels
   1360      user_labels.each { |l| LabelManager << l }
   1361      update_text_for_line curpos
   1362 +
   1363 +    undo = lambda{
   1364 +      thread.labels = old_labels
   1365 +      update_text_for_line pos
   1366 +      UpdateManager.relay self, :labeled, thread.first
   1367 +    }
   1368 +
   1369 +    UndoManager.register("labeling thread #{thread.first.id}", undo)
   1370 +
   1371      UpdateManager.relay self, :labeled, thread.first
   1372    end
   1373  
   1374 @@ -526,8 +539,18 @@ EOS
   1375      
   1376      hl = user_labels.select { |l| @hidden_labels.member? l }
   1377      if hl.empty?
   1378 -      threads.each { |t| user_labels.each { |l| t.apply_label l } }
   1379 -      user_labels.each { |l| LabelManager << l }
   1380 +      undo = threads.map { |t| old_labels = t.labels
   1381 +        user_labels.each { |l| t.apply_label l }
   1382 +        ## UpdateManager or some other regresh mechanism?
   1383 +        UpdateManager.relay self, :labeled, t.first
   1384 +        lambda {
   1385 +          t.labels = old_labels
   1386 +          UpdateManager.relay self, :labeled, t.first
   1387 +        }
   1388 +      }
   1389 +    user_labels.each { |l| LabelManager << l }
   1390 +    UndoManager.register("labeling #{threads.size} #{threads.size.pluralize 'thread'}",
   1391 +                         undo << lambda { regen_text})
   1392      else
   1393        BufferManager.flash "'#{hl}' is a reserved label!"
   1394      end
   1395 -- 
   1396 1.5.3
   1397 
   1398 >From e7abf80a590aa2f2de35343fceecea9deae41193 Mon Sep 17 00:00:00 2001
   1399 From: Mike Stipicevic <stipim at rpi.edu>
   1400 Date: Mon, 16 Feb 2009 00:11:46 -0500
   1401 Subject: [PATCH] Changed README to reflect addition of undo
   1402 
   1403 ---
   1404  README.txt |    2 +-
   1405  1 files changed, 1 insertions(+), 1 deletions(-)
   1406 
   1407 diff --git a/README.txt b/README.txt
   1408 index 1b2b516..05349d7 100644
   1409 --- a/README.txt
   1410 +++ b/README.txt
   1411 @@ -80,7 +80,7 @@ Current limitations which will be fixed:
   1412  - Unix-centrism in MIME attachment handling and in sendmail
   1413    invocation.
   1414  
   1415 -- Several obvious missing features, like undo, filters / saved
   1416 +- Several obvious missing features, like filters / saved
   1417    searches, message annotations, etc.
   1418  
   1419  == SYNOPSYS:
   1420 -- 
   1421 1.5.3
   1422 
   1423 
   1424 From ismith@MIT.EDU  Mon Feb 16 03:53:48 2009
   1425 From: ismith@MIT.EDU (Ian Smith)
   1426 Date: Mon, 16 Feb 2009 03:53:48 -0500
   1427 Subject: [sup-talk] (no subject)
   1428 In-Reply-To: <200902160625.n1G6PxM4003065@rmtacc26-la.rcs.rpi.edu>
   1429 References: <200902160625.n1G6PxM4003065@rmtacc26-la.rcs.rpi.edu>
   1430 Message-ID: <1234774373-sup-1128@zo>
   1431 
   1432 Hey,
   1433 
   1434 I've gotten a whole bunch of these empty messages from you/sup-talk
   1435 over the past few hours.  Any idea what they are, or how you can
   1436 suppress them?
   1437 
   1438 Ian
   1439 
   1440 Excerpts from Michael John Stipicevic's message of Mon Feb 16 01:25:59 -0500 2009:
   1441 > 
   1442 
   1443 From wmorgan-sup@masanjin.net  Mon Feb 16 09:08:42 2009
   1444 From: wmorgan-sup@masanjin.net (William Morgan)
   1445 Date: Mon, 16 Feb 2009 06:08:42 -0800
   1446 Subject: [sup-talk] (no subject)
   1447 In-Reply-To: <1234774373-sup-1128@zo>
   1448 References: <200902160625.n1G6PxM4003065@rmtacc26-la.rcs.rpi.edu>
   1449 	<1234774373-sup-1128@zo>
   1450 Message-ID: <1234793192-sup-4522@entry>
   1451 
   1452 Reformatted excerpts from Ian Smith's message of 2009-02-16:
   1453 > I've gotten a whole bunch of these empty messages from you/sup-talk
   1454 > over the past few hours.  Any idea what they are, or how you can
   1455 > suppress them?
   1456 
   1457 Some of them seem to have included patches. Don't suppress those!
   1458 
   1459 Looks kinda like a session with git-send-email gone tragically awry.
   1460 -- 
   1461 William <wmorgan-sup at masanjin.net>
   1462 
   1463 From stipim@rpi.edu  Mon Feb 16 09:42:25 2009
   1464 From: stipim@rpi.edu (Mike Stipicevic)
   1465 Date: Mon, 16 Feb 2009 09:42:25 -0500
   1466 Subject: [sup-talk] (no subject)
   1467 In-Reply-To: <1234793192-sup-4522@entry>
   1468 References: <200902160625.n1G6PxM4003065@rmtacc26-la.rcs.rpi.edu>
   1469 	<1234774373-sup-1128@zo> <1234793192-sup-4522@entry>
   1470 Message-ID: <1234795198-sup-1379@rmtacc26-la.rcs.rpi.edu>
   1471 
   1472 Excerpts from William Morgan's message of Mon Feb 16 09:08:42 -0500 2009:
   1473 > Reformatted excerpts from Ian Smith's message of 2009-02-16:
   1474 > > I've gotten a whole bunch of these empty messages from you/sup-talk
   1475 > > over the past few hours.  Any idea what they are, or how you can
   1476 > > suppress them?
   1477 > 
   1478 > Some of them seem to have included patches. Don't suppress those!
   1479 > 
   1480 > Looks kinda like a session with git-send-email gone tragically awry.
   1481 
   1482 This is indeed the case. There should be 8 patches in total, they all implement basic undo functionality for sup. Sorry for the mess!
   1483 
   1484 - Mike
   1485 -- 
   1486 Mike Stipicevic
   1487 RPI EE/CSYS Class of '09
   1488 
   1489 stipim at rpi.edu
   1490 mstipicevic at ieee.org
   1491 
   1492 From wmorgan-sup@masanjin.net  Thu Feb 19 15:14:27 2009
   1493 From: wmorgan-sup@masanjin.net (William Morgan)
   1494 Date: Thu, 19 Feb 2009 12:14:27 -0800
   1495 Subject: [sup-talk] undo
   1496 In-Reply-To: <1234764952-sup-604@rmtacc25-lb.rcs.rpi.edu>
   1497 References: <1234764952-sup-604@rmtacc25-lb.rcs.rpi.edu>
   1498 Message-ID: <1235074446-sup-453@entry>
   1499 
   1500 Reformatted excerpts from Michael John Stipicevic's message of 2009-02-15:
   1501 > I've added basic undo for sup-the-client. It's mostly centered around
   1502 > labelling (including archiving, spam, etc). It currently does not
   1503 > handle thread-joining, contacts or anything outside of the
   1504 > thread/inbox view.
   1505 
   1506 Thanks, I'll take a look!
   1507 -- 
   1508 William <wmorgan-sup at masanjin.net>
   1509 
   1510 From wirtwolff@gmail.com  Fri Feb 20 10:14:45 2009
   1511 From: wirtwolff@gmail.com (Wirt Wolff)
   1512 Date: Fri, 20 Feb 2009 08:14:45 -0700
   1513 Subject: [sup-talk] Send draft crash with mainline
   1514 Message-ID: <1235142347-sup-5940@chigamba>
   1515 
   1516 AFAICT this crash was had two drafts in a thread, deleted one, edited
   1517 and sent the other. Didn't notice when the crash happened unfortunately,
   1518 since left right after `y'. Exception log attached.
   1519 
   1520 The deleted draft did not get deleted, but just did so successfully.
   1521 
   1522 I must say this is the only problem I've had since using sup rather
   1523 extensively for a month or so. Well, aside from encoding, which hasn't
   1524 been important enough for me to apply fixes discussed various places.
   1525 
   1526 (To counter the "why on earth would you use an alpha email client?" people.) ;-]
   1527 -- 
   1528 wmw
   1529 -------------- next part --------------
   1530 An embedded and charset-unspecified text was scrubbed...
   1531 Name: exception-log.txt
   1532 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090220/1053e4bf/attachment-0001.txt>
   1533 
   1534 From wirtwolff@gmail.com  Fri Feb 20 10:46:52 2009
   1535 From: wirtwolff@gmail.com (Wirt Wolff)
   1536 Date: Fri, 20 Feb 2009 08:46:52 -0700
   1537 Subject: [sup-talk] Send draft crash with mainline
   1538 In-Reply-To: <1235142347-sup-5940@chigamba>
   1539 References: <1235142347-sup-5940@chigamba>
   1540 Message-ID: <1235144668-sup-917@chigamba>
   1541 
   1542 Excerpts from Wirt Wolff's message of Fri Feb 20 08:14:45 -0700 2009:
   1543 > AFAICT this crash was had two drafts in a thread, deleted one, edited
   1544 > and sent the other. Didn't notice when the crash happened unfortunately,
   1545 > since left right after `y'. Exception log attached.
   1546 > 
   1547 > The deleted draft did not get deleted, but just did so successfully.
   1548 
   1549 Ah, this seems to be related to deleting a draft viewed from 'L' Draft
   1550 search results, then select draft, edit, save and quit editor, 'x' and
   1551 choose "yes, delete" ~~> crash. Doing the same from inbox doesn't crash.
   1552 
   1553 -- 
   1554 wmw
   1555 
   1556 From jace42@gmail.com  Sun Feb 22 21:02:33 2009
   1557 From: jace42@gmail.com (Jacob Certain)
   1558 Date: Sun, 22 Feb 2009 18:02:33 -0800
   1559 Subject: [sup-talk] Exception log
   1560 Message-ID: <20090223020231.GA7969@daedalus>
   1561 
   1562 Got an exception, probably my fault : )
   1563 
   1564 I ran sup, it worked. I closed sup. I edited my sources.yaml file. Old, then new copies are below. Next run of sup crashed. Attached is the exception log sup asked me to send y'all.
   1565 
   1566 Lemme know if I can be of more help.
   1567 
   1568 jake at daedalus:~/.sup$ cat /etc/lsb-release
   1569 DISTRIB_ID=Ubuntu
   1570 DISTRIB_RELEASE=8.10
   1571 DISTRIB_CODENAME=intrepid
   1572 DISTRIB_DESCRIPTION="Ubuntu 8.10"
   1573 
   1574 jake at daedalus:~/.sup$ uname -a
   1575 Linux daedalus 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux
   1576 
   1577 jake at daedalus:~/.sup$ sup --version
   1578 [Sun Feb 22 17:57:19 -0800 2009] using character set encoding "UTF-8"
   1579 [Sun Feb 22 17:57:19 -0800 2009] optional 'chronic' library not found
   1580 (run 'gem install chronic' to install)
   1581 sup v0.6
   1582 
   1583 
   1584   1 ---
   1585   2 - !masanjin.net,2006-10-01/Redwood/MBox/Loader
   1586   3   uri: mbox:/home/jake/mbox
   1587   4   cur_offset: 133901
   1588   5   usual: true
   1589   6   archived: true
   1590   7   id: 1
   1591   8   labels:
   1592   9   - system
   1593  10 - !masanjin.net,2006-10-01/Redwood/IMAP
   1594  11   uri: imaps://imap.gmail.com:993/INBOX
   1595  12   username: jace42
   1596  13   password: ****************
   1597  14   cur_offset: 12336959040043986
   1598  15   usual: true
   1599  16   archived: false
   1600  17   id: 2
   1601  18   labels:
   1602  19   - gmail
   1603  20 - !masanjin.net,2006-10-01/Redwood/IMAP
   1604  21   uri: imaps://imap.gmail.com:993/wotd
   1605  22   username: jace42
   1606  23   password: ***********
   1607  24   cur_offset: 12336424920007821
   1608  25   usual: true
   1609  26   archived: false
   1610  27   id: 3
   1611  28   labels:
   1612  29   - wotd
   1613  30 - !masanjin.net,2006-10-01/Redwood/SentLoader
   1614  31   cur_offset: 0
   1615  32 - !masanjin.net,2006-10-01/Redwood/DraftLoader
   1616  33   cur_offset: 0
   1617 
   1618 
   1619 
   1620 
   1621 ---
   1622 - !masanjin.net,2006-10-01/Redwood/MBox/Loader
   1623   uri: mbox:/home/jake/mbox
   1624   cur_offset: 133901
   1625   usual: true
   1626   archived: true
   1627   id: 1
   1628   labels:
   1629   - system
   1630 j
   1631 -------------- next part --------------
   1632 --- RuntimeError from thread: load threads for thread-index-mode
   1633 invalid source 2
   1634 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:364:in `build_message'
   1635 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1636 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:330:in `call'
   1637 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:330:in `load_n_threads'
   1638 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1639 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each'
   1640 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1641 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:326:in `load_n_threads'
   1642 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:499:in `__unprotected_load_n_threads'
   1643 (eval):12:in `load_n_threads'
   1644 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:483:in `load_n_threads_background'
   1645 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:85:in `reporting_thread'
   1646 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `initialize'
   1647 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `new'
   1648 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `reporting_thread'
   1649 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:482:in `load_n_threads_background'
   1650 /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:552:in `__unprotected_load_threads'
   1651 (eval):12:in `load_threads'
   1652 /usr/lib/ruby/gems/1.8/gems/sup-0.6/bin/sup:166
   1653 /usr/bin/sup:19:in `load'
   1654 /usr/bin/sup:19
   1655 
   1656 From jace42@gmail.com  Sun Feb 22 21:14:30 2009
   1657 From: jace42@gmail.com (Jacob Certain)
   1658 Date: Sun, 22 Feb 2009 18:14:30 -0800
   1659 Subject: [sup-talk] Exception log
   1660 In-Reply-To: <20090223020231.GA7969@daedalus>
   1661 References: <20090223020231.GA7969@daedalus>
   1662 Message-ID: <20090223021429.GA8993@daedalus>
   1663 
   1664 Damnation. I've gone and been an idiot, and deleted my ~/.sup folder.
   1665 I know.. should've just renamed it. I tried wiping out the sources.yaml
   1666 file again before configuring sup at all, but sup still starts and exits
   1667 fine.
   1668 
   1669 jake
   1670 
   1671 
   1672 On Sun, Feb 22, 2009 at 06:02:31PM -0800, Jacob Certain wrote:
   1673 > Got an exception, probably my fault : )
   1674 > 
   1675 > I ran sup, it worked. I closed sup. I edited my sources.yaml file. Old, then new copies are below. Next run of sup crashed. Attached is the exception log sup asked me to send y'all.
   1676 > 
   1677 > Lemme know if I can be of more help.
   1678 > 
   1679 > jake at daedalus:~/.sup$ cat /etc/lsb-release
   1680 > DISTRIB_ID=Ubuntu
   1681 > DISTRIB_RELEASE=8.10
   1682 > DISTRIB_CODENAME=intrepid
   1683 > DISTRIB_DESCRIPTION="Ubuntu 8.10"
   1684 > 
   1685 > jake at daedalus:~/.sup$ uname -a
   1686 > Linux daedalus 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux
   1687 > 
   1688 > jake at daedalus:~/.sup$ sup --version
   1689 > [Sun Feb 22 17:57:19 -0800 2009] using character set encoding "UTF-8"
   1690 > [Sun Feb 22 17:57:19 -0800 2009] optional 'chronic' library not found
   1691 > (run 'gem install chronic' to install)
   1692 > sup v0.6
   1693 > 
   1694 > 
   1695 >   1 ---
   1696 >   2 - !masanjin.net,2006-10-01/Redwood/MBox/Loader
   1697 >   3   uri: mbox:/home/jake/mbox
   1698 >   4   cur_offset: 133901
   1699 >   5   usual: true
   1700 >   6   archived: true
   1701 >   7   id: 1
   1702 >   8   labels:
   1703 >   9   - system
   1704 >  10 - !masanjin.net,2006-10-01/Redwood/IMAP
   1705 >  11   uri: imaps://imap.gmail.com:993/INBOX
   1706 >  12   username: jace42
   1707 >  13   password: ****************
   1708 >  14   cur_offset: 12336959040043986
   1709 >  15   usual: true
   1710 >  16   archived: false
   1711 >  17   id: 2
   1712 >  18   labels:
   1713 >  19   - gmail
   1714 >  20 - !masanjin.net,2006-10-01/Redwood/IMAP
   1715 >  21   uri: imaps://imap.gmail.com:993/wotd
   1716 >  22   username: jace42
   1717 >  23   password: ***********
   1718 >  24   cur_offset: 12336424920007821
   1719 >  25   usual: true
   1720 >  26   archived: false
   1721 >  27   id: 3
   1722 >  28   labels:
   1723 >  29   - wotd
   1724 >  30 - !masanjin.net,2006-10-01/Redwood/SentLoader
   1725 >  31   cur_offset: 0
   1726 >  32 - !masanjin.net,2006-10-01/Redwood/DraftLoader
   1727 >  33   cur_offset: 0
   1728 > 
   1729 > 
   1730 > 
   1731 > 
   1732 > ---
   1733 > - !masanjin.net,2006-10-01/Redwood/MBox/Loader
   1734 >   uri: mbox:/home/jake/mbox
   1735 >   cur_offset: 133901
   1736 >   usual: true
   1737 >   archived: true
   1738 >   id: 1
   1739 >   labels:
   1740 >   - system
   1741 > j
   1742 
   1743 > --- RuntimeError from thread: load threads for thread-index-mode
   1744 > invalid source 2
   1745 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:364:in `build_message'
   1746 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1747 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:330:in `call'
   1748 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:330:in `load_n_threads'
   1749 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1750 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each'
   1751 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1752 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:326:in `load_n_threads'
   1753 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:499:in `__unprotected_load_n_threads'
   1754 > (eval):12:in `load_n_threads'
   1755 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:483:in `load_n_threads_background'
   1756 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:85:in `reporting_thread'
   1757 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `initialize'
   1758 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `new'
   1759 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `reporting_thread'
   1760 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:482:in `load_n_threads_background'
   1761 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:552:in `__unprotected_load_threads'
   1762 > (eval):12:in `load_threads'
   1763 > /usr/lib/ruby/gems/1.8/gems/sup-0.6/bin/sup:166
   1764 > /usr/bin/sup:19:in `load'
   1765 > /usr/bin/sup:19
   1766 
   1767 
   1768 From jace42@gmail.com  Mon Feb 23 13:47:14 2009
   1769 From: jace42@gmail.com (Jacob Certain)
   1770 Date: Mon, 23 Feb 2009 10:47:14 -0800
   1771 Subject: [sup-talk] Exception log
   1772 In-Reply-To: <20090223021429.GA8993@daedalus>
   1773 References: <20090223020231.GA7969@daedalus> <20090223021429.GA8993@daedalus>
   1774 Message-ID: <20090223184712.GA8957@daedalus>
   1775 
   1776 Right, so, I can reproduce.
   1777 
   1778 1. Delete ~/.sup folder
   1779 2. Start and close sup successfully
   1780 3. Run through sup-config add sup-add adding a mailbox (I used a local mbox for my system account)
   1781 4. Delete the mailbox entry in ~/.sup/sources.yaml
   1782 
   1783 -OR-
   1784 
   1785 4. rm ~/.sup/sources.yaml*
   1786 
   1787 Merely deleting the last two masanjin sent & draft lines in the file is fine.
   1788 
   1789 I guess I'm expecting sup to cope better a) a sources.yaml file without a mailbox; b) no sources.yaml file.
   1790 
   1791 Anyway, hope this helps!
   1792 
   1793 jake
   1794 
   1795 On Sun, Feb 22, 2009 at 06:14:29PM -0800, Jacob Certain wrote:
   1796 > Damnation. I've gone and been an idiot, and deleted my ~/.sup folder.
   1797 > I know.. should've just renamed it. I tried wiping out the sources.yaml
   1798 > file again before configuring sup at all, but sup still starts and exits
   1799 > fine.
   1800 > 
   1801 > jake
   1802 > 
   1803 > 
   1804 > On Sun, Feb 22, 2009 at 06:02:31PM -0800, Jacob Certain wrote:
   1805 > > Got an exception, probably my fault : )
   1806 > > 
   1807 > > I ran sup, it worked. I closed sup. I edited my sources.yaml file. Old, then new copies are below. Next run of sup crashed. Attached is the exception log sup asked me to send y'all.
   1808 > > 
   1809 > > Lemme know if I can be of more help.
   1810 > > 
   1811 > > jake at daedalus:~/.sup$ cat /etc/lsb-release
   1812 > > DISTRIB_ID=Ubuntu
   1813 > > DISTRIB_RELEASE=8.10
   1814 > > DISTRIB_CODENAME=intrepid
   1815 > > DISTRIB_DESCRIPTION="Ubuntu 8.10"
   1816 > > 
   1817 > > jake at daedalus:~/.sup$ uname -a
   1818 > > Linux daedalus 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux
   1819 > > 
   1820 > > jake at daedalus:~/.sup$ sup --version
   1821 > > [Sun Feb 22 17:57:19 -0800 2009] using character set encoding "UTF-8"
   1822 > > [Sun Feb 22 17:57:19 -0800 2009] optional 'chronic' library not found
   1823 > > (run 'gem install chronic' to install)
   1824 > > sup v0.6
   1825 > > 
   1826 > > 
   1827 > >   1 ---
   1828 > >   2 - !masanjin.net,2006-10-01/Redwood/MBox/Loader
   1829 > >   3   uri: mbox:/home/jake/mbox
   1830 > >   4   cur_offset: 133901
   1831 > >   5   usual: true
   1832 > >   6   archived: true
   1833 > >   7   id: 1
   1834 > >   8   labels:
   1835 > >   9   - system
   1836 > >  10 - !masanjin.net,2006-10-01/Redwood/IMAP
   1837 > >  11   uri: imaps://imap.gmail.com:993/INBOX
   1838 > >  12   username: jace42
   1839 > >  13   password: ****************
   1840 > >  14   cur_offset: 12336959040043986
   1841 > >  15   usual: true
   1842 > >  16   archived: false
   1843 > >  17   id: 2
   1844 > >  18   labels:
   1845 > >  19   - gmail
   1846 > >  20 - !masanjin.net,2006-10-01/Redwood/IMAP
   1847 > >  21   uri: imaps://imap.gmail.com:993/wotd
   1848 > >  22   username: jace42
   1849 > >  23   password: ***********
   1850 > >  24   cur_offset: 12336424920007821
   1851 > >  25   usual: true
   1852 > >  26   archived: false
   1853 > >  27   id: 3
   1854 > >  28   labels:
   1855 > >  29   - wotd
   1856 > >  30 - !masanjin.net,2006-10-01/Redwood/SentLoader
   1857 > >  31   cur_offset: 0
   1858 > >  32 - !masanjin.net,2006-10-01/Redwood/DraftLoader
   1859 > >  33   cur_offset: 0
   1860 > > 
   1861 > > 
   1862 > > 
   1863 > > 
   1864 > > ---
   1865 > > - !masanjin.net,2006-10-01/Redwood/MBox/Loader
   1866 > >   uri: mbox:/home/jake/mbox
   1867 > >   cur_offset: 133901
   1868 > >   usual: true
   1869 > >   archived: true
   1870 > >   id: 1
   1871 > >   labels:
   1872 > >   - system
   1873 > > j
   1874 > 
   1875 > > --- RuntimeError from thread: load threads for thread-index-mode
   1876 > > invalid source 2
   1877 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:364:in `build_message'
   1878 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1879 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:330:in `call'
   1880 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:330:in `load_n_threads'
   1881 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1882 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each'
   1883 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/index.rb:263:in `each_id_by_date'
   1884 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/thread.rb:326:in `load_n_threads'
   1885 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:499:in `__unprotected_load_n_threads'
   1886 > > (eval):12:in `load_n_threads'
   1887 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:483:in `load_n_threads_background'
   1888 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:85:in `reporting_thread'
   1889 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `initialize'
   1890 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `new'
   1891 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup.rb:83:in `reporting_thread'
   1892 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:482:in `load_n_threads_background'
   1893 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/lib/sup/modes/thread-index-mode.rb:552:in `__unprotected_load_threads'
   1894 > > (eval):12:in `load_threads'
   1895 > > /usr/lib/ruby/gems/1.8/gems/sup-0.6/bin/sup:166
   1896 > > /usr/bin/sup:19:in `load'
   1897 > > /usr/bin/sup:19
   1898 > 
   1899 
   1900 From gutnik@gmail.com  Thu Feb 26 12:33:30 2009
   1901 From: gutnik@gmail.com (Vadim Gutnik)
   1902 Date: Thu, 26 Feb 2009 09:33:30 -0800
   1903 Subject: [sup-talk] New user questions...
   1904 Message-ID: <c46e347b0902260933qafa051bp185bd8339a6f10a0@mail.gmail.com>
   1905 
   1906 I built sup on my ubuntu system as described on the wiki; no problems,
   1907 though I'll likely switch to the packaged
   1908 version as it becomes available.
   1909 
   1910 I tried using mbox format, ran into the From: bug (I think -- out of a
   1911 couple thousand emails, maybe a dozen
   1912 forwarded messages were split from their emails; still, this isn't
   1913 tolerable. Is there a plan to make sup
   1914 recognize email breaks at least as well as mutt does?), so I'm using
   1915 mdir format, which doesn't suffer from it.
   1916 
   1917 Two specific questions, though:
   1918 
   1919 1) I use getmail to get my POP3SSL mail and put it into mdir format.
   1920 Usually, when getmail tells me it found
   1921 a message, I go to my running sup process and press "P" for it to pick
   1922 up the mail, and sup shows the new message.
   1923 Sometimes (maybe 5-10% of the time?) sup does not find the new message
   1924 until I quit and restart it. Known problem?
   1925 Is there anything I can do to help debug it?
   1926 
   1927 2) At least once or twice I've hit "d" by habit (and mistake). Is
   1928 there a way to search for "deleted" messages? I could
   1929 just rebuild the index from scratch and reapply labels if I had to,
   1930 but ...there must be an easier way, right?
   1931 
   1932 Thanks.
   1933 
   1934    Vadim
   1935