diff lisp/gnus/gnus-art.el @ 68207:fbd379b34f0a

Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698 Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 182-184) - Merge from emacs--cvs-trunk--0 - Update from CVS 2006-01-16 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/mm-uu.el (mm-uu-text-plain-type): New variable. (mm-uu-pgp-signed-extract-1): Use it. (mm-uu-pgp-encrypted-extract-1): Use it. (mm-uu-dissect): Use it; allow two optional arguments; one is a flag specifying whether there's no message header; the other is for a MIME type and parameters; bind mm-uu-text-plain-type with the later one. (mm-uu-dissect-text-parts): New function. * lisp/gnus/gnus-art.el (gnus-display-mime): Use mm-uu-dissect-text-parts to dissect text parts. 2006-01-13 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (article-wash-html): Use gnus-summary-show-article-charset-alist if a numeric arg is given. (gnus-article-wash-html-with-w3m-standalone): New function. * lisp/gnus/mm-view.el (mm-text-html-renderer-alist): Map w3m-standalone to mm-inline-text-html-render-with-w3m-standalone. (mm-text-html-washer-alist): Map w3m-standalone to gnus-article-wash-html-with-w3m-standalone. (mm-inline-text-html-render-with-w3m-standalone): New function. 2006-01-13 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (Article Washing): Additions. 2006-01-08 Alex Schroeder <alex@gnu.org> * man/pgg.texi (Caching passphrase): Rewording.
author Miles Bader <miles@gnu.org>
date Mon, 16 Jan 2006 09:27:43 +0000
parents 6f5da26b0df1
children 6c7c654eb3c7 f79a24752390
line wrap: on
line diff
--- a/lisp/gnus/gnus-art.el	Mon Jan 16 05:41:26 2006 +0000
+++ b/lisp/gnus/gnus-art.el	Mon Jan 16 09:27:43 2006 +0000
@@ -2467,25 +2467,36 @@
 
 (defun article-wash-html (&optional read-charset)
   "Format an HTML article.
-If READ-CHARSET, ask for a coding system."
+If READ-CHARSET, ask for a coding system.  If it is a number, the
+charset defined in `gnus-summary-show-article-charset-alist' is used."
   (interactive "P")
   (save-excursion
     (let ((inhibit-read-only t)
 	  charset)
-      (when (gnus-buffer-live-p gnus-original-article-buffer)
-	(with-current-buffer gnus-original-article-buffer
-	  (let* ((ct (gnus-fetch-field "content-type"))
-		 (ctl (and ct
-			   (ignore-errors
-			     (mail-header-parse-content-type ct)))))
-	    (setq charset (and ctl
-			       (mail-content-type-get ctl 'charset)))
-	    (when (stringp charset)
-	      (setq charset (intern (downcase charset)))))))
-      (when read-charset
-	(setq charset (mm-read-coding-system "Charset: " charset)))
-      (unless charset
-	(setq charset gnus-newsgroup-charset))
+      (if read-charset
+	  (if (or (and (numberp read-charset)
+		       (setq charset
+			     (cdr
+			      (assq read-charset
+				    gnus-summary-show-article-charset-alist))))
+		  (setq charset (mm-read-coding-system "Charset: ")))
+	      (let ((gnus-summary-show-article-charset-alist
+		     (list (cons 1 charset))))
+		(with-current-buffer gnus-summary-buffer
+		  (gnus-summary-show-article 1)))
+	    (error "No charset is given"))
+	(when (gnus-buffer-live-p gnus-original-article-buffer)
+	  (with-current-buffer gnus-original-article-buffer
+	    (let* ((ct (gnus-fetch-field "content-type"))
+		   (ctl (and ct
+			     (ignore-errors
+			       (mail-header-parse-content-type ct)))))
+	      (setq charset (and ctl
+				 (mail-content-type-get ctl 'charset)))
+	      (when (stringp charset)
+		(setq charset (intern (downcase charset)))))))
+	(unless charset
+	  (setq charset gnus-newsgroup-charset)))
       (article-goto-body)
       (save-window-excursion
 	(save-restriction
@@ -2526,6 +2537,20 @@
 	   ;; Put the mark meaning this part was rendered by emacs-w3m.
 	   'mm-inline-text-html-with-w3m t))))
 
+(eval-when-compile (defvar charset)) ;; Bound by `article-wash-html'.
+
+(defun gnus-article-wash-html-with-w3m-standalone ()
+  "Wash the current buffer with w3m."
+  (unless (mm-coding-system-p charset)
+    ;; The default.
+    (setq charset 'iso-8859-1))
+  (let ((coding-system-for-write charset)
+	(coding-system-for-read charset))
+    (call-process-region
+     (point-min) (point-max)
+     "w3m" t t nil "-dump" "-T" "text/html"
+     "-I" (symbol-name charset) "-O" (symbol-name charset))))
+
 (defun article-hide-list-identifiers ()
   "Remove list identifies from the Subject header.
 The `gnus-list-identifiers' variable specifies what to do."
@@ -4718,11 +4743,15 @@
 	  ;; We have to do this since selecting the window
 	  ;; may change the point.  So we set the window point.
 	  (set-window-point window point)))
-      (let* ((handles (or ihandles
-			  (mm-dissect-buffer nil gnus-article-loose-mime)
-			  (and gnus-article-emulate-mime
-			       (mm-uu-dissect))))
-	     (inhibit-read-only t) handle name type b e display)
+      (let ((handles ihandles)
+	    (inhibit-read-only t)
+	    handle)
+	(cond (handles)
+	      ((setq handles (mm-dissect-buffer nil gnus-article-loose-mime))
+	       (when gnus-article-emulate-mime
+		 (mm-uu-dissect-text-parts handles)))
+	      (gnus-article-emulate-mime
+	       (setq handles (mm-uu-dissect))))
 	(when (and (not ihandles)
 		   (not gnus-displaying-mime))
 	  ;; Top-level call; we clean up.