diff options
| -rw-r--r-- | lisp/gnus/gnus-mule.el | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/lisp/gnus/gnus-mule.el b/lisp/gnus/gnus-mule.el new file mode 100644 index 00000000000..c83bdb27d96 --- /dev/null +++ b/lisp/gnus/gnus-mule.el | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | ;;; gnus-mule.el --- Provide backward compatibility function to GNUS | ||
| 2 | |||
| 3 | ;; Copyright (C) 1995,1997 Free Software Foundation, Inc. | ||
| 4 | ;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN. | ||
| 5 | |||
| 6 | ;; Keywords: gnus, mule | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | ;; Boston, MA 02111-1307, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; This file provides the function `gnus-mule-add-group' for backward | ||
| 28 | ;; compatibility with old version of Gnus included in Emacs 20. | ||
| 29 | |||
| 30 | (require 'gnus-sum) | ||
| 31 | |||
| 32 | ;;;###autoload | ||
| 33 | (defun gnus-mule-add-group (name coding-system) | ||
| 34 | "Specify that articles of news group NAME are encoded in CODING-SYSTEM. | ||
| 35 | All news groups deeper than NAME are also the target. | ||
| 36 | If CODING-SYSTEM is a cons, the car part is used and the cdr | ||
| 37 | part is ignored. | ||
| 38 | |||
| 39 | This function exists for backward comaptibility with Emacs 20. It is | ||
| 40 | recommended to customize the variable `gnus-group-charset-alist' | ||
| 41 | rather than using this function." | ||
| 42 | (if (consp coding-system) | ||
| 43 | ;; Ignore the cdr part because now Gnus can't use different | ||
| 44 | ;; coding systems for encoding and decoding. | ||
| 45 | (setq coding-system (car coding-system))) | ||
| 46 | (let ((tail gnus-group-charset-alist) | ||
| 47 | (prev nil) | ||
| 48 | (pattern (concat "^" (regexp-quote name)))) | ||
| 49 | ;; Check entries of `gnus-group-charset-alist' if they match NAME. | ||
| 50 | (while (not (string-match (car (car tail)) name)) | ||
| 51 | (setq prev tail tail (cdr tail))) | ||
| 52 | (if tail | ||
| 53 | ;; A matching entry was found. | ||
| 54 | (if (string= pattern (car (car tail))) | ||
| 55 | ;; We can modify this entry. | ||
| 56 | (setcar (cdr (car tail)) coding-system) | ||
| 57 | ;; We must add a new entry before this. | ||
| 58 | (if prev | ||
| 59 | (setcdr prev (cons (list pattern coding-system) | ||
| 60 | (cdr prev))) | ||
| 61 | (setq gnus-group-charset-alist | ||
| 62 | (cons (list pattern coding-system) | ||
| 63 | gnus-group-charset-alist)))) | ||
| 64 | ;; We must prepend a new entry. | ||
| 65 | (setq gnus-group-charset-alist | ||
| 66 | (cons (list pattern coding-system) | ||
| 67 | gnus-group-charset-alist))))) | ||
| 68 | |||
| 69 | (provide 'gnus-mule) | ||
| 70 | |||
| 71 | ;; gnus-mule.el ends here | ||