* [sup-talk] [PATCH] run-mailcap fix
@ 2009-08-02 15:23 Benoît PIERRE
2009-08-11 20:28 ` William Morgan
0 siblings, 1 reply; 8+ messages in thread
From: Benoît PIERRE @ 2009-08-02 15:23 UTC (permalink / raw)
I use this line in my ~/.mailcap to view HTML attachements in Mutt:
text/html; w3m -dump -T text/html %s | pager; needsterminal; description=HTML Text; nametemplate=%s.html
which doesn't work with Sup. The attached patch fix this by not redirecting
stderr to /dev/null. It also restores the correct ncurses state (including
arrow keypresses, thanks to Edward Z. Yang recent patch).
--
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup-run-mailcap.patch
Type: application/octet-stream
Size: 704 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090802/1fa7b4f6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090802/1fa7b4f6/attachment.bin>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] [PATCH] run-mailcap fix
2009-08-02 15:23 [sup-talk] [PATCH] run-mailcap fix Benoît PIERRE
@ 2009-08-11 20:28 ` William Morgan
2009-08-11 22:09 ` [sup-talk] [PATCH run-mailcap 1/2] Don't redirect stderr to /dev/null when calling run-mailcap Benoît PIERRE
0 siblings, 1 reply; 8+ messages in thread
From: William Morgan @ 2009-08-11 20:28 UTC (permalink / raw)
Hi Beno?t,
Reformatted excerpts from Beno?t PIERRE's message of 2009-08-02:
> The attached patch fix this by not redirecting stderr to /dev/null.
> It also restores the correct ncurses state (including arrow
> keypresses, thanks to Edward Z. Yang recent patch).
Thanks! Not redirecting stderr to /dev/null is probably fine. But how
about calling BufferManager.shell_out instead?
If you want to submit a proper git commit via git-format-email, I will
be happy to apply it and you can get your name in the illustrious Sup
contributor roster. Otherwise I will make this change for you.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] [PATCH run-mailcap 1/2] Don't redirect stderr to /dev/null when calling run-mailcap.
2009-08-11 20:28 ` William Morgan
@ 2009-08-11 22:09 ` Benoît PIERRE
2009-08-11 22:09 ` [sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system Benoît PIERRE
0 siblings, 1 reply; 8+ messages in thread
From: Benoît PIERRE @ 2009-08-11 22:09 UTC (permalink / raw)
Some programs will fail to work correctly if this is done, like for
example: w3m --dump, to view HTML files.
---
lib/sup/message-chunks.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 0d742d9..4c947e1 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -131,7 +131,7 @@ EOS
def initial_state; :open end
def viewable?; @lines.nil? end
def view_default! path
- cmd = "/usr/bin/run-mailcap --action=view '#{@content_type}:#{path}' 2>/dev/null"
+ cmd = "/usr/bin/run-mailcap --action=view '#{@content_type}:#{path}'"
Redwood::log "running: #{cmd.inspect}"
system cmd
$? == 0
--
1.6.3.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system.
2009-08-11 22:09 ` [sup-talk] [PATCH run-mailcap 1/2] Don't redirect stderr to /dev/null when calling run-mailcap Benoît PIERRE
@ 2009-08-11 22:09 ` Benoît PIERRE
2009-08-14 20:17 ` William Morgan
0 siblings, 1 reply; 8+ messages in thread
From: Benoît PIERRE @ 2009-08-11 22:09 UTC (permalink / raw)
This ensure ncurses state is correctly restored upon command completion.
---
lib/sup/message-chunks.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 4c947e1..1910abd 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -133,7 +133,7 @@ EOS
def view_default! path
cmd = "/usr/bin/run-mailcap --action=view '#{@content_type}:#{path}'"
Redwood::log "running: #{cmd.inspect}"
- system cmd
+ BufferManager.shell_out(cmd)
$? == 0
end
--
1.6.3.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system.
2009-08-11 22:09 ` [sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system Benoît PIERRE
@ 2009-08-14 20:17 ` William Morgan
2009-08-14 22:37 ` Benoît PIERRE
0 siblings, 1 reply; 8+ messages in thread
From: William Morgan @ 2009-08-14 20:17 UTC (permalink / raw)
Reformatted excerpts from Beno?t PIERRE's message of 2009-08-11:
> This ensure ncurses state is correctly restored upon command completion.
Both patches applies to branch run-mailcap-fixes, merged into next.
Thanks!
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system.
2009-08-14 20:17 ` William Morgan
@ 2009-08-14 22:37 ` Benoît PIERRE
2009-08-14 23:08 ` [sup-talk] [PATCH] Restore keypad mode after we force ncurses to refresh the whole screen Benoît PIERRE
0 siblings, 1 reply; 8+ messages in thread
From: Benoît PIERRE @ 2009-08-14 22:37 UTC (permalink / raw)
Excerpts from William Morgan's message of Fri Aug 14 22:17:38 +0200 2009:
> Reformatted excerpts from Beno?t PIERRE's message of 2009-08-11:
> > This ensure ncurses state is correctly restored upon command completion.
>
> Both patches applies to branch run-mailcap-fixes, merged into next.
Great!
One problem though, I tested next, and 3478e400ae31b459b2875cc226796a6d4bba11f9
(rewrap getch in select, handle sigwinch manually) introduced a regression: I
get some 'key not handled' errors after run-mail has been called when sup is
getting back control if I press for example an arrow... ;(
Arrows become usable again after I press a "normal" key (like 'a').
Cheers,
--
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] [PATCH] Restore keypad mode after we force ncurses to refresh the whole screen.
2009-08-14 22:37 ` Benoît PIERRE
@ 2009-08-14 23:08 ` Benoît PIERRE
2009-08-16 22:00 ` William Morgan
0 siblings, 1 reply; 8+ messages in thread
From: Benoît PIERRE @ 2009-08-14 23:08 UTC (permalink / raw)
This also happen to fix a regression after a call to run-mailcap, since
for some reason a screen resize event is triggered when we get control
back...
---
lib/sup/buffer.rb | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index b3a256f..09281e9 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -270,6 +270,7 @@ EOS
## this magic makes Ncurses get the new size of the screen
Ncurses.endwin
+ Ncurses.stdscr.keypad 1
Ncurses.refresh
@sigwinch_mutex.synchronize { @sigwinch_happened = false }
Redwood::log "new screen size is #{Ncurses.rows} x #{Ncurses.cols}"
--
1.6.3.3
--
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090815/a67dfe70/attachment.bin>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-16 22:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-02 15:23 [sup-talk] [PATCH] run-mailcap fix Benoît PIERRE
2009-08-11 20:28 ` William Morgan
2009-08-11 22:09 ` [sup-talk] [PATCH run-mailcap 1/2] Don't redirect stderr to /dev/null when calling run-mailcap Benoît PIERRE
2009-08-11 22:09 ` [sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system Benoît PIERRE
2009-08-14 20:17 ` William Morgan
2009-08-14 22:37 ` Benoît PIERRE
2009-08-14 23:08 ` [sup-talk] [PATCH] Restore keypad mode after we force ncurses to refresh the whole screen Benoît PIERRE
2009-08-16 22:00 ` William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox