Re: Generate Reply / New Mail in new shell session

2007-10-06 Thread Eyolf Østrem
On 05.10.2007 (10:05), Christian Ebert wrote:
 * Eyolf Østrem on Friday, October 05, 2007 at 01:07:39 +0200
 
 a lilyponder ;)

Yep!

 The following works in a dirty way --

It didn't quite work for me, still. I may play around with different
flags and such, but in the end, it isn't really *that* important to
me. But thanks for the script anyway. 

Eyolf
-- 
The faster we go, the rounder we get.
-- The Grateful Dead


Re: Generate Reply / New Mail in new shell session

2007-10-06 Thread Christian Ebert
* Eyolf Østrem on Saturday, October 06, 2007 at 14:39:41 +0200
 It didn't quite work for me, still. I may play around with different
 flags and such, but in the end, it isn't really *that* important to
 me. But thanks for the script anyway. 

I was more interested in Screen, but this works here for xterm:


#!/bin/sh
DRAFT=$1
cp $DRAFT $DRAFT.tmp
(
xterm -e exec mutt -H \$DRAFT.tmp\
sleep 1
rm -f $DRAFT.tmp
) 

exit 0


c
-- 
strangely, i became more bookish
and my home and study meant more to me
as i considered the circumstances of my death
--Iggy Pop, No Shit


Re: Generate Reply / New Mail in new shell session

2007-10-05 Thread Christian Ebert
* Eyolf Østrem on Friday, October 05, 2007 at 01:07:39 +0200

a lilyponder ;)

 On 04.10.2007 (13:13), Gary Johnson wrote:
 On 2007-10-04, David Champion [EMAIL PROTECTED] wrote:
 
 $ cat external-reply
 #!/bin/sh
 DRAFT=$1
 # hard-link our own copy of the draft so that mutt can remove original
 ln $DRAFT $DRAFT.tmp
 
 I don't think that will work.  I think you'll need to copy it.  The 
 reason is that mutt overwrites its temporary files with zeros before 
 unlinking them.
 
 I can confirm that it doesn't work. The new xterm flashes over the
 screen for a splitsecond, but then it's gone, and the original mutt
 window behaves as if the mail has been written, ready to be sent.

The following works in a dirty way -- you are prompted for
address and subject both in the old and new instances of Mutt,
but this should be solvable by macro. I made it for GNU screen,
but probably something similar works for xterm as well. One needs
sleep because Mutt is too fast in unlinking the tmp file (work
around sleep with touch doesn't seem to work here). I also
believe that you have to stick with $DRAFT.tmp vs $DRAFT.


#!/bin/sh
#[ -n $STY ] || exit 1 # test whether we are in running Screen
DRAFT=$1
cp $DRAFT $DRAFT.tmp
(
screen -X screen mutt -H $DRAFT.tmp ### works
# xterm -e exec mutt -H $DRAFT.tmp ### untested
sleep 1
rm -f $DRAFT.tmp
) 
exit 0

c
-- 
Python Mutt utilities http://www.blacktrash.org/hg/muttils/


Re: Generate Reply / New Mail in new shell session

2007-10-05 Thread Gary Johnson
On 2007-10-05, Christian Ebert [EMAIL PROTECTED] wrote:
 * Eyolf Østrem on Friday, October 05, 2007 at 01:07:39 +0200
 
 a lilyponder ;)
 
  On 04.10.2007 (13:13), Gary Johnson wrote:
  On 2007-10-04, David Champion [EMAIL PROTECTED] wrote:
  
  $ cat external-reply
  #!/bin/sh
  DRAFT=$1
  # hard-link our own copy of the draft so that mutt can remove original
  ln $DRAFT $DRAFT.tmp
  
  I don't think that will work.  I think you'll need to copy it.  The 
  reason is that mutt overwrites its temporary files with zeros before 
  unlinking them.
  
  I can confirm that it doesn't work. The new xterm flashes over the
  screen for a splitsecond, but then it's gone, and the original mutt
  window behaves as if the mail has been written, ready to be sent.
 
 The following works in a dirty way -- you are prompted for
 address and subject both in the old and new instances of Mutt,
 but this should be solvable by macro. I made it for GNU screen,
 but probably something similar works for xterm as well. One needs
 sleep because Mutt is too fast in unlinking the tmp file (work
 around sleep with touch doesn't seem to work here).

If the script doesn't return to the first mutt until the cp 
operation is done, and if the second mutt is the only user of 
$DRAFT.tmp, and if the second mutt exits before the rm is executed, 
why do you need the sleep?

 I also believe that you have to stick with $DRAFT.tmp vs $DRAFT. 
 
 
 #!/bin/sh
 #[ -n $STY ] || exit 1 # test whether we are in running Screen
 DRAFT=$1
 cp $DRAFT $DRAFT.tmp
 (
 screen -X screen mutt -H $DRAFT.tmp ### works
 # xterm -e exec mutt -H $DRAFT.tmp ### untested
 sleep 1
 rm -f $DRAFT.tmp
 ) 
 exit 0

Regards,
Gary


Re: Generate Reply / New Mail in new shell session

2007-10-05 Thread Christian Ebert
* Gary Johnson on Friday, October 05, 2007 at 07:40:03 -0700
 On 2007-10-05, Christian Ebert [EMAIL PROTECTED] wrote:
 The following works in a dirty way -- you are prompted for
 address and subject both in the old and new instances of Mutt,
 but this should be solvable by macro. I made it for GNU screen,
 but probably something similar works for xterm as well. One needs
 sleep because Mutt is too fast in unlinking the tmp file (work
 around sleep with touch doesn't seem to work here).
 
 If the script doesn't return to the first mutt until the cp 
 operation is done, and if the second mutt is the only user of 
 $DRAFT.tmp, and if the second mutt exits before the rm is executed, 
 why do you need the sleep?

Trial and error ;) Of course I first tried sleepless, but then
I got the Aborted unmodified message. error.

 #!/bin/sh
 #[ -n $STY ] || exit 1 # test whether we are in running Screen
 DRAFT=$1
 cp $DRAFT $DRAFT.tmp
 (
screen -X screen mutt -H $DRAFT.tmp ### works
# xterm -e exec mutt -H $DRAFT.tmp ### untested
sleep 1
rm -f $DRAFT.tmp
 ) 
 exit 0

Speculation: mutt -H returns success somewhere right before it
calls the editor on $DRAFT.tmp.

Probably there are better ways to do this. For Screen an
interesting alternative would be to open a split region.

c
-- 
Python Mutt utilities http://www.blacktrash.org/hg/muttils/


Re: Generate Reply / New Mail in new shell session

2007-10-04 Thread Eyolf Østrem
On 03.10.2007 (21:57), Joseph wrote:
 It would be nice if it was possible to start a New Email or Replies in a new 
 shell session and close it 
 automatically when a mail is sent, without, going through postpone.
 
 Is it possible?
 
 Sometimes I have to look up/collect some information from several older 
 emails so this kind of functionality 
 would really be handy.

I was missing that functionality too. I solved it the other way
around: open a new instance of mutt. It's a one-keypress thing (I have
a desktop keyboard shortcut win-m set up to run xterm -e mutt), and
the effect is, I believe, the same as what you describe. One thing I
can't do that way is to tag several messages and add them to what I'm
replying to, but how often do I do that...?


Eyolf

-- 
Life does not begin at the moment of conception or the moment of birth.
It begins when the kids leave home and the dog dies.


Re: Generate Reply / New Mail in new shell session

2007-10-04 Thread Charles Killian
  It would be nice if it was possible to start a New Email or Replies in a 
  new shell session and close it 
  automatically when a mail is sent, without, going through postpone.
 
 I was missing that functionality too. I solved it the other way
 around: open a new instance of mutt. 

When necessary, I too have resorted to this workaround.  However, I'd
like to put in another vote for the actual functionality requested.
Opening another Mutt is a bit less convenient if you're using something
like IMAP to get to your messages, and particularly so if IMAP isn't
supporting simultaneous readers on the same mailbox.

-Chip

-- 

Chip Killian
http://www.cs.ucsd.edu/~ckillian/
UCSD Graduate Student, Computer Science


Re: Generate Reply / New Mail in new shell session

2007-10-04 Thread David Champion
 It would be nice if it was possible to start a New Email or Replies in
 a new shell session and close it automatically when a mail is sent,
 without, going through postpone.

 Is it possible?

Check the archives -- possibly a few years back.  People have posted
examples of how to do this using an external script and a macro.

Basically you generate a draft file as normally, but set your editor to
an external script that launches a new mutt instance in a new window
using that draft file as a template.  Then restore $editor and move on.
Should be even easier now, with my_ variables.

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago
 Polka music needs to prevail.   John Ziobrowski, Polka America Corporation


Re: Generate Reply / New Mail in new shell session

2007-10-04 Thread Joseph
On 10/04/07 10:59, David Champion wrote:
  It would be nice if it was possible to start a New Email or Replies in
  a new shell session and close it automatically when a mail is sent,
  without, going through postpone.
 
  Is it possible?
 
 Check the archives -- possibly a few years back.  People have posted
 examples of how to do this using an external script and a macro.
 
 Basically you generate a draft file as normally, but set your editor to
 an external script that launches a new mutt instance in a new window
 using that draft file as a template.  Then restore $editor and move on.
 Should be even easier now, with my_ variables.

All I was able to find is a solution with Ctrl-z putting it in a background 
and starting new session.
That is not really a solution.

I'm sure somebody has similar macro worked out, it is just a mutter of finding 
it :-/

-- 
#Joseph
GPG KeyID: ED0E1FB7


Re: Generate Reply / New Mail in new shell session

2007-10-04 Thread David Champion
 All I was able to find is a solution with Ctrl-z putting it in a
 background and starting new session.  That is not really a solution.

Agreed.  That's not it.


 I'm sure somebody has similar macro worked out, it is just a mutter of 
 finding it :-/

Something along these lines might work.  Untested.  It's been years
since I used xterm, so I'm not sure if the syntax below is correct for
expressing what xterm should run.  Might need to add sh -c and quoting,
or somesuch.  Maybe you need some more dressing, but perhaps this will
get you started.

If you want this only sometimes, you'll need to macro-fy the muttrc
bits.


$ cat external-reply
#!/bin/sh
DRAFT=$1
# hard-link our own copy of the draft so that mutt can remove original
ln $DRAFT $DRAFT.tmp
(
## execute this in a bkgrounded subshell,
## allowing the original shell to exit
xterm -e exec mutt -H '$DRAFT'
rm -f $DRAFT
) 
exit 0

.muttrc:
set editor=external-reply

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago
 Polka music needs to prevail.   John Ziobrowski, Polka America Corporation


Re: Generate Reply / New Mail in new shell session

2007-10-04 Thread Gary Johnson
On 2007-10-04, David Champion [EMAIL PROTECTED] wrote:

 Something along these lines might work.  Untested.  It's been years
 since I used xterm, so I'm not sure if the syntax below is correct for
 expressing what xterm should run.  Might need to add sh -c and quoting,
 or somesuch.  Maybe you need some more dressing, but perhaps this will
 get you started.
 
 If you want this only sometimes, you'll need to macro-fy the muttrc
 bits.
 
 
 $ cat external-reply
 #!/bin/sh
 DRAFT=$1
 # hard-link our own copy of the draft so that mutt can remove original
 ln $DRAFT $DRAFT.tmp

I don't think that will work.  I think you'll need to copy it.  The 
reason is that mutt overwrites its temporary files with zeros before 
unlinking them.

Regards,
Gary


Generate Reply / New Mail in new shell session

2007-10-03 Thread Joseph
It would be nice if it was possible to start a New Email or Replies in a new 
shell session and close it 
automatically when a mail is sent, without, going through postpone.

Is it possible?

Sometimes I have to look up/collect some information from several older emails 
so this kind of functionality 
would really be handy.

-- 
#Joseph
GPG KeyID: ED0E1FB7