Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] mime-view
@ 2008-02-19  4:01 Daniel Wagner
  2008-02-19 17:32 ` William Morgan
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Wagner @ 2008-02-19  4:01 UTC (permalink / raw)


Hello,

Recently, activating attachments has stopped working.  (I can't be more
specific about when this started; it could have been at the upgrade to
0.4, or weeks after, I'm not sure.)  I get a message like "Couldn't view
the attachment, opening as text", which obviously doesn't work well for
a large variety of attachments.

I verified that sup is detecting the correct mime-type, and that saving
the file to disk and manually running "see" did the Right Thing.  I also
tried adding a hook; the contents of my ~/.sup/hooks/mime-view.rb:

system "xmessage -default okay In the hook."
system "see #{content_type}:#{filename}"
return true

The xmessage window appears.  Still, this is pieced together from the
examples on the wiki and the comments in message-chunks.rb; I have no
real knowledge of Ruby.  Please let me know if I've written nonsense.
In any case, still no luck.

Any clues on what I should do?  Thanks.
~d


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

* [sup-talk] mime-view
  2008-02-19  4:01 [sup-talk] mime-view Daniel Wagner
@ 2008-02-19 17:32 ` William Morgan
  2008-02-19 17:54   ` John Bent
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: William Morgan @ 2008-02-19 17:32 UTC (permalink / raw)


Reformatted excerpts from Daniel Wagner's message of 2008-02-18:
> Recently, activating attachments has stopped working.

You know, in reexamining this code, I think there is a silly bug here,
and I think it also caused the weirdness that John Bent was experiencing
a few weeks ago.

Can you try the latest (master/next) from git, or apply the following
patch:

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 0606395..ba8b846 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -126,7 +126,7 @@ EOS
       path = write_to_disk
       ret = HookManager.run "mime-view", :content_type => @content_type,
                                          :filename => path
-      view_default! path unless ret
+      ret || view_default!(path)
     end
 
     def write_to_disk

> system "xmessage -default okay In the hook."
> system "see #{content_type}:#{filename}"
> return true

This looks fine, though I would change the last line to just
  $?.success?

which will evaluate to true iff the see command was successful. With
the above change, everything should Just Work (tm).

-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] mime-view
  2008-02-19 17:32 ` William Morgan
@ 2008-02-19 17:54   ` John Bent
  2008-02-19 17:56     ` William Morgan
  2008-02-19 18:23   ` William Morgan
  2008-02-20  6:59   ` Daniel Wagner
  2 siblings, 1 reply; 6+ messages in thread
From: John Bent @ 2008-02-19 17:54 UTC (permalink / raw)


Excerpts from William Morgan's message of Tue Feb 19 10:32:57 -0700 2008:
> Reformatted excerpts from Daniel Wagner's message of 2008-02-18:
> > Recently, activating attachments has stopped working.
> 
> You know, in reexamining this code, I think there is a silly bug here,
> and I think it also caused the weirdness that John Bent was experiencing
> a few weeks ago.
> 
That's a relief.  I thought I was the cause of the weirdness.  This works
great; thanks.  Now my hooks/mime-view.rb (for a mac) is:
###########################
system "open '#{filename}'"
###########################

Thanks all!

John


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

* [sup-talk] mime-view
  2008-02-19 17:54   ` John Bent
@ 2008-02-19 17:56     ` William Morgan
  0 siblings, 0 replies; 6+ messages in thread
From: William Morgan @ 2008-02-19 17:56 UTC (permalink / raw)


Reformatted excerpts from John Bent's message of 2008-02-19:
> That's a relief.  I thought I was the cause of the weirdness.  This
> works great; thanks.

Good to hear. Stupidest bug evar. Don't know how I missed it before.

-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] mime-view
  2008-02-19 17:32 ` William Morgan
  2008-02-19 17:54   ` John Bent
@ 2008-02-19 18:23   ` William Morgan
  2008-02-20  6:59   ` Daniel Wagner
  2 siblings, 0 replies; 6+ messages in thread
From: William Morgan @ 2008-02-19 18:23 UTC (permalink / raw)


Reformatted excerpts from William Morgan's message of 2008-02-19:
> Reformatted excerpts from Daniel Wagner's message of 2008-02-18:
> > system "xmessage -default okay In the hook."
> > system "see #{content_type}:#{filename}"
> > return true
> 
> This looks fine, though I would change the last line to just
>   $?.success?

Never mind that. Remove the last (and first!) line completely.
Kernel#system returns true iff the command is successful.

-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] mime-view
  2008-02-19 17:32 ` William Morgan
  2008-02-19 17:54   ` John Bent
  2008-02-19 18:23   ` William Morgan
@ 2008-02-20  6:59   ` Daniel Wagner
  2 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2008-02-20  6:59 UTC (permalink / raw)


Excerpts from William Morgan's message of Tue Feb 19 09:32:57 -0800 2008:
> Reformatted excerpts from Daniel Wagner's message of 2008-02-18:
> > Recently, activating attachments has stopped working.
> 
> You know, in reexamining this code, I think there is a silly bug here,
> and I think it also caused the weirdness that John Bent was experiencing
> a few weeks ago.
> 
> Can you try the latest (master/next) from git, or apply the following
> patch:

Applied it (by hand), still no joy.  BUT!  On a little more digging, it
looks like the #{} syntax wasn't properly escaping spaces in the
filename.  A few \" later, I'm back in business.

system "see #{content_type}:\"#{filename}\""

Thanks,
~d


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

end of thread, other threads:[~2008-02-20  6:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19  4:01 [sup-talk] mime-view Daniel Wagner
2008-02-19 17:32 ` William Morgan
2008-02-19 17:54   ` John Bent
2008-02-19 17:56     ` William Morgan
2008-02-19 18:23   ` William Morgan
2008-02-20  6:59   ` Daniel Wagner

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