Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Switching between multipart/alternative encodings

1 view
Skip to first unread message

Jeffrey J. Kosowsky

unread,
Oct 14, 2004, 10:24:02 AM10/14/04
to
Is it possible to toggle the display between alternate
"multipart/alternative" encodings.

Specifically, this is the situation I have encountered.

I have the following setup to preferentially choose "text/plain" but
when not available to use lynx to convert html to "text/plain".

(setq vm-mime-alternative-select-method '(favorite "text/plain"))
(add-to-list 'vm-mime-type-converter-alist
'("text/html" "text/plain" "lynx -force_html -dump -stdin"))

However, I sometimes get messages with both 'text/plain' and
'text/html' alternatives but where the 'text/plain' message is just
something like:
No text version was provided
or
Get a better mailer
etc.

Presumably, there is no automated way to realize that the text/plain
alternative is not the real message, so is there some way to add an interactive
vm-command that would allow one to toggle through to alternative mime
encodings?

Another possibility would be to display a mime tag for alternative
encodings that could then be 'clicked' on. The tag could be labelled
something like:
Mime alternative type: text/html -- Click to display

A right click menu could even offer the alternative to convert to text
and display in place or display in external viewer or detach and save
to file.

This would have the advantage of allowing the user to know that there
is an html (or other encoding alternative) even when the default looks
fine. For example, if you see a text message that is oddly formatted
and see that there is also an html version, you might choose to open
the html version to see what the formatting should really look like.
Similarly, I use 'unrtf' to convert rtf documents to text, but since
the conversion is "lossy" there are times when I may choose to open
the document in ms-word in an external viewer.

Any thoughts on the best way to do this?

Uday Reddy

unread,
Jun 2, 2005, 4:08:00 PM6/2/05
to
"Jeffrey J. Kosowsky" <koso...@consult.pretender> wrote in message
news:m2k6tts...@consult.pretender...

> Is it possible to toggle the display between alternate
> "multipart/alternative" encodings.

I use the following function to convert multipart/alternative descriptor to
multipart/mixed. Then all the alternatives get shown, and I can pick the
one I want to decode or view. However, I should warn you that this function
only converts the top level MIME header. It doesn't do anything about
nested MIME objects.

Cheers,
Uday Reddy


(defun vm-show-multipart ()
"Invoked in a buffer with an email message, this function
converts a multipart/alternative message into a multipart/mixed
message so that all parts can be seen."
(interactive)
(save-window-excursion
(vm-edit-message)
(goto-char (point-min))
(if (search-forward "Content-Type: multipart/alternative" nil t)
(replace-match "Content-Type: multipart/mixed" nil t))
(goto-char (point-max))
(vm-edit-message-end)))

newsspam5...@robf.de

unread,
Jun 3, 2005, 3:31:45 PM6/3/05
to
"Uday Reddy" <U.S....@cs.bham.ac.uk> writes:

> "Jeffrey J. Kosowsky" <koso...@consult.pretender> wrote in message
> news:m2k6tts...@consult.pretender...
>> Is it possible to toggle the display between alternate
>> "multipart/alternative" encodings.
>
> I use the following function to convert multipart/alternative descriptor to
> multipart/mixed. Then all the alternatives get shown, and I can pick the
> one I want to decode or view. However, I should warn you that this function
> only converts the top level MIME header. It doesn't do anything about
> nested MIME objects.

Just recently I have added the new variable `vm-mime-show-alternatives'
and code for exactly the same purpose.

It is part of my patched VM version at
http://www.robf.de/Hacking/elisp
and solves it without editing the message.

Cheers,
Robert.

0 new messages