1 ;;; gnus-i18n.el --- Internationalization for Gnus
3 ;; Copyright (C) 1996,1997 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Keywords: internationalization, news, mail
9 ;; This file is not part of GNU Emacs yet.
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;;; @ newsgroup default charset
31 (defvar gnus-newsgroup-default-charset-alist
32 '(("\\(^\\|:\\)\\(fj\\|tnn\\|japan\\)\\." . iso-2022-jp-2)
33 ("\\(^\\|:\\)han\\." . euc-kr)
34 ("\\(^\\|:\\)relcom\\." . koi8-r)
35 ("\\(^\\|:\\)alt\\.chinese\\.text\\.big5" . cn-big5)
36 ("\\(^\\|:\\)hk\\(star\\)?\\." . cn-big5)
37 ("\\(^\\|:\\)tw\\." . cn-big5)
38 ("\\(^\\|:\\)alt\\.chinese" . hz-gb-2312)
40 "Alist of newsgroup patterns vs. corresponding default MIME charset.
41 Each element looks like (REGEXP . SYMBOL). REGEXP is pattern for
42 newsgroup name. SYMBOL is MIME charset or coding-system.")
44 (defun gnus-set-newsgroup-default-charset (newsgroup charset)
45 "Set CHARSET for the NEWSGROUP as default MIME charset."
46 (let* ((ng-regexp (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)"))
47 (pair (assoc ng-regexp gnus-newsgroup-default-charset-alist))
51 (setq gnus-newsgroup-default-charset-alist
52 (cons (cons ng-regexp charset)
53 gnus-newsgroup-default-charset-alist))
60 (defun gnus-set-summary-default-charset ()
61 "Set up `default-mime-charset' of summary buffer.
62 It is specified by variable `gnus-newsgroup-default-charset-alist'
63 \(cf. function `gnus-set-newsgroup-default-charset')."
64 (if (buffer-live-p gnus-summary-buffer)
69 (set-buffer gnus-summary-buffer)
71 (alist gnus-newsgroup-default-charset-alist))
73 (let ((pair (car alist)))
74 (if (string-match (car pair) group)
75 (throw 'found (cdr pair))
77 (setq alist (cdr alist)))
82 (set-buffer gnus-summary-buffer)
83 (make-local-variable 'default-mime-charset)
84 (setq default-mime-charset charset))
85 (make-local-variable 'default-mime-charset)
86 (setq default-mime-charset charset))
87 (kill-local-variable 'default-mime-charset)))))
95 ;;; gnus-i18n.el ends here