Commit | Line | Data |
---|---|---|
55535639 | 1 | ;;; gnus-mule.el --- provide backward compatibility function to GNUS |
33ecc295 | 2 | |
8f688cb0 | 3 | ;; Copyright (C) 1995, 1997, 2002 Free Software Foundation, Inc. |
33ecc295 KH |
4 | ;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN. |
5 | ||
fcb282a5 DL |
6 | ;; Maintainer: FSF |
7 | ;; Keywords: news, i18n | |
33ecc295 KH |
8 | |
9 | ;; This file is part of GNU Emacs. | |
10 | ||
11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 | ;; it under the terms of the GNU General Public License as published by | |
13 | ;; the Free Software Foundation; either version 2, or (at your option) | |
14 | ;; any later version. | |
15 | ||
16 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;; GNU General Public License for more details. | |
20 | ||
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. | |
25 | ||
26 | ;;; Commentary: | |
27 | ||
28 | ;; This file provides the function `gnus-mule-add-group' for backward | |
29 | ;; compatibility with old version of Gnus included in Emacs 20. | |
30 | ||
55535639 PJ |
31 | ;;; Code: |
32 | ||
33ecc295 KH |
33 | (require 'gnus-sum) |
34 | ||
35 | ;;;###autoload | |
36 | (defun gnus-mule-add-group (name coding-system) | |
37 | "Specify that articles of news group NAME are encoded in CODING-SYSTEM. | |
38 | All news groups deeper than NAME are also the target. | |
39 | If CODING-SYSTEM is a cons, the car part is used and the cdr | |
40 | part is ignored. | |
41 | ||
8f688cb0 | 42 | This function exists for backward compatibility with Emacs 20. It is |
33ecc295 KH |
43 | recommended to customize the variable `gnus-group-charset-alist' |
44 | rather than using this function." | |
45 | (if (consp coding-system) | |
46 | ;; Ignore the cdr part because now Gnus can't use different | |
47 | ;; coding systems for encoding and decoding. | |
48 | (setq coding-system (car coding-system))) | |
49 | (let ((tail gnus-group-charset-alist) | |
50 | (prev nil) | |
51 | (pattern (concat "^" (regexp-quote name)))) | |
52 | ;; Check entries of `gnus-group-charset-alist' if they match NAME. | |
53 | (while (not (string-match (car (car tail)) name)) | |
54 | (setq prev tail tail (cdr tail))) | |
55 | (if tail | |
56 | ;; A matching entry was found. | |
57 | (if (string= pattern (car (car tail))) | |
58 | ;; We can modify this entry. | |
59 | (setcar (cdr (car tail)) coding-system) | |
60 | ;; We must add a new entry before this. | |
61 | (if prev | |
62 | (setcdr prev (cons (list pattern coding-system) | |
63 | (cdr prev))) | |
64 | (setq gnus-group-charset-alist | |
65 | (cons (list pattern coding-system) | |
66 | gnus-group-charset-alist)))) | |
67 | ;; We must prepend a new entry. | |
68 | (setq gnus-group-charset-alist | |
69 | (cons (list pattern coding-system) | |
70 | gnus-group-charset-alist))))) | |
71 | ||
72 | (provide 'gnus-mule) | |
73 | ||
ab5796a9 | 74 | ;;; arch-tag: 525e6b69-85de-4dfc-9dbb-764c795d63af |
55535639 | 75 | ;;; gnus-mule.el ends here |