From e81909bba6d3f0df9aad905f2906f4880a935372 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 13 Jan 2006 07:15:55 +0000 Subject: [PATCH] Synch to No Gnus 200601130715. --- lisp/ChangeLog | 12 ++++++++++++ lisp/gnus-art.el | 55 ++++++++++++++++++++++++++++++++++++++--------------- lisp/mm-view.el | 30 +++++++++++++++++++++++++---- texi/ChangeLog | 4 ++++ texi/gnus-ja.texi | 10 ++++++++-- texi/gnus.texi | 9 +++++++-- 6 files changed, 97 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6d1d882..45eb217 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2006-01-13 Katsumi Yamaoka + + * 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. + + * 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-12 Reiner Steib * mm-uu.el (mm-uu-type-alist): Fix previous message-marks commit. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 0152653..15041e4 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -2634,25 +2634,36 @@ If READ-CHARSET, ask for a coding system." (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 @@ -2693,6 +2704,20 @@ If READ-CHARSET, ask for a coding system." ;; 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." diff --git a/lisp/mm-view.el b/lisp/mm-view.el index 1bce241..ffdd2fd 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -49,8 +49,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) @@ -62,8 +61,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) @@ -267,6 +265,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. diff --git a/texi/ChangeLog b/texi/ChangeLog index 774fdfe..c410b88 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,7 @@ +2006-01-13 Katsumi Yamaoka + + * gnus.texi (Article Washing): Additions. + 2006-01-10 Katsumi Yamaoka * gnus.texi (RSS): Document nnrss-wash-html-in-text-plain-parts. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index ceb0f6b..21760c6 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -8452,7 +8452,10 @@ URL に含まれる改行を削除します。いくつかのメイラーは、行を短くするために を示す @code{Content-Type} ヘッダーを持っていたならば、それは gnus によっ て自動的に行なわれることに注意して下さい。 -接頭引数が与えられると、文字セットを尋ねられます。 +接頭引数が与えられると、文字セットを尋ねられます。それがもし数値だったら、 +@code{gnus-summary-show-article-charset-alist} (@pxref{Paging the +Article}) で定義されている文字セットが使われます。(訳注: 実質的には「文 +字セット」ではなくて @code{coding-system} です。) @vindex gnus-article-wash-function ディフォルトでは @acronym{HTML} の変換に @code{mm-text-html-renderer} @@ -8463,12 +8466,15 @@ Emacs MIME Manual}) で設定された関数を使いますが、変 りです: @table @code -@item W3 +@item w3 Emacs/W3 を使います。 @item w3m @uref{http://emacs-w3m.namazu.org/, emacs-w3m} を使います。 +@item w3m-standalone +@uref{http://w3m.sourceforge.net/, w3m} を使います。 + @item links @uref{http://links.sf.net/, Links} を使います。 diff --git a/texi/gnus.texi b/texi/gnus.texi index a94ebc6..59f9298 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -8688,7 +8688,9 @@ Treat @acronym{HTML} (@code{gnus-article-wash-html}). Note that this is usually done automatically by Gnus if the message in question has a @code{Content-Type} header that says that the message is @acronym{HTML}. -If a prefix is given, a charset will be asked for. +If a prefix is given, a charset will be asked for. If it is a number, +the charset defined in @code{gnus-summary-show-article-charset-alist} +(@pxref{Paging the Article}) will be used. @vindex gnus-article-wash-function The default is to use the function specified by @@ -8699,12 +8701,15 @@ Customization, emacs-mime, The Emacs MIME Manual}) to convert the can use include: @table @code -@item W3 +@item w3 Use Emacs/W3. @item w3m Use @uref{http://emacs-w3m.namazu.org/, emacs-w3m}. +@item w3m-standalone +Use @uref{http://w3m.sourceforge.net/, w3m}. + @item links Use @uref{http://links.sf.net/, Links}. -- 1.7.10.4