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., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
31 ;;; @ newsgroup default charset
34 (defvar gnus-newsgroup-default-charset-alist
35 '(("^\\(fj\\|tnn\\|japan\\)\\." . iso-2022-jp-2)
37 ("^relcom\\." . koi8-r)
38 ("^alt\\.chinese\\.text\\.big5" . cn-big5)
39 ("^hk\\(star\\)?\\." . cn-big5)
41 ("^alt\\.chinese" . hz-gb-2312)
43 "Alist of newsgroup patterns vs. corresponding default MIME charset.
44 Each element looks like (REGEXP . SYMBOL). REGEXP is pattern for
45 newsgroup name. SYMBOL is MIME charset or coding-system.")
47 (defun gnus-set-newsgroup-default-charset (newsgroup charset)
48 "Set CHARSET for the NEWSGROUP as default MIME charset."
49 (let* ((ng-regexp (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)"))
50 (pair (assoc ng-regexp gnus-newsgroup-default-charset-alist)))
53 (setq gnus-newsgroup-default-charset-alist
54 (cons (cons ng-regexp charset)
55 gnus-newsgroup-default-charset-alist)))))
61 (defun gnus-set-summary-default-charset ()
62 "Set up `default-mime-charset' of summary buffer.
63 It is specified by variable `gnus-newsgroup-default-charset-alist'
64 \(cf. function `gnus-set-newsgroup-default-charset')."
65 (if (buffer-live-p gnus-summary-buffer)
66 (let* ((qgroup (save-excursion
67 (set-buffer gnus-summary-buffer)
69 (rgroup (gnus-group-real-name qgroup))
71 (setq charset (catch 'found
72 ;; First, use "qualified" newsgroup name.
73 (setq alist gnus-newsgroup-default-charset-alist)
74 (while (setq pair (car alist))
75 (if (string-match (car pair) qgroup)
76 (throw 'found (cdr pair)))
77 (setq alist (cdr alist)))
78 ;; Next, try "real" newsgroup name.
79 (setq alist gnus-newsgroup-default-charset-alist)
80 (while (setq pair (car alist))
81 (if (string-match (car pair) rgroup)
82 (throw 'found (cdr pair)))
83 (setq alist (cdr alist)))))
87 (set-buffer gnus-summary-buffer)
88 (make-local-variable 'default-mime-charset)
89 (setq default-mime-charset charset))
90 (make-local-variable 'default-mime-charset)
91 (setq default-mime-charset charset))
92 (kill-local-variable 'default-mime-charset)))))
100 ;;; gnus-i18n.el ends here