1 ;;; gnus-charset.el --- MIME charset extension for Gnus
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; $Id: gnus-charset.el,v 0.6 1996/08/22 17:51:22 morioka Exp $
9 ;; Keywords: news, MIME, multimedia, multilingual, encoded-word
11 ;; This file is not part of GNU Emacs yet.
13 ;; This program is free software; you can redistribute it and/or
14 ;; modify it under the terms of the GNU General Public License as
15 ;; published by the Free Software Foundation; either version 2, or (at
16 ;; your option) any later version.
18 ;; This program is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with this program; see the file COPYING. If not, write to
25 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
33 ;;; @ newsgroup default charset
36 (defvar gnus-newsgroup-default-charset-alist nil)
38 (defun gnus-set-newsgroup-default-charset (newsgroup charset)
39 "Set CHARSET for the NEWSGROUP as default MIME charset."
40 (let* ((ng-regexp (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)"))
41 (pair (assoc ng-regexp gnus-newsgroup-default-charset-alist))
45 (setq gnus-newsgroup-default-charset-alist
46 (cons (cons ng-regexp charset)
47 gnus-newsgroup-default-charset-alist))
51 ;;; @ for mule (Multilingual support)
57 (defvar nntp-open-binary-connection-function
58 (if (featurep 'gnus-load)
60 (if (boundp 'nntp-open-connection-function)
61 nntp-open-connection-function
62 'nntp-open-network-stream)
63 ;; maybe Gnus 5.[01] or Gnus 5.[23]
64 (if (boundp 'nntp-open-server-function)
65 nntp-open-server-function
66 'nntp-open-network-stream)
68 (defun nntp-open-network-stream-with-no-code-conversion (&rest args)
69 (let ((proc (apply nntp-open-binary-connection-function args)))
70 (set-process-input-coding-system proc *noconv*)
72 (if (featurep 'gnus-load)
73 (setq nntp-open-connection-function
74 'nntp-open-network-stream-with-no-code-conversion)
75 (setq nntp-open-server-function
76 'nntp-open-network-stream-with-no-code-conversion)
81 (defun nnheader-find-file-noselect (filename &optional nowarn rawfile)
82 (let ((file-coding-system-for-read *noconv*))
83 (find-file-noselect filename nowarn rawfile)
85 (defun nnheader-insert-file-contents-literally
86 (filename &optional visit beg end replace)
87 (let ((file-coding-system-for-read *noconv*))
88 (insert-file-contents-literally filename visit beg end replace)
94 (defun nnmail-find-file (file)
95 "Insert FILE in server buffer safely. [gnus-charset.el]"
96 (set-buffer nntp-server-buffer)
98 (let ((format-alist nil)
99 (after-insert-file-functions ; for jam-code-guess
100 (if (memq 'jam-code-guess-after-insert-file-function
101 after-insert-file-functions)
102 '(jam-code-guess-after-insert-file-function)))
103 (file-coding-system-for-read *noconv*))
105 (progn (insert-file-contents file) t)
108 (defun gnus-prepare-save-mail-function ()
109 (setq file-coding-system *noconv*)
111 (add-hook 'nnmail-prepare-save-mail-hook
112 'gnus-prepare-save-mail-function)
114 (gnus-set-newsgroup-default-charset "alt.chinese" 'hz)
115 (gnus-set-newsgroup-default-charset "alt.chinese.text.big5" 'big5)
116 (gnus-set-newsgroup-default-charset "tw" 'big5)
117 (gnus-set-newsgroup-default-charset "hk" 'big5)
118 (gnus-set-newsgroup-default-charset "hkstar" 'big5)
119 (gnus-set-newsgroup-default-charset "han" 'euc-kr)
120 (gnus-set-newsgroup-default-charset "relcom" 'koi8-r)
127 (provide 'gnus-charset)
129 ;;; gnus-charset.el ends here