[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-talk] Missing the save index option (patch attached)



Hi all,

since the last changes to get rid of the save option and to migrate to
the Xapian index, I am really missing the save index option.

Currently, when Sup exits, all the changes to the index are flushed,
and in my case it takes ages because I am a heavy email load user. For
me that is a problem, because my Sup is always open, and I usually
suspend my laptop. From time to time, my laptop won't wake up, and I
am forced to do an unclean reboot. When I open again Sup, all the
changes I did (archiving threads, etc) are lost because the index was
not flushed.

I know that I can use the XAPIAN_FLUSH_THRESHOLD option, but if I use
that option, when the threshold is reached it interrupts me while I am
dealing with my email, and I have to wait some seconds until the index
is flushed. This behavior is very annoying.

I don't know if someone else in this list is also missing the
possibility of flushing the index from Sup. I have done the attached
changes to my Sup, that recovers a sort-of the old save index
option. I am sending to the list just in case the patch is useful for
others too. If there are not strong objections to this change, I
suggest to merge it with Sup.

Cheers,
Israel

---
 lib/sup/modes/thread-index-mode.rb |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index a5bd344..3a1bb76 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -37,6 +37,7 @@ EOS
     k.add :toggle_spam, "Mark/unmark thread as spam", 'S'
     k.add :toggle_deleted, "Delete/undelete thread", 'd'
     k.add :kill, "Kill thread (never to be seen in inbox again)", '&'
+    k.add :flush_index, "Flush all changes now", '$'
     k.add :jump_to_next_new, "Jump to next new thread", :tab
     k.add :reply, "Reply to latest message in a thread", 'r'
     k.add :reply_all, "Reply to all participants of the latest message in a thread", 'G'
@@ -449,6 +450,12 @@ EOS
     multi_kill [t]
   end
 
+  def flush_index
+    @flush_id = BufferManager.say "Flushing index..."
+    Index.save_index
+    BufferManager.clear @flush_id
+  end
+  
   ## m-m-m-m-MULTI-KILL
   def multi_kill threads
     UndoManager.register "killing #{threads.size.pluralize 'thread'}" do
-- 
1.6.6
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk