sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 1204128104a1b77bf3ad52fba9c8e6c44931fd4a
parent 5ccd5dcb324aaed84e2775729f953384f780d43c
Author: Marc Hartstein <marc.hartstein@alum.vassar.edu>
Date:   Thu, 17 Apr 2008 16:43:29 -0400

add 'A' (archive and mark read) command to inbox-mode

For some email, the only meaningful content is in the subject line.  It is thus
useful to be able to dispatch this email with a single command after glancing
at it.

As 'N' moves the cursor, and 'a' doesn't clear the "unread" flag, it is
currently necessary to press "Nka" to do this on a single thread.

The 'A' command does this simple task with a single, easy-to-remember,
keystroke, but makes it harder to hit accidentally than 'a'.  A multi_ mode is
supplied.

Diffstat:
M lib/sup/modes/inbox-mode.rb | 18 ++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb
@@ -6,6 +6,7 @@ class InboxMode < ThreadIndexMode
   register_keymap do |k|
     ## overwrite toggle_archived with archive
     k.add :archive, "Archive thread (remove from inbox)", 'a'
+    k.add :read_and_archive, "Archive thread (remove from inbox) and mark read", 'A'
   end
 
   def initialize
@@ -38,6 +39,23 @@ class InboxMode < ThreadIndexMode
     regen_text
   end
 
+  def read_and_archive
+    return unless cursor_thread
+    cursor_thread.remove_label :unread
+    cursor_thread.remove_label :inbox
+    hide_thread cursor_thread
+    regen_text
+  end
+
+  def multi_read_and_archive threads
+    threads.each do |t|
+      t.remove_label :unread
+      t.remove_label :inbox
+      hide_thread t
+    end
+    regen_text
+  end
+
   def handle_unarchived_update sender, m
     add_or_unhide m
   end