VM

hook to display multipart/alternatives

Bug #499742 reported by Mark Diekhans
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
VM
Confirmed
Wishlist
Unassigned

Bug Description

vm 8.1.0-beta

Enhancement request:

Often get multipart/alternative mail, would normally like to display the text/plain version
by default, but sometimes this just indicates the mail is html, rather than being a ture
alternative format.

Would like to be able to both display the default and get the vm-mime-show-alternatives
buttons to be able to show the other parts.

Also vm-mime.el has some checks for vm-mime-show-alternatives being 'mixed, nowever this is not
documented in the info file.

thans!

Tags: mime
Revision history for this message
Uday Reddy (reddyuday) wrote :

Mark, are you saying that if you set vm-mime-show-alternatives to t, then the default alternative does not get displayed (even if it is text/plain)? It does for me. So, can you tell us how you are setting the default display? You can actually send a blank vm-submit-bug-report which will include all your settings.

Changed in vm:
status: New → Incomplete
importance: Undecided → Low
tags: added: mime
Revision history for this message
Mark Diekhans (markd-kermodei) wrote :

Hi Uday,

What I would like to do is be able to do is configure the multiple alternative to display
one mime type, but also include the buttons to display other mime types without doing a vm-decode-mime-message. For instance, I have in a common type of mail
messages is multipart/alternative with a plain text and a html version. For instance:

   plain text, us-ascii [Press RETURN to display text alternative]
   HTML, utf-8 [Press RETURN to display text alternative]

I convert html to text using lynx, so what I would like the display to be is

  plain text, us-ascii [Press RETURN to display text alternative]
  <html page converted to text using lynx by default>

or maybe

  "plain text displayed by default"
  HTML, utf-8 [Press RETURN to display text alternative]

I don't see a documented way of doing this. Attached is a minimal vm.el file with my configuration.

Revision history for this message
Uday Reddy (reddyuday) wrote :

Ok, I started with a .vm file containing just the following lines:

(setq vm-mime-internal-content-type-exceptions '("text/html"))
(add-to-list 'vm-mime-type-converter-alist
      '("text/html" "text/plain"
        "lynx -force_html -dump -pseudo_inlines -stdin"))
(setq vm-mime-show-alternatives t)

Both text/plain and text/html were displayed. Is this what you get?

This behaviour seems reasonable because show-alternatives is true. So, both the alternatives are displayed.

In my normal use, I don't use a converter for text/html. So, I get a button displayed for it, and I can click it to send the content to a web browser.

vm-mime-alternative-select-method doesn't seem to have any effect once you have show-alternatives set to t. If you set it to nil, then the 'best method chooses text/html and lynx, 'best-internal chooses text/plain. The 'mixed method is displaying both, but I never knew what 'mixed is for. There is no documentation on it.
-------
I am beginning to understand what you are after. You want the alternative-select-method to continue its effect even if show-alternatives is set to t. You want the unselected alternatives to be displayed as buttons. Am I right?

Uday

Changed in vm:
status: Incomplete → Triaged
importance: Low → Wishlist
Revision history for this message
Mark Diekhans (markd-kermodei) wrote : [Bug 499742] Re: display default multipart/alternative method and show-alternatives

Uday Reddy <email address hidden> writes:
> Both text/plain and text/html were displayed. Is this what you get?

yes, I am seeing the same behavior

> I am beginning to understand what you are after. You want the
> alternative-select-method to continue its effect even if
> show-alternatives is set to t. You want the unselected
> alternatives to be displayed as buttons. Am I right?

Exactly. This seems to be the most natural behavior. That is, the mime
part is either displayed or there is a button.

I might be able to work on this when I get a little time
to wrap my head around the mime code. I have always
found it a bit hard to follow.

Thanks
Mark

Revision history for this message
Uday Reddy (reddyuday) wrote : [Vm] [Bug 499742] Re: display default multipart/alternative method and show-alternatives

Mark Diekhans writes:

> Exactly. This seems to be the most natural behavior. That is, the mime
> part is either displayed or there is a button.

The reason vm-mime-show-alternatives arose can be understood from this thread:

http://groups.google.com/group/gnu.emacs.vm.info/browse_thread/thread/230530b5570a30e9/e4a33090647e58a7?lnk=gst&q=uday+multipart#e4a33090647e58a7

It is a wrapper that makes multipart/alternative look like
multipart/mixed. The VM's internal code doesn't know anything about
it.

I am still wondering why you can't just view text/html and forget
about the text/plain parts.

Cheers,
Uday

Revision history for this message
Mark Diekhans (markd-kermodei) wrote : [Vm] [Bug 499742] Re: display default multipart/alternative method and show-alternatives

Uday Reddy <email address hidden> writes:
> The reason vm-mime-show-alternatives arose can be understood from this
> thread:

very useful, and the problem they were having with converting
the html to text and then getting both is on issue I have.

> I am still wondering why you can't just view text/html and forget
> about the text/plain parts.

I think this is probably the best solution. A program that is
generating good multipart/alternative mail will generate better
text than lynx will, but a lot of times the text is junk.
This is certainly low priority compared to other things being
done. Feel free to close this bug.

thanks!
mark

Revision history for this message
Uday Reddy (reddyuday) wrote : Re: display default multipart/alternative method and show-alternatives

What happens if you remove text/html from auto-displayed-mime-content-types? Maybe there is a bug there.

Revision history for this message
Uday Reddy (reddyuday) wrote :

I have checked that excluding "text/html" from auto-displayed-mime-content-types gives the results you want. So, I think the problem is solved!

Changed in vm:
status: Triaged → Invalid
status: Invalid → Incomplete
importance: Wishlist → Undecided
Revision history for this message
Mark Diekhans (markd-kermodei) wrote : [Bug 499742] Re: display default multipart/alternative method and show-alternatives

Thanks Uday!

One though for the future: a hook could be added that decides exactly
what mime parts to display by default.

Cheers,
Mark

Uday Reddy <email address hidden> writes:
> I have checked that excluding "text/html" from auto-displayed-mime-
> content-types gives the results you want. So, I think the problem is
> solved!
>
>
> ** Changed in: vm
> Status: Triaged => Invalid
>
> ** Changed in: vm
> Status: Invalid => Incomplete
>
> ** Changed in: vm
> Importance: Wishlist => Undecided
>
> --
> display default multipart/alternative method and show-alternatives
> https://bugs.launchpad.net/bugs/499742
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in VM (View Mail) for Emacs: Incomplete
>
> Bug description:
> vm 8.1.0-beta
>
> Enhancement request:
>
> Often get multipart/alternative mail, would normally like to display the text/plain version
> by default, but sometimes this just indicates the mail is html, rather than being a ture
> alternative format.
>
> Would like to be able to both display the default and get the vm-mime-show-alternatives
> buttons to be able to show the other parts.
>
> Also vm-mime.el has some checks for vm-mime-show-alternatives being 'mixed, nowever this is not
> documented in the info file.
>
> thans!
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/vm/+bug/499742/+subscribe

Revision history for this message
Uday Reddy (reddyuday) wrote : [Vm] [Bug 499742] Re: display default multipart/alternative method and show-alternatives

Mark Diekhans writes:

> One though for the future: a hook could be added that decides exactly
> what mime parts to display by default.

What should be its inputs and outputs?

Cheers,
Uday

Revision history for this message
Mark Diekhans (markd-kermodei) wrote : [Vm] [Bug 499742] Re: display default multipart/alternative method and show-alternatives

Uday Reddy <email address hidden> writes:
> > One though for the future: a hook could be added that decides exactly
> > what mime parts to display by default.
>
> What should be its inputs and outputs?

This is just a guess, not knowing how a mime message is represented in memory.
Not sure how this works with recursive mime either.

A function that takes a list of the parse mime parts, and
returns an ordered list of the parts to display and how to
display them (display, button, or hide)...

This could be very powerful, allowing controlling the display
based on what is in each content.

Mark

Revision history for this message
Uday Reddy (reddyuday) wrote : Re: display default multipart/alternative method and show-alternatives

Ok, I will keep this on stack. There is currently a hook called vm-mime-display-function. It is probably too complicated to use, but it is worth looking at. Perhaps a better hook can be built on top of that.

Cheers,
Uday

Changed in vm:
status: Incomplete → Triaged
importance: Undecided → Wishlist
Revision history for this message
John Hein (xpqheqdvq4) wrote :

I occasionally would like this feature (the ability to view alternative mime parts as buttons), too, when lynx -dump or w3m -dump doesn't do a good job. As a workaround, what I have done in the past is to edit the message and change multipart/alternative to multipart/mixed.

Uday Reddy (reddyuday)
summary: - display default multipart/alternative method and show-alternatives
+ hook to display multipart/alternative method and show-alternatives
summary: - hook to display multipart/alternative method and show-alternatives
+ hook to display multipart/alternatives
Uday Reddy (reddyuday)
Changed in vm:
status: Triaged → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.