<COMMERCIAL>

Do you suffer from relatives that always send html mails?
Do you hate those spam mails that are sent in html?
Have you subscribed to a mailing list but it doesn't offer a plain ascii version?

Stop puzzling what those tags mean! Stop trying to decipher those html entities!
Try using the fabulous Vilistextum for converting your html mail into readable ascii!

</COMMERCIAL>

For the time being, I only know to do this for mutt and gnus.
Instructions for other mail reader are welcome.

mutt

Put this in your .mailcap:
text/html; vilistextum %s - ; copiousoutput

And this in your .muttrc:

auto_view text/html

gnus

Put this in your .emacs, or .gnus or somewhere else where it might be appropriate:
;; ---------------------------------------------------------------------
(setq
 ;; prefer to show plain text over markup for multipart/alternative
 mm-discouraged-alternatives (append mm-discouraged-alternatives
                                     '("text/html"
                                       "text/richtext"))
 )

;; adapted from Mark Thomas (swoon@bellatlantic.net)
;; use external program to view inline HTML
(when t ;; change to nil to comment out
  (let ((old-text-html-test (assoc "text/html" mm-inline-media-tests))
        (new-text-html-test '("text/html"
                              my:gnus-html2text
                              (lambda (handle)
                                (fboundp 'my:gnus-html2text)))))
    (if old-text-html-test
        (setcdr old-text-html-test (cdr new-text-html-test))
      (setq mm-inline-media-tests (cons new-text-html-test
                                        mm-inline-media-tests)))))

;; function to call to handle text/html attachments
(defun my:gnus-html2text (handle)
  (let (text)
    (with-temp-buffer
      (mm-insert-part handle)
      (save-window-excursion
        (my:html2text-region (point-min) (point-max))
        (setq text (buffer-string))))
    (mm-insert-inline handle text)))

(defun my:html2text-region-vilistextum (min max)
  "Replace the region with the result of running vilistextum --shrink-lines --remove-empty-alt --convert-tags --links on it. "
  (interactive "r")
  ;; vilistextum accepts html on stdin
  (call-process-region min max "vilistextum" t t t "-clrs" "-" "-"))

(defalias 'my:html2text-region 'my:html2text-region-vilistextum)
;; ---------------------------------------------------------------------

			

Patric Müller
Last modified: Mon Sep 3 00:52:57 CEST 2001