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: Nils Goesche
Subject: Re: html mail filter in gnus
Date: 20 Sep 2002 17:17:49 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

D. Goel <address@hidden> 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


reply via email to

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