Cameron Simpson wrote: > On 30Nov2006 22:44, Todd Zullinger <tmz@xxxxxxxxx> wrote: [...] > | Is there a way to call the attach-file function automatically > | instead of just printing a nag? > > Well, you can queue an attachment from _inside_ the editor. If you > have edit_headers=yes you can add a header. Adding an "Attach:" > header with a file pathname will cause mutt to attach it when you > save and exit the editor. I did test this a little before I posted, but I didn't figure out how to avoid having to type the entire filename to attach -- which was painful for my lazy, tab-completion-addicted fingers. :) You've shown me one good way to fix that, thank you very much. > To make this convenient, I have ctrl-A in my editor (vi) mapped to: > > 1G}-:.r!exec </dev/tty 2>/dev/tty; readline 'Attach: '<CR>IAttach: <Esc> > > Those are real Enter and Escape codes, BTW. This prepares an Attach: > header, calling readline to let you enter the filename with file > completion. Hmmm, I'm feeling dense. I added a line to my .vimrc to test this method and I always have some remnants of the exec command left on the line as I enter the filename. The prompt looks like this to start: Attach: </dev/tty 2>/dev/tty; readline "Attach: " If I type something and backspace, the extra command text disappears and leaves only the intended "Attach: " portion. I'm not sure what part of your instructions I've mangled exactly. The exact line I put into my .vimrc is: map! <F4> <ESC>1G}-:r!exec </dev/tty 2>/dev/tty; readline "Attach: "<CR>IAttach: (I'm using Vim 7.0.) > "readline"'s a little bash script I have: > > http://www.cskk.ezoshosting.com/cs/css/bin/readline > > Anyway, that lets you do an attachment conveniently before leaving the > editor. Yes, very handy and likely all the more I'll need to avoid sending too many emails with missing attachments. > | Is there a way to check if I've already attached a file and skip > | the nag and or attach-file call? > > grep for a "Content-Type: multipart/mixed"? Or is this not available > post encryption? It's not available in the file the editor writes out, even with $edit_headers set. I suppose that's one reason why using the $sendmail variable is preferable to using $editor for this sort of hack. As $sendmail is of limited use when encrypting, I imagine the cleanest all around way to solve this would be with a patch, something like what's in the mail thread linked to in the wiki[1]. But I'm certainly not frustrated very often by this sort of thing, so I don't think I'll do any more than make the effort to add attachments directly from within my $editor. Thanks a lot for the ideas and examples! [1] http://marc.theaimsgroup.com/?l=mutt-dev&m=110658853024645&w=2 -- Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ====================================================================== If you don't drink, smoke, or drive a car, you're a tax evader. -- Rep. Thomas S. Foley, 1990
Attachment:
pgp6jcGU50NxW.pgp
Description: PGP signature