Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Nils Goesche <cartan@cartan.de>
Subject: Re: html mail filter in gnus
Date: 20 Sep 2002 17:17:49 +0200	[thread overview]
Message-ID: <lky99wlmg2.fsf__33589.0087801546$1138667983$gmane$org@pc022.bln.elmeg.de> (raw)
In-Reply-To: <87n0qd1ypw.fsf@computer.localdomain>

D. Goel <deego@glue.umd.edu> writes:

[howto use lynx for HTML MIME parts]

And after a few changes, it works fine for me, too.  Thanks!

Here everything together:


(defun my:gnus-html2text (handle)
  (let (text)
    (with-temp-buffer
      (mm-with-unibyte-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 (min max)
  "Replace the HTML region from MIN to MAX with lynx --dump."
  (interactive "r")
  (let ((file "/tmp/email.html"))
    (unwind-protect
	 (progn
	   (write-region min max file)
	   (delete-region min max)
	   (insert (shell-command-to-string
		    (concat "lynx "
			    "lynx -dump "
			    (shell-quote-argument
			     (expand-file-name file))))))
      (delete-file file))))

(setq mm-inline-media-tests
      (cons '("text/html" my:gnus-html2text
	      (lambda (handle)
		(fboundp 'my:gnus-html2text)))
	    (let ((old (assoc "text/html" mm-inline-media-tests)))
	      (if old
		  (delete old mm-inline-media-tests)
		  mm-inline-media-tests))))

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x0655CFA0


  parent reply	other threads:[~2002-09-20 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7ifzw8tp5z.fsf@neoscale.com>
2002-09-17 22:16 ` James Cozine
2002-09-18  8:57 ` Jonas Steverud
     [not found] ` <87hegnjc3f.fsf@computer.localdomain>
2002-09-19 20:28   ` Kin Cho
     [not found]   ` <7i8z1xzpuc.fsf@neoscale.com>
     [not found]     ` <87r8fp1yue.fsf@computer.localdomain>
     [not found]       ` <87n0qd1ypw.fsf@computer.localdomain>
2002-09-20 15:17         ` Nils Goesche [this message]
     [not found]         ` <lky99wlmg2.fsf@pc022.bln.elmeg.de>
     [not found]           ` <87it10vccm.fsf@computer.localdomain>
     [not found]             ` <lklm5wleze.fsf@pc022.bln.elmeg.de>
2002-09-24 22:06               ` D. Goel

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

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

  git send-email \
    --in-reply-to='lky99wlmg2.fsf__33589.0087801546$1138667983$gmane$org@pc022.bln.elmeg.de' \
    --to=cartan@cartan.de \
    /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 NNTP newsgroup(s).