* [sup-talk] Setting reply to -- hook or config?
@ 2008-04-05 5:48 Jeff Balogh
2008-04-24 5:23 ` [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field Jeff Balogh
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Balogh @ 2008-04-05 5:48 UTC (permalink / raw)
I'm terrible at remembering to reply to all, and today I realized that sup can
help!
I started off making a reply-to hook that takes the array of types sup is
planning to offer in the Reply To field. I thought the hook would do some fancy
logic and return the right type. Then I realized I could just list the order of
my reply-to preferences, and pick the first element of the intersection.
([:list, :all] & types)[0]
The return value is only used if it's in the types array, so no worries about
nil.
A hook seems like overkill for this one-liner, so maybe it would be more
appropriate for config.yaml? It makes sense as something in config, but I
hesitate because it would be the first code object (well, the first that _looks_
like code), and because less config variables is good.
-- jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field.
2008-04-05 5:48 [sup-talk] Setting reply to -- hook or config? Jeff Balogh
@ 2008-04-24 5:23 ` Jeff Balogh
2008-04-24 5:56 ` Marc Hartstein
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Balogh @ 2008-04-24 5:23 UTC (permalink / raw)
I prefer to reply to a mailing list, then all participants:
$ cat .sup/hooks/reply-to.rb
([:list, :all] & types)[0]
---
I've been happily using this locally, and forgot to send it to the list. :P
lib/sup/modes/reply-mode.rb | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index e7b2929..ad50fed 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -19,6 +19,14 @@ Return value:
A string containing the text of the quote line (can be multi-line)
EOS
+ HookManager.register "reply-to", <<EOS
+Set the Reply To field.
+Variables:
+ types: the valid types to choose from
+Return value:
+ The reply type you desire, or nil to let sup set it.
+EOS
+
def initialize message
@m = message
@@ -92,8 +100,13 @@ EOS
types = REPLY_TYPES.select { |t| @headers.member?(t) }
@type_selector = HorizontalSelector.new "Reply to:", types, types.map { |x| TYPE_DESCRIPTIONS[x] }
+ hook_reply = HookManager.run "reply-to", :types => types
+ Redwood::log hook_reply.to_s
+
@type_selector.set_to(
- if @m.is_list_message?
+ if types.include? hook_reply
+ hook_reply
+ elsif @m.is_list_message?
:list
elsif @headers.member? :sender
:sender
--
1.5.5.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field.
2008-04-24 5:23 ` [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field Jeff Balogh
@ 2008-04-24 5:56 ` Marc Hartstein
2008-04-24 14:38 ` Jeff Balogh
0 siblings, 1 reply; 6+ messages in thread
From: Marc Hartstein @ 2008-04-24 5:56 UTC (permalink / raw)
Excerpts from its.jeff.balogh's message of Thu Apr 24 01:23:10 -0400 2008:
> I prefer to reply to a mailing list, then all participants:
>
> $ cat .sup/hooks/reply-to.rb
> ([:list, :all] & types)[0]
Neat. For reference for anybody interested in using this, possible
values are in lib/sup/modes/reply-mode.rb:5
:sender => "Sender",
:recipient => "Recipient",
:all => "All",
:list => "Mailing list",
:user => "Customized"
The default behavior should be equivalent [see line 97] to
([:list, :sender, :recipient] & types)[0]
Is there a reason you ended up going with a hook?
I wonder if the hook should be provided with the current message for
fuller processing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080424/1ab3f2e6/attachment.bin
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field.
2008-04-24 5:56 ` Marc Hartstein
@ 2008-04-24 14:38 ` Jeff Balogh
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Balogh @ 2008-04-24 14:38 UTC (permalink / raw)
marc.hartstein wrote:
> Excerpts from its.jeff.balogh's message of Thu Apr 24 01:23:10 -0400 2008:
> > I prefer to reply to a mailing list, then all participants:
> >
> > $ cat .sup/hooks/reply-to.rb
> > ([:list, :all] & types)[0]
>
> Neat. For reference for anybody interested in using this, possible
> values are in lib/sup/modes/reply-mode.rb:5
>
> :sender => "Sender",
> :recipient => "Recipient",
> :all => "All",
> :list => "Mailing list",
> :user => "Customized"
>
> The default behavior should be equivalent [see line 97] to
> ([:list, :sender, :recipient] & types)[0]
Thanks. Your documentation skills far exceed mine. :)
> Is there a reason you ended up going with a hook?
1. Laziness.
2. Reluctance to add to config.
3. Because I expected someone might want to be fancier, maybe getting the
message for fuller processing.
> I wonder if the hook should be provided with the current message for
> fuller processing.
If you (or anyone) finds that useful, we can add it. I left it out to keep the
hook simple.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field.
@ 2008-04-27 6:50 William Morgan
0 siblings, 0 replies; 6+ messages in thread
From: William Morgan @ 2008-04-27 6:50 UTC (permalink / raw)
Reformatted excerpts from William Morgan's message of 2008-04-26:
> Maybe add the list of allowable return values.
Heck, you could generate this automatically. Self-documenting code,
literally!
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field.
@ 2008-04-27 6:49 William Morgan
0 siblings, 0 replies; 6+ messages in thread
From: William Morgan @ 2008-04-27 6:49 UTC (permalink / raw)
Reformatted excerpts from its.jeff.balogh's message of 2008-04-23:
> $ cat .sup/hooks/reply-to.rb
> ([:list, :all] & types)[0]
I'd be happy to put this in, but agree that it needs slightly better
documntation. Maybe add the list of allowable return values. And saying
it sets the "Reply To field" isn't quite accurate--more like it sets the
default reply-to "mode". Minor nitpicks, but I can see someone being
confused by the output of sup --list-hooks.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-27 6:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-05 5:48 [sup-talk] Setting reply to -- hook or config? Jeff Balogh
2008-04-24 5:23 ` [sup-talk] [PATCH] add a reply-to hook, for setting the Reply To field Jeff Balogh
2008-04-24 5:56 ` Marc Hartstein
2008-04-24 14:38 ` Jeff Balogh
2008-04-27 6:49 William Morgan
2008-04-27 6:50 William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox