]> git.notmuchmail.org Git - sup/commitdiff
added deletion (but it doesn't do anything different from :spam right now)
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 24 Jan 2007 21:20:04 +0000 (21:20 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 24 Jan 2007 21:20:04 +0000 (21:20 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@283 5c8cc53c-5e98-4d25-b20a-d8db53a31250

doc/FAQ.txt
lib/sup/index.rb
lib/sup/label.rb
lib/sup/modes/inbox-mode.rb
lib/sup/modes/thread-index-mode.rb

index ef680f72d8302ea9e147c6cedf6ac263122e16dc..df50abe38eaa3e1d13a83b41e5b054ab03a98247 100644 (file)
@@ -22,6 +22,21 @@ A: You can manually mark messages as spam, which prevents them from
    showing up in future searches, but that's all that Sup does. Spam
    filtering should be done by a dedicated tool like SpamAssassin.
 
+Q: How do I delete a message?
+A: Press the 'd' key.
+
+Q: But I want to delete it for real, not just add a 'deleted' flag in
+   the index. I want it gone from disk!
+A: Deleting a message is an old-fashioned concept. In the modern
+   world, disk space is cheap enough that you should never have to
+   delete a message. If it's spam, save it for future analysis.
+
+Q: C'mon, really!
+A: Ok, at some point I plan to have a batch deletion tool that will
+   run through a source and delete all messages that have a 'spam' or
+   'deleted' tags (and, for mbox sources, will update the offsets of
+   all later messages). But that doesn't exist yet.
+
 Q: What are all these "Redwood" references I see in the code?
 A: That was Sup's original name. (Think pine, elm. Although I am a
    Mutt user, I couldn't think of a good progression there.) But it was
index faabe8dc3d98247def9639df8d12646fd433fce1..24e6cee39a930acee9caddfbacc4210a95fd2697 100644 (file)
@@ -294,6 +294,7 @@ protected
     end
         
     query.add_query Ferret::Search::TermQuery.new("label", "spam"), :must_not unless opts[:load_spam] || labels.include?(:spam)
+    query.add_query Ferret::Search::TermQuery.new("label", "deleted"), :must_not unless opts[:load_deleted] || labels.include?(:deleted)
     query.add_query Ferret::Search::TermQuery.new("label", "killed"), :must_not unless opts[:load_killed] || labels.include?(:killed)
     query
   end
index 7b0bbdfb55c52b46a8fcde38d2d5305576906e5b..3e8baa82f840b8cc8252258708ef4d09c6a01123 100644 (file)
@@ -5,10 +5,10 @@ class LabelManager
 
   ## labels that have special semantics. user will be unable to
   ## add/remove these via normal label mechanisms.
-  RESERVED_LABELS = [ :starred, :spam, :draft, :unread, :killed, :sent ]
+  RESERVED_LABELS = [ :starred, :spam, :draft, :unread, :killed, :sent, :deleted ]
 
   ## labels which it nonetheless makes sense to search for by
-  LISTABLE_LABELS = [ :starred, :spam, :draft, :sent ]
+  LISTABLE_LABELS = [ :starred, :spam, :draft, :sent, :deleted ]
 
   ## labels that will never be displayed to the user
   HIDDEN_LABELS = [ :starred, :unread ]
index ae231a7097f7c9100fcaa9c12adf725d40cd5166..3dfccbd95476cdd0ae64978b9fd15a40a29b5cde 100644 (file)
@@ -33,8 +33,6 @@ class InboxMode < ThreadIndexMode
   def load_threads opts={}
     n = opts[:num] || ThreadIndexMode::LOAD_MORE_THREAD_NUM
     load_n_threads_background n, :label => :inbox,
-                                 :load_killed => false,
-                                 :load_spam => false,
                                  :when_done => (lambda do |num|
       opts[:when_done].call if opts[:when_done]
       BufferManager.flash "Added #{num} threads."
index c2d227ef35bd34ef598f21c2d1db5c4eb70d3d00..8df0408d1092a96de8e13b68651d1d6e4fdc9586 100644 (file)
@@ -17,6 +17,7 @@ class ThreadIndexMode < LineCursorMode
     k.add :edit_labels, "Edit or add labels for a thread", 'l'
     k.add :edit_message, "Edit message (drafts only)", 'e'
     k.add :mark_as_spam, "Mark thread as spam", 'S'
+    k.add :delete, "Mark thread for deletion", 'd'
     k.add :kill, "Kill thread (never to be seen in inbox again)", '&'
     k.add :save, "Save changes now", '$'
     k.add :jump_to_next_new, "Jump to next new thread", :tab
@@ -194,6 +195,19 @@ class ThreadIndexMode < LineCursorMode
     regen_text
   end
 
+  def delete
+    t = @threads[curpos] or return
+    multi_delete [t]
+  end
+
+  def multi_delete threads
+    threads.each do |t|
+      t.toggle_label :deleted
+      hide_thread t
+    end
+    regen_text
+  end
+
   def kill
     t = @threads[curpos] or return
     multi_kill [t]