<<< Date Index >>>     <<< Thread Index >>>

Re: Inline text attachments



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Tuesday, July 14 at 07:12 PM, quoth Noah Slater:
>I would like to add new inline text attachments with ease.

Hm. Let's get back to that in a minute.

>At the moment, I am doing:
>
>  n<enter>foo.txt<enter>text/plain
>
>This brings up vi to edit my text file.

This uses your mailcap to decide what to use to compose a text/plain 
file. Chances are this is being defined in a global mailcap file (e.g. 
/etc/mailcap), and looks something like this:

     text/plain: less ; compose=vi

On my system, I don't have such a line, so mutt just complains that it 
cannot find an application to compose a text/plain.

The issue here is that mutt is set up to handle creating a file of 
*ANY* MIME-type, and does not have a special-case to handle text/plain 
so that it "just knows" to use $EDITOR (or even $editor). That's why 
mutt relies on the mailcap file to figure out what program to run. 
When you think about it, this makes sense from a "create any arbitrary 
MIME-type" point of view; not from a "add another text component to my 
message" point of view.

>Once this has been edited, I do:
>
>  ^d

For reference, since people can and do rebind their keys, it's 
probably better to refer to things by their function names. In this 
case (as you can see from the help menu), it's <toggle-disposition>.

>This seems to work, but I have a few questions:
>
>  * Can I automate this whole process so that I can press a single button, and
>    it will create a new file similar to how it does for a regular message. I
>    don't want to have to think about naming this file, or typing it's mime 
> type
>    out each time. I would also like it to be set to inline.

You *can* automate the process, but creating a random file name is 
going to be difficult. Mutt isn't set up to do that. Most folks don't 
want multiple inline text parts (most of us just create a single text 
part).

However, automating the process is possible, just not very easy. You 
can use an external script that uses mktemp to create a temporary text 
file, call emacs on that file, and create a temporary configfile that 
mutt can source that contains all the commands to make mutt add that 
new temporary text file to the current message. (Hey, you're doing 
something a bit weird, so the solution is a bit weird. Them's the 
breaks.)

>  * Why does it launch vi, when my EDITOR is set up correctly? Editing the
>    message correctly launches emacs. I see from the help that this may be 
> using
>    mailcap, but am confused what I need to change.

You can add a line to your mailcap to handle text/plain messages that 
contains a "compose=" setting, like this:

     text/plain; less; compose=emacs %s

For a detailed explanation of that, read the mailcap man page.

But if you take my advise about the external script, then modifying 
your mailcap won't be necessary.

~Kyle
- -- 
The future is here. It's just not widely distributed yet.
                                                      -- William Gibson
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iQIcBAEBCAAGBQJKXN4WAAoJECuveozR/AWe7m8P/2HKVPykRmVpr9EPYZuXbB0z
CZL4Z1pYnjtdr0WnirBuD0UYy2FNzrTeCxkluvtw0WNo4OX2oLFUzvUbwHry0fi+
tmvGQALb85vETXjHdZ6TMu6cPujyK3b2fshTAFgOFjLjEEb8ZHWdokhDJ8kqLpvj
0R8R2ZTx7+WLwVFlkMr13qaEJkD5ame8AGs4gphz45ojSqytKB8EwSWjZeFFJ8MM
fq3ymAV7sXGv9gWFtuU1sBdw/WvlA+0cHgwafqgFhX4PIcT3R22H4o+U9V2RebV4
tBIpsfEXvD3u1wdKW7F48J1abSXsJLiRb9IpwcBYqZZGzxKP08FB9OLQqox2sn6l
f5Y5cY0NVQ4vx8CoZPfUZXflUmr7x6FMrYs1doXhdh8N4CRYiioyGUDgwKe3/klw
XSqo9HaEDjZWXz/iwF2JNjpibOf7DFfmQr+IWZlD8vrdMctW2Gv55cyJyPLjEAk2
UstA1gvMPMYnWa7Ge5/ORRFNh094OTpAro+SCw8p/PfmhnPM6EnXQIFU4zFJcn5h
9e5z12HYHukbzhAgU4JTOYgDvKZIWH31K5WwrBYLCiotL6bJ6dfUtrvQfyARgxlj
/7mBeI7Y9ccbFtZU8ivbczIFtGOeMBcH21O/l8/lrfmqhl1pylvOIGlG/SYhr/gh
uFyZU0qb90TOAeNe1CKC
=yCVa
-----END PGP SIGNATURE-----