Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: marc.hartstein@alum.vassar.edu (Marc Hartstein)
Subject: [sup-talk] [PATCH] Add 'A' archive and mark read command to inbox-mode.
Date: Thu, 17 Apr 2008 16:43:29 -0400	[thread overview]
Message-ID: <1208465009-5957-1-git-send-email-marc.hartstein@alum.vassar.edu> (raw)

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.
---
 lib/sup/modes/inbox-mode.rb |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb
index a2de13f..c623f4a 100644
--- 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
-- 
1.5.3.7



             reply	other threads:[~2008-04-17 20:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 20:43 Marc Hartstein [this message]
2008-04-27  6:50 William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208465009-5957-1-git-send-email-marc.hartstein@alum.vassar.edu \
    --to=marc.hartstein@alum.vassar.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox