Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new
@ 2010-01-04  6:06 Anthony Martinez
  2010-01-04  6:06 ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state Anthony Martinez
  2010-01-05 21:25 ` [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new William Morgan
  0 siblings, 2 replies; 9+ messages in thread
From: Anthony Martinez @ 2010-01-04  6:06 UTC (permalink / raw)
  To: sup-devel

---
 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

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state
  2010-01-04  6:06 [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new Anthony Martinez
@ 2010-01-04  6:06 ` Anthony Martinez
  2010-01-04  6:06   ` [sup-devel] [PATCH 3/3] make the undo hooks also save the threads Anthony Martinez
  2010-01-05 21:25   ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state William Morgan
  2010-01-05 21:25 ` [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new William Morgan
  1 sibling, 2 replies; 9+ messages in thread
From: Anthony Martinez @ 2010-01-04  6:06 UTC (permalink / raw)
  To: sup-devel

---
 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

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [sup-devel] [PATCH 3/3] make the undo hooks also save the threads
  2010-01-04  6:06 ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state Anthony Martinez
@ 2010-01-04  6:06   ` Anthony Martinez
  2010-01-05 21:26     ` William Morgan
  2010-01-05 21:25   ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state William Morgan
  1 sibling, 1 reply; 9+ messages in thread
From: Anthony Martinez @ 2010-01-04  6:06 UTC (permalink / raw)
  To: sup-devel

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

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new
  2010-01-04  6:06 [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new Anthony Martinez
  2010-01-04  6:06 ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state Anthony Martinez
@ 2010-01-05 21:25 ` William Morgan
  1 sibling, 0 replies; 9+ messages in thread
From: William Morgan @ 2010-01-05 21:25 UTC (permalink / raw)
  To: sup-devel

Applied directly to master. Thanks!
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state
  2010-01-04  6:06 ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state Anthony Martinez
  2010-01-04  6:06   ` [sup-devel] [PATCH 3/3] make the undo hooks also save the threads Anthony Martinez
@ 2010-01-05 21:25   ` William Morgan
  1 sibling, 0 replies; 9+ messages in thread
From: William Morgan @ 2010-01-05 21:25 UTC (permalink / raw)
  To: sup-devel

Applied directly to master. Thanks!
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [sup-devel] [PATCH 3/3] make the undo hooks also save the threads
  2010-01-04  6:06   ` [sup-devel] [PATCH 3/3] make the undo hooks also save the threads Anthony Martinez
@ 2010-01-05 21:26     ` William Morgan
  2010-01-05 22:45       ` [sup-devel] [PATCH-insta-save] " Anthony Martinez
  0 siblings, 1 reply; 9+ messages in thread
From: William Morgan @ 2010-01-05 21:26 UTC (permalink / raw)
  To: sup-devel

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 <wmorgan-sup@masanjin.net>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [sup-devel] [PATCH-insta-save] make the undo hooks also save the threads
  2010-01-05 21:26     ` William Morgan
@ 2010-01-05 22:45       ` Anthony Martinez
  2010-01-05 22:45         ` [sup-devel] [PATCH] " Anthony Martinez
  2010-01-05 23:47         ` [sup-devel] [PATCH-insta-save] " William Morgan
  0 siblings, 2 replies; 9+ messages in thread
From: Anthony Martinez @ 2010-01-05 22:45 UTC (permalink / raw)
  To: sup-devel

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.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [sup-devel] [PATCH] make the undo hooks also save the threads
  2010-01-05 22:45       ` [sup-devel] [PATCH-insta-save] " Anthony Martinez
@ 2010-01-05 22:45         ` Anthony Martinez
  2010-01-05 23:47         ` [sup-devel] [PATCH-insta-save] " William Morgan
  1 sibling, 0 replies; 9+ messages in thread
From: Anthony Martinez @ 2010-01-05 22:45 UTC (permalink / raw)
  To: sup-devel

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

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [sup-devel] [PATCH-insta-save] make the undo hooks also save the threads
  2010-01-05 22:45       ` [sup-devel] [PATCH-insta-save] " Anthony Martinez
  2010-01-05 22:45         ` [sup-devel] [PATCH] " Anthony Martinez
@ 2010-01-05 23:47         ` William Morgan
  1 sibling, 0 replies; 9+ messages in thread
From: William Morgan @ 2010-01-05 23:47 UTC (permalink / raw)
  To: sup-devel

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 <wmorgan-sup@masanjin.net>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-01-05 23:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-04  6:06 [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new Anthony Martinez
2010-01-04  6:06 ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state Anthony Martinez
2010-01-04  6:06   ` [sup-devel] [PATCH 3/3] make the undo hooks also save the threads Anthony Martinez
2010-01-05 21:26     ` William Morgan
2010-01-05 22:45       ` [sup-devel] [PATCH-insta-save] " Anthony Martinez
2010-01-05 22:45         ` [sup-devel] [PATCH] " Anthony Martinez
2010-01-05 23:47         ` [sup-devel] [PATCH-insta-save] " William Morgan
2010-01-05 21:25   ` [sup-devel] [PATCH 2/3] undoing read_and_archive should preserve unread state William Morgan
2010-01-05 21:25 ` [sup-devel] [PATCH 1/3] punctuate "No new messages." consistently between poll, jump_to_next_new William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox