From: ShengHuo ZHU Date: Wed, 1 Dec 1999 18:16:16 +0000 (+0000) Subject: Show an article with a specified charset. X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=b281ba3d3262cc41e4e93e8cd874a0479d571ea3 Show an article with a specified charset. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e440df22e..809fc40b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +1999-12-01 13:04:09 Shenghuo ZHU + + * gnus-sum.el (gnus-summary-show-article): Support numbered ARG + for charset. + (gnus-summary-show-article-charset-alist): New variable. + + * mm-bodies.el (mm-decode-string): Support gnus-all and + gnus-unknown. + (mm-decode-body): Ditto. + * rfc2047.el (rfc2047-decode): Ditto. + 1999-12-01 17:37:18 Lars Magne Ingebrigtsen * mail-source.el (mail-source-delete-incoming): Change default to @@ -962,7 +973,7 @@ Mon Sep 27 15:18:05 1999 Lars Magne Ingebrigtsen * gnus-art.el (gnus-treat-predicate): Work for (not 5). -1999-08-27 Peter von der Ah-Ai +1999-08-27 Peter von der Ahi * message.el (message-send): More helpful error message if sending fails @@ -1164,7 +1175,7 @@ Fri Aug 27 13:17:48 1999 Lars Magne Ingebrigtsen * gnus-agent.el (gnus-agent-get-undownloaded-list): Don't mark cached articles as `undownloaded'. -Tue Jul 20 02:39:56 1999 Peter von der Ah-Ai +Tue Jul 20 02:39:56 1999 Peter von der Ahi * gnus-sum.el (gnus-summary-exit): Allow gnus-use-adaptive-scoring to have buffer local values. @@ -3716,7 +3727,7 @@ Mon Nov 30 23:38:02 1998 Shenghuo ZHU * mm-uu.el (mm-uu-dissect): Use mm-make-handle. -1998-12-01 01:53:49 Fran-Agois Pinard +1998-12-01 01:53:49 Frangois Pinard * nndoc.el (nndoc-mime-parts-type-p): Do related. @@ -5462,7 +5473,7 @@ Mon Sep 14 18:55:38 1998 Lars Magne Ingebrigtsen * rfc2047.el (rfc2047-q-encode-region): Would bug out. -1998-09-13 Fran-Agois Pinard +1998-09-13 Frangois Pinard * nndoc.el: Make nndoc-dissection-alist simpler for MIME, adjust all related functions. Handle message/rfc822 parts. Display subject on diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index dfc7dd92e..00ae51859 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -849,6 +849,17 @@ This variable uses the same syntax as `gnus-emphasis-alist'." gnus-emphasis-highlight-words))))) :group 'gnus-summary-visual) +(defcustom gnus-summary-show-article-charset-alist + nil + "Alist of number and charset. +The article will be shown with the charset corresponding to the +numbered argument. +For example: ((1 . cn-gb-2312) (2 . big5))." + :type '(repeat (cons (number :tag "Argument" 1) + (symbol :tag "Charset"))) + :group 'gnus-charset) + + ;;; Internal variables (defvar gnus-article-mime-handles nil) @@ -7110,12 +7121,23 @@ to save in." (defun gnus-summary-show-article (&optional arg) "Force re-fetching of the current article. -If ARG (the prefix) is non-nil, show the raw article without any -article massaging functions being run." +If ARG (the prefix) is a number, show the article with the charset +defined in `gnus-summary-show-article-charset-alist', or the charset +inputed. +If ARG (the prefix) is non-nil and not a number, show the raw article +without any article massaging functions being run." (interactive "P") - (if (not arg) - ;; Select the article the normal way. - (gnus-summary-select-article nil 'force) + (cond + ((numberp arg) + (let ((gnus-newsgroup-charset + (or (cdr (assq arg gnus-summary-show-article-charset-alist)) + (read-coding-system "Charset: "))) + (gnus-newsgroup-ignored-charsets 'gnus-all)) + (gnus-summary-select-article nil 'force))) + ((not arg) + ;; Select the article the normal way. + (gnus-summary-select-article nil 'force)) + (t ;; We have to require this here to make sure that the following ;; dynamic binding isn't shadowed by autoloading. (require 'gnus-async) @@ -7132,7 +7154,7 @@ article massaging functions being run." (save-excursion (set-buffer gnus-article-buffer) (mm-destroy-parts gnus-article-mime-handles))) - (gnus-summary-select-article nil 'force))) + (gnus-summary-select-article nil 'force)))) (gnus-summary-goto-subject gnus-current-article) (gnus-summary-position-point)) diff --git a/lisp/mm-bodies.el b/lisp/mm-bodies.el index ad7bbeb17..8467ef7d1 100644 --- a/lisp/mm-bodies.el +++ b/lisp/mm-bodies.el @@ -179,15 +179,22 @@ If no encoding was done, nil is returned." The characters in CHARSET should then be decoded." (if (stringp charset) (setq charset (intern (downcase charset)))) - (if (or (not charset) (memq charset mail-parse-ignored-charsets)) + (if (or (not charset) + (eq 'gnus-all mail-parse-ignored-charsets) + (memq 'gnus-all mail-parse-ignored-charsets) + (memq charset mail-parse-ignored-charsets)) (setq charset mail-parse-charset)) (save-excursion (when encoding (mm-decode-content-transfer-encoding encoding type)) (when (featurep 'mule) - (let (mule-charset) - (when (and charset - (setq mule-charset (mm-charset-to-coding-system charset)) + (let ((mule-charset (mm-charset-to-coding-system charset))) + (if (and (not mule-charset) + (listp mail-parse-ignored-charsets) + (memq 'gnus-unknown mail-parse-ignored-charsets)) + (setq mule-charset + (mm-charset-to-coding-system mail-parse-charset))) + (when (and charset mule-charset ;; buffer-file-coding-system ;;Article buffer is nil coding system ;;in XEmacs @@ -201,13 +208,20 @@ The characters in CHARSET should then be decoded." "Decode STRING with CHARSET." (if (stringp charset) (setq charset (intern (downcase charset)))) - (if (or (not charset) (memq charset mail-parse-ignored-charsets)) + (if (or (not charset) + (eq 'gnus-all mail-parse-ignored-charsets) + (memq 'gnus-all mail-parse-ignored-charsets) + (memq charset mail-parse-ignored-charsets)) (setq charset mail-parse-charset)) (or (when (featurep 'mule) - (let (mule-charset) - (when (and charset - (setq mule-charset (mm-charset-to-coding-system charset)) + (let ((mule-charset (mm-charset-to-coding-system charset))) + (if (and (not mule-charset) + (listp mail-parse-ignored-charsets) + (memq 'gnus-unknown mail-parse-ignored-charsets)) + (setq mule-charset + (mm-charset-to-coding-system mail-parse-charset))) + (when (and charset mule-charset (mm-multibyte-p) (or (not (eq mule-charset 'ascii)) (setq mule-charset mail-parse-charset))) diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index 1a08b3c07..334475395 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -338,9 +338,16 @@ Valid ENCODINGs are \"B\" and \"Q\". If your Emacs implementation can't decode CHARSET, it returns nil." (if (stringp charset) (setq charset (intern (downcase charset)))) - (if (or (not charset) (memq charset mail-parse-ignored-charsets)) + (if (or (not charset) + (eq 'gnus-all mail-parse-ignored-charsets) + (memq 'gnus-all mail-parse-ignored-charsets) + (memq charset mail-parse-ignored-charsets)) (setq charset mail-parse-charset)) (let ((cs (mm-charset-to-coding-system charset))) + (if (and (not cs) charset + (listp mail-parse-ignored-charsets) + (memq 'gnus-unknown mail-parse-ignored-charsets)) + (setq cs (mm-charset-to-coding-system mail-parse-charset))) (when cs (when (and (eq cs 'ascii) mail-parse-charset)