VM

Sending HTML to a browser on click?

Asked by Daniel Barrett

By default, Emacs VM presents HTML emails in the inbox buffer like this:

    HTML, UTF-8 [Click mouse-2 to save to a file]

How can I change the functionality to VIEW ON CLICK instead, presenting like this:

    HTML, UTF-8 [Click mouse-2 to display in Chrome]

I figured out how to make VM send the HTML instantly to Chrome as soon as you view the email:

(setq vm-mime-external-content-types-alist
  '(
     ("text/html" "chrome")
   )
)
but I'd rather "click to view" as above instead.

Thank you very much.

Question information

Language:
English Edit question
Status:
Solved
For:
VM Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel Barrett
Solved:
Last query:
Last reply:
Revision history for this message
Uday Reddy (reddyuday) said :
#1

A lot of this functionality is due to change in VM 8.2.0. Which version of
VM are you using currently?

Revision history for this message
Daniel Barrett (dbarrett-m) said :
#2

I'm using 8.0.13.

Revision history for this message
Uday Reddy (reddyuday) said :
#3

Well, 8.0.13 is "ancient"! You should at least upgrade to 8.1.2. If you feel like it, you can also try the latest beta release, 8.2.0b.

Revision history for this message
Daniel Barrett (dbarrett-m) said :
#4

Thanks. I upgraded to 8.2.0b. Is there a way to accomplish "view on click" (or a reasonable equivalent) as described above? Thanks very much.

Revision history for this message
Uday Reddy (reddyuday) said :
#5

In 8.2.0b, the default action for mouse-2 is "[display]", not save. Do you get this?

Revision history for this message
Daniel Barrett (dbarrett-m) said :
#6

Yes, I see "[display]". Right now, I click it and get "DISPLAY FAILED -- Unknown MIME type".

I can make VM automatically send the HTML to the browser (chrome) the moment I view the message, like this:

(setq vm-mime-external-content-types-alist
       '(
         ("text/html" "chrome")
        )
)

but instead, I'd like VM to wait for me to click "[display]" before sending the HTML to chrome. Is this possible?

Thank you very much for your help so far.

Revision history for this message
Uday Reddy (reddyuday) said :
#7

Daniel Barrett writes:

> Question #233501 on VM changed:
> https://answers.launchpad.net/vm/+question/233501
>
> Status: Needs information => Open
>
> Daniel Barrett gave more information on the question:
> Yes, I see "[display]". Right now, I click it and get "DISPLAY FAILED --
> Unknown MIME type".

That means that your configuration for chrome isn't working. Please send a
bug report using vm-submit-bug-report, and attach a sample message if
possible.

Cheers,
Uday

Revision history for this message
Daniel Barrett (dbarrett-m) said :
#8

Hmmm, I am not sure that my message was clear. Let me try again. I don't think this is a VM bug, maybe just a misconfirmation in my .vm file?

CURRENT SETUP: VM MIME configuration right now is:

  (setq vm-mime-8bit-text-transfer-encoding '8bit)
  (setq vm-auto-decode-mime-messages t)
  (setq vm-auto-displayed-mime-content-types '("text" "text/plain" "multipart" "message"))
  (setq vm-mime-internal-content-types '("text"))
  (setq vm-mime-text/html-handler 'auto-select)
  (setq vm-mime-external-content-types-alist nil)
  (add-to-list 'vm-mime-internal-content-type-exceptions "text/html")

When I view an HTML email, I see:

  HTML (us-ascii): <no suggested filename>, HTML [display]

And when I click on "[display]", I get "DISPLAY FAILED -- Unknown MIME type".

SETUP #2: Next, I change the value of vm-auto-displayed-mime-content-types to:

  (setq vm-mime-external-content-types-alist '(("text/html" "chrome")))

Now, when I view an HTML email, the HTML is instantly sent to chrome and a browser windows pops up.

So... here is what I am trying to do I would like the UI from CURRENT SETUP:

  HTML (us-ascii): <no suggested filename>, HTML [display]

and when I click "[display]", to have chrome pop up.

I don't know if this is relevant, but here is my setup for vm-url-browser:

(setq vm-chrome-program "chrome")
(setq vm-chrome-program-switches (list "--new-window"))
(setq vm-chrome-client-program "chrome")
(setq vm-chrome-client-program-switches (list "--new-window"))
(defun vm-mouse-send-url-to-chrome (url &optional new-window)
  (message "Sending URL to Chrome...")
  (if new-window
      (apply 'vm-run-background-command vm-chrome-program
             (append vm-chrome-program-switches (list url)))
    (or (equal 0 (apply 'vm-run-command vm-chrome-client-program
                        (append vm-chrome-client-program-switches
                                (list url))))
        (vm-mouse-send-url-to-chrome url t)))
  (message "Sending URL to Chrome... done"))
(setq vm-url-browser 'vm-mouse-send-url-to-chrome)

Thank you.

Revision history for this message
Uday Reddy (reddyuday) said :
#9

Daniel Barrett writes:

> Hmmm, I am not sure that my message was clear. Let me try again. I don't
> think this is a VM bug, maybe just a misconfirmation in my .vm file?

Still, sending vm-submit-bug-report is the best way of getting help.

> (setq vm-auto-displayed-mime-content-types '("text" "text/plain"
> "multipart" "message"))

This means that all "text" types including text/html will be automatically
displayed, which seems to be the behaviour you are getting.

> (setq vm-mime-external-content-types-alist nil)

This means that there is no external viewer defined for anything, which
explains why the [display] button isn't working.

Configuring MIME handling is a complicated business. You need to read
through the manual sections, 3.3.1 onwards, and set all the variables that
it says you should.

Cheers,
Uday

Revision history for this message
Daniel Barrett (dbarrett-m) said :
#10

That explains it! I removed "text" from vm-auto-displayed-mime-content-types, then set

  (setq vm-mime-external-content-types-alist '(("text/html" "chrome")))

Now everything is working fine.

Thank you VERY much!