问题描述
如何使用w3m或其他方式在RMAIL邮件中内嵌HTML内容,或至少在外部Web浏览器中打开其MIME部分?
How could I use w3m or other to display HTML content inline in RMAIL messages or, at least, open its MIME part in a external web browser?
唯一的解决方案我发现在EmacsWiki,但它是一个1996年的代码,对我来说没有效果。至少在Emacs 24上。
The only solution I found is in EmacsWiki but it is a 1996's code that didn't work for me. At least on Emacs 24.
推荐答案
好的。这个怎么样?
(defun buffer-html-to-w3m ()
"View HTML in the current rmail using W3M.
You must have W3M installed for this to work."
(interactive)
(let ((subject (mail-fetch-field "Subject")))
(when
(string-match-p
"text/html.*"
(mail-fetch-field "Content-type"))
(save-excursion
(goto-char (point-min))
(let ((pt (re-search-forward "\n<html>" nil t)))
(goto-char pt)
(let ((buf (get-buffer-create (concat "*rmail-" subject "*"))))
(shell-command-on-region
pt (or
(re-search-forward "</html>" nil t)
(point-max))
"w3m -T text/html" buf)
(switch-to-buffer-other-window buf)
(view-mode)))))))
我不知道这个名字,我只试了一个你的电子邮件,但对我来说,这个工作。
I'm not sure about the name and I only tried one of your emails but, for me, this works.
我把你的消息放到 rmail-mode
然后写这个功能,通过W3M找到html和管道。
I put your message into rmail-mode
and then wrote this function, which finds the html and pipes it through W3M.
你被切换到最终的缓冲区,我们把它放在视图模式
,所以你可以只是q停止看。
You're switched to the resulting buffer and we put it in view-mode
so you can just "q" to stop looking at it.
这篇关于如何使用w3m在RMAIL邮件中呈现HTML内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!