help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: html mail filter in gnus


From: Ichimusai
Subject: Re: html mail filter in gnus
Date: 18 Sep 2002 08:38:48 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

James Cozine <address@hidden> writes:

> Kin Cho <address@hidden> writes:
> 
> > Hi,
> > 
> > I'm getting html mail quite often now and it's getting annoying.
> > Does anyone has a gnus filter to filter out the html tags and
> > leave the plain text behind?
> > 
> > -kin
> 
> ,----[ C-h v mm-discouraged-alternatives RET ]
> | mm-discouraged-alternatives's value is 
> | ("text/html" "text/richtext")

This works best if there is a plain text part to the message. However I
receive lots of mails which does not have a plain text message in them
at all and that is annoying.

W3 catches some of them, and renders them nicely enough, but if it is
MS Exchange who has converted the mail into HTML or if it is sent by
Outlook or Outlook Express, the HTML is so bad that W3 gives up and
the message is shown in HTML source instead. It's ugly. It got worse
since I upgraded W3.

If everything else fails I use this:

;; Remove HTML tags from a buffer
(defun wash-ugly-html ()
  "Remove ugly HTML tags"
  (interactive)
  (toggle-read-only -1)
  (save-excursion
    (beginning-of-buffer)
    (while (re-search-forward "<[^<@>]*>" nil t)
      (replace-match "" nil nil))
    (beginning-of-buffer)
    (while (re-search-forward "&gt;" nil t)
      (replace-match ">" nil nil))
    (beginning-of-buffer)
    (while (re-search-forward "&lt;" nil t)
      (replace-match "<" nil nil))
    (beginning-of-buffer)
    (while (re-search-forward "&.*;" nil t)
      (replace-match "" nil nil))))

Bind it to a key of your liking and use it when all else fails. Not
the most elegant solution, but it works. It leaves a few tags in
sometimes, it's made to leave the References: line in the header and
email addresses, but it makes things a lot more readable.

-- 
  // AA#769 ICQ: 1645566 http://www.ichimusai.org/
\X/  ASCII ribbon campaign - No HTML, RTF or MS Word in mail
Morality is doing what is right, no matter what you're told.  
Religion is doing what you're told, not matter what is right.
    -- Jerry Sturdivant, alt.atheism


reply via email to

[Prev in Thread] Current Thread [Next in Thread]