emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/gnus/mm-view.el


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/gnus/mm-view.el
Date: Mon, 16 Jan 2006 09:27:44 +0000

Index: emacs/lisp/gnus/mm-view.el
diff -u emacs/lisp/gnus/mm-view.el:1.20 emacs/lisp/gnus/mm-view.el:1.21
--- emacs/lisp/gnus/mm-view.el:1.20     Fri Dec  9 08:57:56 2005
+++ emacs/lisp/gnus/mm-view.el  Mon Jan 16 09:27:42 2006
@@ -51,8 +51,7 @@
 (defvar mm-text-html-renderer-alist
   '((w3  . mm-inline-text-html-render-with-w3)
     (w3m . mm-inline-text-html-render-with-w3m)
-    (w3m-standalone mm-inline-render-with-stdin nil
-                   "w3m" "-dump" "-T" "text/html")
+    (w3m-standalone . mm-inline-text-html-render-with-w3m-standalone)
     (links mm-inline-render-with-file
           mm-links-remove-leading-blank
           "links" "-dump" file)
@@ -64,8 +63,7 @@
 (defvar mm-text-html-washer-alist
   '((w3  . gnus-article-wash-html-with-w3)
     (w3m . gnus-article-wash-html-with-w3m)
-    (w3m-standalone mm-inline-wash-with-stdin nil
-                   "w3m" "-dump" "-T" "text/html")
+    (w3m-standalone . gnus-article-wash-html-with-w3m-standalone)
     (links mm-inline-wash-with-file
           mm-links-remove-leading-blank
           "links" "-dump" file)
@@ -264,6 +262,30 @@
              (delete-region ,(point-min-marker)
                             ,(point-max-marker)))))))))
 
+(defun mm-inline-text-html-render-with-w3m-standalone (handle)
+  "Render a text/html part using w3m."
+  (let ((source (mm-get-part handle))
+       (charset (mail-content-type-get (mm-handle-type handle) 'charset))
+       cs)
+    (unless (and charset
+                (setq cs (mm-charset-to-coding-system charset))
+                (not (eq cs 'ascii)))
+      ;; The default.
+      (setq charset "iso-8859-1"
+           cs 'iso-8859-1))
+    (mm-insert-inline
+     handle
+     (mm-with-unibyte-buffer
+       (insert source)
+       (mm-enable-multibyte)
+       (let ((coding-system-for-write 'binary)
+            (coding-system-for-read cs))
+        (call-process-region
+         (point-min) (point-max)
+         "w3m" t t nil "-dump" "-T" "text/html"
+         "-I" charset "-O" charset))
+       (buffer-string)))))
+
 (defun mm-links-remove-leading-blank ()
   ;; Delete the annoying three spaces preceding each line of links
   ;; output.




reply via email to

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