unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Ichimusai <ichi-nntp@ichimusai.org>
Subject: Re: html mail filter in gnus
Date: 18 Sep 2002 08:38:48 +0200	[thread overview]
Message-ID: <m3fzw73ipz.fsf@h33n3fls31o965.telia.com> (raw)
In-Reply-To: 87d6rccle8.fsf@myahle.kadomony.org

James Cozine <jmcozine@yahoo.com> writes:

> Kin Cho <kin@neoscale.com> 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	other threads:[~2002-09-18  6:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 19:02 html mail filter in gnus Kin Cho
2002-09-17 22:16 ` James Cozine
2002-09-18  6:38   ` Ichimusai [this message]
2002-09-18  8:38 ` Kai Großjohann
2002-09-18  8:57 ` Jonas Steverud
2002-09-18 20:07 ` D. Goel
2002-09-19 20:28   ` Kin Cho
2002-09-19 20:58     ` D. Goel
2002-09-19 21:00       ` D. Goel
2002-09-20 15:17         ` Nils Goesche
2002-09-20 16:45           ` D. Goel
2002-09-20 17:59             ` Nils Goesche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3fzw73ipz.fsf@h33n3fls31o965.telia.com \
    --to=ichi-nntp@ichimusai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).