Re: changing the subject line of a thread
Hi, * martin f krafft [07-08-28 15:14:21 +0200] wrote: An alternative would have of course been to set $editor to the sed -i command, but I could not get this working. Even setting editor=sed -i -e '/./d' just got me message not modified. This is fixed in tip already. The problem is that mutt lets tools edit tempfiles rather than real message files in a Maildir and detects changes by a mtime change to copy it back. However, sed -i is simply too fast for the old code. bye, Rocco -- :wq!
Re: changing the subject line of a thread
also sprach Gary Johnson [EMAIL PROTECTED] [2007.08.31.0746 +0200]: Patch submitted to mutt-dev. Muchas gracias! -- martin; (greetings from the heart of the sun.) \ echo mailto: !#^.*|tr * mailto:; [EMAIL PROTECTED] it may look like i'm just sitting here doing nothing. but i'm really actively waiting for all my problems to go away. spamtraps: [EMAIL PROTECTED] digital_signature_gpg.asc Description: Digital signature (see http://martin-krafft.net/gpg/)
Re: changing the subject line of a thread
On 2007-08-29, Gary Johnson [EMAIL PROTECTED] wrote: On 2007-08-29, Holger Weiss [EMAIL PROTECTED] wrote: * Kyle Wheeler [EMAIL PROTECTED] [2007-08-28 13:58]: On Tuesday, August 28 at 03:14 PM, quoth martin f krafft: So I wanted to change the subject line on all thread mails. First, I missed the pass (Maildir) files of tagged messages to external command as *arguments* command in mutt, so I had to create a new folder and put the files in there, then go to the shell and invoke sed. An alternative would have of course been to set $editor to the sed -i command, but I could not get this working. Even setting editor=sed -i -e '/./d' just got me message not modified. HEH. This *would* work, if you were on a much slower machine (or if you just got really lucky). The way mutt determines whether a file is modified is by comparing the mtime of the temp file it created to the mtime of the temp file once the editor is done editing. The mtime is stored in seconds. Sed, of course, executes in less than a second, so the mtime is unchanged in all but the rarest of cases. It would work if you'd piped it to a script like this: #!/bin/sh sleep 1 sed -i -e '/./d' $1 Because then the mtime would be guaranteed (more or less) to be different from when mutt created the tmp file. I worked around the same problem in some $editor script by incrementing the mtime via touch(1) as I didn't want the script to sleep(1). I guess it would be nice if Mutt (optionally?) used the MD5 sum or something instead of the mtime to check whether a file is modified. I was surprised by Kyle's comment because I thought mutt already did this, so I looked in the code. It turns out that mutt _sometimes_ does this. In the mutt_edit_headers() and ci_send_message() functions, mutt sets the mtime of the temporary file back one second before invoking the editor so that even if the editing occurs instantaneously, the mtime will be different after editing. Mutt then checks the mtime after invoking the editor to see if the file changed. Oddly, mutt does not do this in the edit_one_message() function which I think is the one being used in this case. I think this should be fixed. If folks agree and unless someone else wants to go for it, I can submit a patch. Patch submitted to mutt-dev. Regards, Gary
Re: changing the subject line of a thread / sed zen
also sprach Kyle Wheeler [EMAIL PROTECTED] [2007.08.28.2158 +0200]: you just got really lucky). The way mutt determines whether a file is modified is by comparing the mtime of the temp file it created to the mtime of the temp file once the editor is done editing. The mtime is stored in seconds. Sed, of course, executes in less than a second, so the mtime is unchanged in all but the rarest of cases. Perfect explanation, thanks Kyle! It would work if you'd piped it to a script like this: You don't even need an editor: set editor=sleep 1 sed -i -e ... works just as well. On that note, however, you probably want formail instead, due to multiline headers, but formail cannot edit in-place. Thus, you'll need a script. :( Or well, maybe not. The following sed -rn snippet extracts a multiline header (name stored in $1): :s;/^\$/q;/${1}/bj;d;:j;P;\$!n;/^[[:space:]]/bj;bs It should not be too hard to come up with a sed recipe that replaces the subject. My first try failed though (again, with -re): :s;/^$/be;/^Subject:/bj;P;:j;n;/^[[:space:]]/bj;=;bs;:e;p;:e2;n;p;be2 This correctly removes the subject. Where the = is, I wanted to insert a new Subject line: :s;/^$/be;/^Subject:/bj;P;:j;n;/^[[:space:]]/bj;iSubject: new -e bs;:e;p;:e2;n;p;be2 but for some reason, that gets called after *every* header. And yet, the script should never reach that except after encountering /^Subject:/ in the header, when it spins in the j loop until the next header is found. *Then* and only then should it insert the Subject. I am not a sed guru, so if anyone has a clue, please let me know. -- martin; (greetings from the heart of the sun.) \ echo mailto: !#^.*|tr * mailto:; [EMAIL PROTECTED] this message represents the official view of the voices in my head. spamtraps: [EMAIL PROTECTED] digital_signature_gpg.asc Description: Digital signature (see http://martin-krafft.net/gpg/)
Re: changing the subject line of a thread
* Kyle Wheeler [EMAIL PROTECTED] [2007-08-28 13:58]: On Tuesday, August 28 at 03:14 PM, quoth martin f krafft: So I wanted to change the subject line on all thread mails. First, I missed the pass (Maildir) files of tagged messages to external command as *arguments* command in mutt, so I had to create a new folder and put the files in there, then go to the shell and invoke sed. An alternative would have of course been to set $editor to the sed -i command, but I could not get this working. Even setting editor=sed -i -e '/./d' just got me message not modified. HEH. This *would* work, if you were on a much slower machine (or if you just got really lucky). The way mutt determines whether a file is modified is by comparing the mtime of the temp file it created to the mtime of the temp file once the editor is done editing. The mtime is stored in seconds. Sed, of course, executes in less than a second, so the mtime is unchanged in all but the rarest of cases. It would work if you'd piped it to a script like this: #!/bin/sh sleep 1 sed -i -e '/./d' $1 Because then the mtime would be guaranteed (more or less) to be different from when mutt created the tmp file. I worked around the same problem in some $editor script by incrementing the mtime via touch(1) as I didn't want the script to sleep(1). I guess it would be nice if Mutt (optionally?) used the MD5 sum or something instead of the mtime to check whether a file is modified. Holger
Re: changing the subject line of a thread
On 2007-08-29, Holger Weiss [EMAIL PROTECTED] wrote: * Kyle Wheeler [EMAIL PROTECTED] [2007-08-28 13:58]: On Tuesday, August 28 at 03:14 PM, quoth martin f krafft: So I wanted to change the subject line on all thread mails. First, I missed the pass (Maildir) files of tagged messages to external command as *arguments* command in mutt, so I had to create a new folder and put the files in there, then go to the shell and invoke sed. An alternative would have of course been to set $editor to the sed -i command, but I could not get this working. Even setting editor=sed -i -e '/./d' just got me message not modified. HEH. This *would* work, if you were on a much slower machine (or if you just got really lucky). The way mutt determines whether a file is modified is by comparing the mtime of the temp file it created to the mtime of the temp file once the editor is done editing. The mtime is stored in seconds. Sed, of course, executes in less than a second, so the mtime is unchanged in all but the rarest of cases. It would work if you'd piped it to a script like this: #!/bin/sh sleep 1 sed -i -e '/./d' $1 Because then the mtime would be guaranteed (more or less) to be different from when mutt created the tmp file. I worked around the same problem in some $editor script by incrementing the mtime via touch(1) as I didn't want the script to sleep(1). I guess it would be nice if Mutt (optionally?) used the MD5 sum or something instead of the mtime to check whether a file is modified. I was surprised by Kyle's comment because I thought mutt already did this, so I looked in the code. It turns out that mutt _sometimes_ does this. In the mutt_edit_headers() and ci_send_message() functions, mutt sets the mtime of the temporary file back one second before invoking the editor so that even if the editing occurs instantaneously, the mtime will be different after editing. Mutt then checks the mtime after invoking the editor to see if the file changed. Oddly, mutt does not do this in the edit_one_message() function which I think is the one being used in this case. I think this should be fixed. If folks agree and unless someone else wants to go for it, I can submit a patch. Regards, Gary
Re: changing the subject line of a thread
On Wednesday, 29 August 2007 at 08:57, Gary Johnson wrote: On 2007-08-29, Holger Weiss [EMAIL PROTECTED] wrote: * Kyle Wheeler [EMAIL PROTECTED] [2007-08-28 13:58]: HEH. This *would* work, if you were on a much slower machine (or if you just got really lucky). The way mutt determines whether a file is modified is by comparing the mtime of the temp file it created to the mtime of the temp file once the editor is done editing. The mtime is stored in seconds. Sed, of course, executes in less than a second, so the mtime is unchanged in all but the rarest of cases. It would work if you'd piped it to a script like this: #!/bin/sh sleep 1 sed -i -e '/./d' $1 Because then the mtime would be guaranteed (more or less) to be different from when mutt created the tmp file. I worked around the same problem in some $editor script by incrementing the mtime via touch(1) as I didn't want the script to sleep(1). I guess it would be nice if Mutt (optionally?) used the MD5 sum or something instead of the mtime to check whether a file is modified. I was surprised by Kyle's comment because I thought mutt already did this, so I looked in the code. It turns out that mutt _sometimes_ does this. In the mutt_edit_headers() and ci_send_message() functions, mutt sets the mtime of the temporary file back one second before invoking the editor so that even if the editing occurs instantaneously, the mtime will be different after editing. Mutt then checks the mtime after invoking the editor to see if the file changed. Oddly, mutt does not do this in the edit_one_message() function which I think is the one being used in this case. I think this should be fixed. If folks agree and unless someone else wants to go for it, I can submit a patch. That sounds like a good idea. But it would probably be good to set the mtime back to its original time after editing if the message isn't modified.
Re: changing the subject line of a thread
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday, August 29 at 09:06 AM, quoth Brendan Cully: Oddly, mutt does not do this in the edit_one_message() function which I think is the one being used in this case. I think this should be fixed. If folks agree and unless someone else wants to go for it, I can submit a patch. That sounds like a good idea. But it would probably be good to set the mtime back to its original time after editing if the message isn't modified. Out of curiosity, why? Mutt's just gonna delete that temporary file... deleted files with slightly incorrect mtimes are just as gone. ~Kyle - -- Time is an illusion. Lunchtime doubly so. -- Douglas Adams -BEGIN PGP SIGNATURE- Comment: Thank you for using encryption! iD8DBQFG1Zq6BkIOoMqOI14RAuzaAJ9GGhgdb/qbx+g1wYuLPGeQtRGX+wCfS7o8 /0beerYss+lpxrdP6uT332A= =oNAc -END PGP SIGNATURE-
Re: changing the subject line of a thread
On Wednesday, 29 August 2007 at 10:11, Kyle Wheeler wrote: On Wednesday, August 29 at 09:06 AM, quoth Brendan Cully: Oddly, mutt does not do this in the edit_one_message() function which I think is the one being used in this case. I think this should be fixed. If folks agree and unless someone else wants to go for it, I can submit a patch. That sounds like a good idea. But it would probably be good to set the mtime back to its original time after editing if the message isn't modified. Out of curiosity, why? Mutt's just gonna delete that temporary file... deleted files with slightly incorrect mtimes are just as gone. Whoops, right. I'd assumed mutt edited the message in place, but of course it doesn't. Time for coffee...
changing the subject line of a thread
Hi mutts, The world is full of people with email accounts, who have no idea how to email; or well, what it's like to get hundreds of messages in a day and try to stay on top of the information overload. So someone might reply to a work-related message, asking whether we should go to the cinema tonight. Usually I just delete such messages, but in one case, a massively interesting discussion evolved, and is now 25 messages long. I broke the thread ('#'), but since I have $strict_threads=off (and need that off because other correspondents use broken MUAs that don't generate I-R-T headers) and the subject line is still the same, the cinema thread is still listed as related to the work thread. So I wanted to change the subject line on all thread mails. First, I missed the pass (Maildir) files of tagged messages to external command as *arguments* command in mutt, so I had to create a new folder and put the files in there, then go to the shell and invoke sed. An alternative would have of course been to set $editor to the sed -i command, but I could not get this working. Even setting editor=sed -i -e '/./d' just got me message not modified. But then, and rather weird, after touching up the Subject: header in all messages, mutt suddenly fails to verify the GPG signatures (and still shows the old subject everywhere but in the pager). So I tracked this down to the header_cache (can I tell mutt to remake that?) and after I had deleted it, I got what I wanted. Now my question simply is: is there a better way to change the subject of messages in a thread, such that mutt is actually aware of it and I don't have to coerce it to accept the change? Cheers, -- martin; (greetings from the heart of the sun.) \ echo mailto: !#^.*|tr * mailto:; [EMAIL PROTECTED] one morning i shot an elephant in my pyjamas. how he got into my pyjamas i'll never know. -- groucho marx spamtraps: [EMAIL PROTECTED] digital_signature_gpg.asc Description: Digital signature (see http://martin-krafft.net/gpg/)
Re: changing the subject line of a thread
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday, August 28 at 03:14 PM, quoth martin f krafft: So I wanted to change the subject line on all thread mails. First, I missed the pass (Maildir) files of tagged messages to external command as *arguments* command in mutt, so I had to create a new folder and put the files in there, then go to the shell and invoke sed. An alternative would have of course been to set $editor to the sed -i command, but I could not get this working. Even setting editor=sed -i -e '/./d' just got me message not modified. HEH. This *would* work, if you were on a much slower machine (or if you just got really lucky). The way mutt determines whether a file is modified is by comparing the mtime of the temp file it created to the mtime of the temp file once the editor is done editing. The mtime is stored in seconds. Sed, of course, executes in less than a second, so the mtime is unchanged in all but the rarest of cases. It would work if you'd piped it to a script like this: #!/bin/sh sleep 1 sed -i -e '/./d' $1 Because then the mtime would be guaranteed (more or less) to be different from when mutt created the tmp file. So I tracked this down to the header_cache (can I tell mutt to remake that?) and after I had deleted it, I got what I wanted. Yeah, that's what you have to do when your messages change out from underneath you. Mutt doesn't do much to check on the validity of the hcache, and since mutt trusts the hcache (for obvious reasons), we're forced to occasionally blow it away after we go mucking about behind mutt's back. That's just the way it goes. Now my question simply is: is there a better way to change the subject of messages in a thread, such that mutt is actually aware of it and I don't have to coerce it to accept the change? The editor trick would work, as long as you make sure the mtime is going to be different (e.g. the above script). ~Kyle - -- Be sincere; be brief; be seated. -- Franklin D. Roosevelt -BEGIN PGP SIGNATURE- Comment: Thank you for using encryption! iD8DBQFG1H5tBkIOoMqOI14RAiuKAJ9YPPK0xw9HBi4T4ODuKfuIsopa/gCfc0US Tcz5Ut/fiea7ckA1IC/vlfw= =lTHo -END PGP SIGNATURE-