tm 7.76.
[elisp/tm.git] / gnus / gnus-charset.el
diff --git a/gnus/gnus-charset.el b/gnus/gnus-charset.el
new file mode 100644 (file)
index 0000000..a0e0f01
--- /dev/null
@@ -0,0 +1,114 @@
+;;;
+;;; gnus-charset.el --- MIME charset extension for Gnus
+;;;
+;;; Copyright (C) 1995 Free Software Foundation, Inc.
+;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
+;;;
+;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Created: 1996/8/6
+;;; Version:
+;;;    $Id: gnus-charset.el,v 0.1 1996/08/06 12:07:28 morioka Exp $
+;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
+;;;
+;;; This file is not part of GNU Emacs yet.
+;;;
+;;; This program is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU General Public License as
+;;; published by the Free Software Foundation; either version 2, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with This program.  If not, write to the Free Software
+;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;;;
+;;; Code:
+
+(defvar running-xemacs (string-match "XEmacs" emacs-version))
+(defvar running-xemacs-20 (and running-xemacs
+                              (= emacs-major-version 20)))
+
+
+;;; @ newsgroup default charset
+;;;
+
+(defvar gnus-newsgroup-default-charset-alist nil)
+
+(defun gnus-set-newsgroup-default-charset (newsgroup charset)
+  "Set CHARSET for the NEWSGROUP as default MIME charset."
+  (set-alist 'gnus-newsgroup-default-charset-alist
+            (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)")
+            charset))
+
+
+;;; @ for mule (Multilingual support)
+;;;
+
+(cond
+ ((featurep 'mule)
+  (cond ((boundp 'MULE) ; for MULE 1.* and 2.*.
+        (defun gnus-set-nntp-coding-system ()
+          (define-service-coding-system gnus-nntp-service nil *noconv*)
+          )
+        (add-hook 'gnus-open-server-hook 'gnus-set-nntp-coding-system)
+        )
+       (running-xemacs-20
+        (or (boundp '*noconv*)
+            (defconst *noconv* 'noconv)
+            )))
+  (call-after-loaded
+   'nnheader
+   (lambda ()
+     (defun nnheader-find-file-noselect (filename &optional nowarn rawfile)
+       (let ((file-coding-system-for-read *noconv*))
+        (find-file-noselect filename nowarn rawfile)
+        ))
+     (defun nnheader-insert-file-contents-literally
+       (filename &optional visit beg end replace)
+       (let ((file-coding-system-for-read *noconv*))
+        (insert-file-contents-literally filename visit beg end replace)
+        ))
+     ))
+  (call-after-loaded
+   'nnmail
+   (lambda ()
+     (defun nnmail-find-file (file)
+       "Insert FILE in server buffer safely. [tm-gnus5.el]"
+       (set-buffer nntp-server-buffer)
+       (erase-buffer)
+       (let ((format-alist nil)
+             (after-insert-file-functions   ; for jam-code-guess
+              (if (memq 'jam-code-guess-after-insert-file-function
+                        after-insert-file-functions)
+                  '(jam-code-guess-after-insert-file-function)))
+            (file-coding-system-for-read *noconv*))
+        (condition-case ()
+            (progn (insert-file-contents file) t)
+          (file-error nil))))
+     ))
+  (defun gnus-prepare-save-mail-function ()
+    (setq file-coding-system *noconv*)
+    )
+  (add-hook 'nnmail-prepare-save-mail-hook
+           'gnus-prepare-save-mail-function)
+  
+  (gnus-set-newsgroup-default-charset "alt.chinese"            'hz)
+  (gnus-set-newsgroup-default-charset "alt.chinese.text.big5"  'big5)
+  (gnus-set-newsgroup-default-charset "tw"                     'big5)
+  (gnus-set-newsgroup-default-charset "hk"                     'big5)
+  (gnus-set-newsgroup-default-charset "hkstar"                 'big5)
+  (gnus-set-newsgroup-default-charset "han"                            'euc-kr)
+  (gnus-set-newsgroup-default-charset "relcom"                 'koi8-r)
+  ))
+
+
+;;; @ end
+;;;
+
+(provide 'gnus-charset)
+
+;;; gnus-charset.el ends here