On Jun 27, 2010 at 12:50 PM -0400, Ed Blackman wrote:
I have my $editor set to a Perl script that manipulates the incoming message in various custom ways before handing it off to my real editor. Adding a new header would be trivial.

The only disadvantage is that I have lost the "Aborted unmodified message" detection, which I could fix if I ever was bothered enough to figure out how mutt detects unmodified messages (file timestamp?)

I do something similar with a python script. I got around the problem you mention above by making two temp copies of the message file. I then send one copy to my editor for writing the message. After the editor returns, I compare the two temp copies. If they are the same, I delete them and exit. The original file from mutt has never been touched at this point and it picks up on the fact that it's unmodified and aborts. If the two temp copies are different, remove the original mutt file and replace it with the modified file. Then remove the temp files.

I'm sure there's an easier way to do this. I'm also sure you could do it with only one temp file and not the two, but when I wrote the script the other year, I had some reason for doing it the way I did. Oh yeah, I have a step that strips signatures before I start editing, so I can't compare to the file directly out of mutt, since that can still have a sig.

It would be easy to add a blank attachement line, and then after you get done editing, strip it out if it had a dummy value, like 'blank.txt'. Personally, I find it easy enough to hit the 'a' key in the compose screen and just drag my file into my terminal. OS X picks up on the file path and pastes it in for you.

Tim

Reply via email to