Re: Editing a set of Subject lines

2002-01-23 Thread Jim Osborn

On Wed, Jan 23, 2002 at 06:44:20AM -0500, David T-G wrote:
 I presume, then, that they can't thread properly, either.  Hmmm.  I
 wonder what mailer such contributors are using... ;-)

Not usually Mutt. :)  Often the subject will be completely
off, say the ever popular, Re: blah blah Digest #58.
Or, another favorite: (no subject).  Sometimes followups
will change to something more sensible; sometimes I want to
change an entire thread's subject to something meaningful
so I can find it (I'd be simply deleting it if I didn't think
I'd want to find it later).  So, somebody starts a thread with
subject: Help! and eventually somebody else supplies some
really interesting tidbits about dynamic optimization.
Well... you get the idea.


 % I tried the '|' pipe function, ;|... piping to:
 % 
 %   sed 's/^Subject: .*$/Subject: Re: This Thread.../'
 % 
 % but nothing happened, except for seeing the last tagged
 % mail on my screen with press any key to continue...
 % at the bottom.
 
 Of course...  You simply shot a lot of messages out to a shell command;
 nothing said to read them back into your spool again.

Ah, I now understand more about that pipe function.
If I use:

  sed 's/^Subject: .*$/Subject: Re: This Thread.../' ~/path-to-folder

then the new-subject messages do appear, so maybe this is a
quick solution.  I assume there isn't a builtin variable for
path-to-folder that would work in the line above.  

Obviously, when I really start using this, I'll make a little shell
script that encapsulates all the sed ugliness and takes This
Thread... as an argument; if I could also feed it the folder name
symbolically, so much the better, but I suspect I'll have to tell
that to the shell environment myself, outside Mutt. 

BTW, is there a way to avoid the screen display, the press
any key to continue... bit?  It erases the xterm screen;
no big deal, but if I could avoid the erasure it'd be nice.


 % Can I do this Subject-line editing in Mutt?
 % I'm using 1.2.5.1.
 
 I don't think that you can ;e to tag-prefixedit-message but if you
 can upgrade to 1.3.x (currently .27) you could apply Cedric Duval's
 excellent edit_threads patch and just fix the threading itself.  It's
 quite cool.

I'll definitely check that out.  1.3.25 said I needed to install
the iconv stuff, so I've got that on the top of my to-do stack.

Thanks again,

Jim



Re: Editing a set of Subject lines

2002-01-23 Thread David Champion

On 2002.01.22, in [EMAIL PROTECTED],
Jim [EMAIL PROTECTED] wrote:
 Is there a graceful way to change the Subject: lines on
 a set of tagged messages?  Often folks will change the
 ...
 I tried the '|' pipe function, ;|... piping to:
 
   sed 's/^Subject: .*$/Subject: Re: This Thread.../'

You could try writing a macro that sets $editor to a shell script that:

a. filters its $1 argument through a suitable sed command (I'd prefer
formail, personally), then replaces the original $1 file;
b. invokes edit
c. sets $editor back to its default value

Your script could even prompt for the new subject line. Hmm -- something
like:

macro index Z enter-commandset 
editor='mutt-subject-munge'entereditenter-commandset 
editor='the-one-true-editor'enter

% cat $HOME/bin/mutt-subject-change
#!/bin/sh
umask 077
echo Enter the new subject: \c
read subject
formail -i Subject: $subject: $1 $1.2
mv -f $1.2 $1


All untested, of course. No warranties.

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago