Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Ben Walton <bwalton@artsci.utoronto.ca>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH] Add global keybinding to clear all hooks
Date: Fri, 14 May 2010 11:22:24 -0400	[thread overview]
Message-ID: <1273850544-16363-1-git-send-email-bwalton@artsci.utoronto.ca> (raw)

When developing/tweaking hooks, it's inconvenient to use the console
mode to run the clear hooks command.  Add a globally available key
binding ('H') to trigger HookManager.clear.  As this is now more
exposed in the UI, make HookManager flash a notice to the
BufferManager indicating that it cleared the hooks.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 bin/sup         |    3 +++
 lib/sup/hook.rb |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/bin/sup b/bin/sup
index ef4092f..8638c78 100755
--- a/bin/sup
+++ b/bin/sup
@@ -86,6 +86,7 @@ global_keymap = Keymap.new do |k|
   k.add :nothing, "Do nothing", :ctrl_g
   k.add :recall_draft, "Edit most recent draft message", 'R'
   k.add :show_inbox, "Show the Inbox buffer", 'I'
+  k.add :clear_hooks, "Clear all hooks", 'H'
   k.add :show_console, "Show the Console buffer", '~'
 
   ## Submap for less often used keybindings
@@ -330,6 +331,8 @@ begin
       end
     when :show_inbox
       BufferManager.raise_to_front ibuf
+    when :clear_hooks
+      HookManager.clear
     when :show_console
       b, new = bm.spawn_unless_exists("Console", :system => true) { ConsoleMode.new }
       b.mode.run
diff --git a/lib/sup/hook.rb b/lib/sup/hook.rb
index 08738cd..a2a39a5 100644
--- a/lib/sup/hook.rb
+++ b/lib/sup/hook.rb
@@ -112,7 +112,7 @@ EOS
 
   def enabled? name; !hook_for(name).nil? end
 
-  def clear; @hooks.clear; end
+  def clear; @hooks.clear; BufferManager.flash "Hooks cleared" end
   def clear_one k; @hooks.delete k; end
 
 private
-- 
1.7.0

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


             reply	other threads:[~2010-05-14 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 15:22 Ben Walton [this message]
2010-05-14 16:05 ` Rich Lane

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=1273850544-16363-1-git-send-email-bwalton@artsci.utoronto.ca \
    --to=bwalton@artsci.utoronto.ca \
    --cc=sup-devel@rubyforge.org \
    /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