Hell Oh Entropy!

Life, Code and everything in between

Making mutt send attached patches inline by default

So I moved back to mutt after I got my new laptop because I wanted to rip out as much of the desktop cruft as I possibly could. There was one feature from claws that I missed sorely though, which is the ability to send plain text attachments inline by default. If you add an attachment using the ‘a’ key in the compose window, it is set to be sent as an attachment by default. It is possible to do a ^D to change the disposition to inline, but I would keep forgetting to do that now and then, leading to pain for patch reviewers.

So after forgetting to press ^D before sending for the nth time, I have now ‘configured’ mutt to send text attachments inline with the following one-liner patch:

diff -pruN mutt-1.5.21/sendlib.c mutt-1.5.21.patched/sendlib.c
--- mutt-1.5.21/sendlib.c       2012-12-07 14:55:30.066959607 +0530
+++ mutt-1.5.21.patched/sendlib.c       2012-12-07 15:11:53.443348151 +0530
@@ -1392,6 +1392,9 @@ BODY *mutt_make_file_attach (const char
       att->type = TYPETEXT;
       att->subtype = safe_strdup ("plain");
+      /* HACK! make text attachments inline by default.  */
+      att->disposition = 0;

As the comment clarifies, it is a hack and is not suitable for mutt upstream. The right way to do this would be to add a muttrc clause that toggles this behaviour. Doesn’t matter to me though - I have what I need.

comments powered by Disqus